Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I've been getting this exact error message since I installed Ubuntu 11.04 Natty Narwhal 64-bit on 10/09.

I haven't installed any updates, so it can't be that, since its the first thing that pops up.

What I've tried:

My Ubuntu 11.04 (Oct 9th, 64-Bit) fresh install sends me this message when I try to execute the following commands

sudo rm /var/lib/dpkg/lock 
sudo rm /var/cache/apt/archives/lock

Message:

rm: cannot remove '/var/lib/dpkg/lock': No such file or directory

Here is what happens one minute after I installed Ubuntu (Regluar-not LTS version) via the ISO file downloaded directly from Ubuntu.com.

(I try to install VLC media player, after attempting to install Ubuntu Restricted Extras).

Here's what it says:

(Updates not installed yet at this point)

"An handleable error occurred"

There seems to be a programming error in aptdaemon, the software that allows you to install/remove software and to perform other package management related tasks.

Now,I have tried to check to see if there is a VITAL program holding the lock, but I'm a LINUX NEWBIE. Everything says that it's dormant, so what's holding the lock?

(I've also tried to update the kernel version, but that has never worked.)

PLEASE, if there is someone out there that knows what they are talking about, help me.

share|improve this question
... and edit into your question the output of sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock – fossfreedom Oct 9 '11 at 21:47

marked as duplicate by Jorge Castro, Eric Carvalho, Seth, Florian Diesch, hhlp Feb 26 at 7:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

That error message means that you aren't allowed to use two programs that use: /var/lib/dpkg/lock dpkg is used to unpack software packages to be installed in your system, some applications that use dpkg are: synaptic, ubuntu software center (when installing an application), apt-get, update manager and some others.

share|improve this answer

To find out what's holding the lock, you can try:

sudo lsof | grep /var/lib/dpkg/lock
share|improve this answer

The following worked for me under root:

killall -u "username"

After executing the command you will be logged out, on login i was able to complete my apt-get.

share|improve this answer

Try

sudo pkill apt-get

which will kill the apt-get process which is the one most likely to lock /var/lib/dpkg

share|improve this answer
A user should not run this unless they are looking to mess up their system. – RolandiXor Sep 25 '12 at 16:51

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