I don't have any package installations running, yet I get the following error when I try to install a DEB package. I thought about rebooting the system but that could corrupt the database. And it has happened before.

sudo dpkg -i slack-desktop-2.1.2-amd64.deb 
dpkg: error: dpkg status database is locked by another process

sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Hit:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [188 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [94.2 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [387 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [383 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [147 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [326 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [323 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [113 kB]
Fetched 2,058 kB in 5s (360 kB/s)                                
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

  • 2
    Please edit your question to include the exact command you are using and the complete error message. – steeldriver Sep 20 '16 at 2:01

Try using sudo lsof /var/lib/dpkg/lock to see which process has locked the updater.

You can also use ps -ax | grep dpkg or ps -ax | grep apt however there is also the software centre and auto-updater which could be blocking the process at which point you can kill the offending processes using kill <process id number>.

Have a look here for some more things you can try if these don't work Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

  • 3
    sudo lsof /var/lib/dpkg/lock Did the work – userDepth Sep 20 '16 at 3:42

Enter following line to find the process ID:

lsof /var/lib/dpkg/lock-frontend

Then run this command with the PID that it revealed:

kill -9 PID

Not the answer you're looking for? Browse other questions tagged or ask your own question.