34

I attempted to install dropbox on my Ubuntu system, but now I am unable to install or uninstall any software. I get this error:

E: Unable to lock the administration directory /var/lib/dpkg/lock?

I have already tried killing dpkg and restarting it sudo kill -TERM PID but it immediately tries to finish the installation again and gets stuck.

How do I resolve this?

Parto
  • 15,647
akp234
  • 443

3 Answers3

47

sudo rm /var/lib/dpkg/lock should do the trick. You can use ps afx|grep dpkg to check if there is still a process runnning at the same time. sudo killall dpkg will stop all running dpkg processes.

If you need to cancel the dropbox installation, try sudo dpkg --force-remove-reinstreq --remove nautilus-dropbox

noleti
  • 4,103
  • 28
  • 27
2

It means that software center or another terminal is still running a package operation, force removing it is not really recommended as it can cause corruption, but try closing those and if that doesn't do the trick then reboot and just open a terminal window and nothing else to install/do a package operation

sbergeron
  • 2,670
-3

The /var/lib/dpkg/lock is actually a file. If you think it is important, just rename it don't want to remove it.

sudo mv /var/lib/dpkg/lock /var/lib/dpkg/lock-backup