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

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

Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

Have you ever faced this problem while trying to install any program in linux? Today, while I was installing “pv” command then I came across this problem. This problem may arises when other apt-get  may have been running in background. This can be resolved simply by rebooting the system or by killing the the process which is using apt-get .
PROCESS 1:
Search for the process which uses apt-get:

ps -A | grep apt-get

Kill the process which uses apt-get by:

sudo kill -9 <process-id>

Suppose process id 2123 is using the apt-get;
eg. sudo kill -9 2123
then run sudo apt-get update
PROCESS 2:
OR it can be done by removing the locked files from lists and archives folder.

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

Enjoy using Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *