I just reinstalled Kali Linux in my PC and after my first logon,
I tried to run apt-get update
and had E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) error coming up.
Interesting, because I am the only user (I just installed the system) and there’s no other process using dpkg. This was pretty annoying as it stops you from installing updates or new softwares. Here’s a run down of the issues:
#rm /var/lib/dpkg/lock
#sudo dpkg --configure -a
if like this error other lock file also create error go to that path and then delete that lock file like this error
---------------------------------------------------Done---------------------------------------------------
I tried to run apt-get update
and had E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) error coming up.
Interesting, because I am the only user (I just installed the system) and there’s no other process using dpkg. This was pretty annoying as it stops you from installing updates or new softwares. Here’s a run down of the issues:
“E: Could not get lock /var/lib/dpkg/lock” error
This happens when I tried to use apt-get update
Trying to fix the error
Tried multiple steps
Try 1 – Rebooting:
At this point I tried restart and see if that makes any differences. It didn’t.
Try 2: – try with sudo
I tried using sudo to see if this was related with this other error dpkg: warning: ‘ldconfig’ not found in PATH or not executable.
sudo didn’t fix it.
Try 3 – Try Googling
Like some search results returned, I tried to delete lock file
Then update
Nope still no luck.
Try 4 – Actually read the error!
Then I actually read the freaking error which I didn’t do till now. Duh, the error is:
Which indicates that the lock file is in /var/lib/dpkg/lock folder. Silly me! So let’s have a look into /var/lib/dpkg/ folder to confirm is there is really a lock file in there?
There is a lock file. So let’s delete that.
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.
and Use dpkg –configure -a to force packages to reconfigure.
#rm /var/lib/dpkg/lock
#sudo dpkg --configure -a
if like this error other lock file also create error go to that path and then delete that lock file like this error
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
sudo rm /var/lib/dpkg/lock
---------------------------------------------------Done---------------------------------------------------
and then try to update again
Booyaa. Worked just fine. Well, ofc it does, when you can write and read properly!!!!
Now just to be on safe side, let’s do an apt-get upgrade
Yeah .. working well. and finally finish it with installing gimp.
Perfect.
Moral of this post
Sometimes it really helps when you actually read the error and not just follow Google search results blindly
0 comments:
Post a Comment