WARNING: This answer is applicable to Ubuntu version < 11.04, do not use it in a newer version as it will hard freeze your system
You will get this message if you forget to use
sudo when executing an
Otherwise this is a sign that something else is installing or removing software and has locked the
apt database while it performs the actions. The programs that can do this are:
- The Software Center
- The Update Manager
- The apt link installer (I think this now goes through SC)
- The apt-get or aptitude command line utilities.
You can force the lock off by removing the file, but it's not recommended without first closing the program that's holding the lock safely, since you could cause corruption or interrupt an installation (bad).
Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
If that doesn’t make effect, type the following in terminal that will remove the lock
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo fuser -cuk /var/cache/apt/archives/lock; sudo rm -f /var/cache/apt/archives/lock