Fix get lock /var/lib/dpkg/lock – Resource temporarily unavailable
You have 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?
First, open up a new terminal and use the following command to remove the lock.
If the lock does not remove the first time repeat the process above. The screenshot 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
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
Kill all processes that can be seen in the output of the terminal first you will need to look up the process ID. Process ID will be 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 whatever 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