0

I'm running Ubuntu 16.10. The Ubuntu Software program in the GUI (which came with the installation) alerted me that there was a system update to install, so I clicked "yes" to install it through the GUI. There's no progress bar or anything like it for me to tell what's going on with it, so I initially assumed that it'd worked OK and everything was fine. I closed Ubuntu Software.

Meanwhile, I'd like to install some other software, this time using apt-get in the terminal. Unfortunately, when I try, it says "Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?" When I ran into this, I opened Ubuntu Software again and looked in the Updates section. Now, it says that there are no updates to add. But the problem with the administration directory being un-lockable persists, and when I try to install software through the GUI, it doesn't work either—I get the spinny wheel of "waiting."

I'm guessing that this means that the system update is still in progress and that's why the administration directory can't be locked. If I'd done the system update in the terminal, I'd know this for a fact because the prompt $ wouldn't appear again until the update is finished (...I think...I'm awfully new at this!) How can I tell how much longer the system update has to go, or at least confirm that it's still running and not just hanging endlessly?

Flourish
  • 27
  • 7

1 Answers1

0

Apt stores timestamps of completed actions. Different from lockfiles.

$ ls -l /var/lib/apt/periodic/
total 0
-rw-r--r-- 1 root root 0 Mar 15 06:26 autoclean-stamp
-rw-r--r-- 1 root root 0 Mar 20 22:20 download-upgradeable-stamp
-rw-r--r-- 1 root root 0 Mar 21 20:06 unattended-upgrades-stamp
-rw-r--r-- 1 root root 0 Mar 21 20:06 update-stamp
-rw-r--r-- 1 root root 0 Mar 23 09:45 update-success-stamp
-rw-r--r-- 1 root root 0 Mar 21 20:06 upgrade-stamp

You can see that the last apt upgrade (upgrade-stamp) completed 21 March at 20:06. If that's after you started the upgrade, then it completed.

If not, then check if apt is still running:

$ ps -e | grep apt
31958 pts/2    00:00:00 apt

In this case, apt is still running. Let it run.

If apt and dpkg are NOT running, then it's probably safe to delete the lockfile.

user535733
  • 68,493