How can I solve Unable to lock the administration directory (/var/lib/dpkg/) [duplicate]
I am really New to UBUNTU 14.04 and whenever I try to update or install anything I get this error:
sudo apt-get update [sudo] password for trojanfm:
E: Could not ge lock /var/lib/apt/lists/lock - open (11: Resource temporarily
unavailable)
E: Unable to lock directory /var/lib/apt/lists/
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?
Solution 1:
search for processes. Since Ubuntu 16.04, "apt" is used instead of "apt-get"
ps -A | grep apt-get
or
ps -aux | grep 'apt-get'
or
ps -A | grep apt
then see if there any process running as apt-get/apt
kill that process it by using:
sudo kill -9 <process-id>
for example if process id is 2345
sudo kill -9 2345
then run the sudo apt-get update
Edit: If you are sure that you have no instances of dpkg or apt running and you still get the message, you can just delete the file:
sudo rm /var/lib/apt/lists/lock
A lock file is just a file with zero size that indicates locking of a resource.
Update:
As of Ubuntu 16.04 release, apt-get was replaced with apt. The running process can be located with:
ps -A | grep apt