How To Fix “Could not get lock /var..”Ubuntu [Solved]

If you have a problem with Updating Ubuntu or Kali Linux destribution after sudo command: apt-get update, and Console shows that:

Reading package lists… Done
E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

You can use sudo lsof /var/lib/dpkg/lock to find the process that owns the lock file.

Just write this:

#sudo lsof /var/lib/dpkg/lock

Console will returns such as
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME with parameters.

Now command is:

sudo kill -9 <PID>

Please, get <PID> from lsof output. Possibility: sudo kill -9 171

And Console answer is: kill: (1719): No such process

After that you will be able to update. Just write:

sudo apt-get update

And you will see I hope that:

Hit:1 http://mirrors.netix.net/kali kali-rolling InRelease
Reading package lists… Done

After successfull update, please go to upgrade Ubuntu now:

sudo apt-get upgrade

Another solution

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

Summary
How To Fix "Could not get lock /var.."Ubuntu [Solved]
Article Name
How To Fix "Could not get lock /var.."Ubuntu [Solved]
Description
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/
Author
Publisher Name
TheCrazyBastard.Com

Leave a Reply

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