Fix Could not get lock /var/lib/dpkg/lock – Resource temporarily unavailable

get lock /var/lib/dpkg/lock - Resource temporarily unavailable

Fix get lock /var/lib/dpkg/lock – Resource temporarily unavailable

You been installing packages or updating your repositories and you run in an error message from apt. “Fix get lock /var/lib/dpkg/lock – Resource temporarily unavailable” this error can become quite annoying to beginners don’t worry I will show you how to remove the lock from /var/lib/dpkg/lock this will remove the lock and allow us to continue installing software and resources from Kali Linux repositories.

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?

Method 1:

First open up a new terminal and use the following command to remove the lock.

rm /var/lib/dpkg/lock

If the lock does not remove first time repeat the process above. The screen shot below shows the process of removing the lock as you can see the lock did not remove the first time and I had to repeat the process.

Use dpkg –configure -a to force packages to reconfigure.

sudo dpkg --configure -a

Method 2:

Alternatively you could look up the suspected processes using commands below. By using ps and grep together to create a pipeline we can easily look up suspected packages.

ps -A | grep apt

And then killing all processes that can seen in the output in terminal first you will need to look up the process number. it will by listed by the side of the processes that are running you then need to use the following commands to kill the processes.

sudo kill -6 processnum
Or we could alternatively use
sudo kill -SIGKILL processnum

I prefer using the first method by removing the Lock directly however use what ever method suits your situation best. Thanks for reading if you are still having trouble after reading the guide don’t hesitate to leave us a comment below.

get lock /var/lib/dpkg/lock – Resource temporarily unavailable

Thanks for supporting HackingVision

You may also like: Fix Update Errors in Kali Linux, Updating Official Repositories in Kali Linux