18

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?

userDepth
  • 2,010

2 Answers2

31

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?

GrannySez
  • 516
4

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
Eliah Kagan
  • 117,780
Ajay
  • 141