4

Ubuntu 16.04 with Cinnamon desktop.

I cannot update. Attempting gives

$ sudo apt-get update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

I can check to see what file has this locked:

$ sudo lsof /var/lib/apt/lists/lock
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
  Output information may be incomplete.
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
aptd    11127 root    9u   REG   0,24        0 181089 /var/lib/apt/lists/lock
aptd    11127 root   57u   REG   0,24        0 181089 /var/lib/apt/lists/lock
aptd    11127 root   58u   REG   0,24        0 181089 /var/lib/apt/lists/lock
$ ps aux | egrep "11127|PID" | egrep -v grep
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     11127  0.5  1.4 296068 103516 ?       SNl  08:59   0:06 /usr/bin/python3 /usr/sbin/aptd

I don't know what /usr/sbin/aptd is or if it's safe to kill. man /usr/sbin/aptd exists, but it didn't tell me much. I can't find anything about this in particular online, either.

Is /usr/sbin/aptd related to the small orange square with the white star in my system tray that keeps trying to remind me to update? Is it safe to kill?

Edit: After waiting a while, whatever had the lock released it on its own. No need to kill anything.

Chai T. Rex
  • 5,126
  • 1
  • 24
  • 48
Darien Marks
  • 259
  • 1
  • 6
  • 21
  • 4
    Possible duplicate of [Could not get lock /var/lib/apt/lists/lock](https://askubuntu.com/questions/335794/could-not-get-lock-var-lib-apt-lists-lock) and [Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?](https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process). – Byte Commander Jan 07 '18 at 19:59
  • The linked questions are the same underlying issue, but neither address `/usr/sbin/aptd` or whether it's safe to kill it. My own question is moot now, though. – Darien Marks Jan 08 '18 at 00:53
  • 4
    You were smart to check `lsof` and even smarter to wait. `aptd` is used by the package manager to install upgrades in the background. NEVER terminate `aptd` unless you know how to do so safely. And ABSOLUTELY NEVER release the apt lock manually while any package manager is running. The consequence of violating either varies depending upon what was being installed when apt was interrupted. – user535733 Jan 08 '18 at 01:07
  • 1
    @user535733 That's exactly the info I was looking for, thanks! Make it an answer and I'll accept it if this doesn't get deleted as a duplicate first. – Darien Marks Jan 08 '18 at 02:32
  • This isnt a duplicate @Byte and Darien. Mentioned links are about an issue which does not appear in Ubuntu 16 and later even if you interrupt apt or dpkg – sziraqui Jan 08 '18 at 06:31
  • 1
    @sziraqui Can you elaborate why 16.04+ should behave differently in that regard? – Byte Commander Jan 08 '18 at 13:03
  • I am saying this from my experience. I have used Ubuntu 14.04 to 17.10. Even if I manually interrupt a running apt-get update/upgrade or dpkg install, I did not get the lock error on 16.04+ versions. I think 16.04+ versions handle the lock state after keyboard interrupts. So I think this user is getting the error due to some apt process not initiated by the user. – sziraqui Jan 08 '18 at 14:22
  • Here's a proof on my current 17.10 https://asciinema.org/a/kNAeGDITSVz8Ry3Ce01NtGeTP – sziraqui Jan 08 '18 at 14:28

0 Answers0