You got Unable to lock the administration directory error message when you try to run apt-get update command in Ubuntu? If you are getting below error message,
- E: Could not get 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?
Fix Unable to lock the administration directory (/var/lib/dpkg/) in Ubuntu
1. Search for processes
ps -A | grep apt-get
2. See if there is any process running as apt-get then kill that process
sudo kill -9
See above screenshot, when I run ps -A | grep apt-get , I got the id 10477. So I killed that process using ‘sudo kil -9 10477’.
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 lock file. A lock file is just a file with zero size that indicates locking of a resource. So to delete it tyep:
sudo rm /var/lib/apt/lists/lock
As of Ubuntu 16.04 release, apt-get was replaced with apt. The running process can be located with:
ps -A | grep apt