Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

PROBLEM:

Some times we get the following error while trying yo install software using apt-get or synaptic packaging manager.
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?


How can we resolve this?

SOLUTION: 

The problem occurs if we are running another applications like synaptic using the directory.
So, if this is the case close the applications and try run the command again.

You will also get this message if you forget to use  sudo  when executing an apt command.
You can use sudo lsof /var/lib/dpkg/lock to find the process that owns the lock file
Then try to kill the process to remove the lock.

**WARNING**

This should be used as last resort. If you use this carelessly you can end up with a broken system.

You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock


You may also need to delete the lock file in the cache directory.
sudo rm /var/cache/apt/archives/lock


After that try using the apt-get or synaptic again.

Popular posts from this blog

INSTALLING MOBILE PARTNER IN LINUX

How to setup a wifi-hotspot in Ubuntu: The terminal way.

How to install OpenVAS 7 in Ubuntu