Sometimes when you are working apt-get command to install package in Ubuntu or in same distribution system, sometimes you may get the error "Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
".
This is annoying when we need some program to install and get this error, specifically new users.
Below is the error I got when trying to install application using apt-get command.
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?
This error comes when some other appication is already installing or updating programs. This locks dpkg(Debian package manager) to run second process to install or update.
There are ways to fix this error. Let's discuss it.
Find the process and stop it
First of all check if Ubuntu Softwares or Software Updater is running. If it is running, then wait for it to complete.
If none of the program is running, then first check which service runs apt with below command.
ps aux | grep apt
This will return all services with search apt text.
matching 125985 0.0 0.0 18344 736 pts/0 S+ 17:58 0:00 grep --color=auto -i apt
And then kill the service by its process ID.
sudo kill -9 process_id
Or you can directly stop all instance of the apt service.
sudo killall apt apt-get
Delete the dpkg lock files
The other way is to delete lock files which stops to execute the command. A lock file is created under the any of these directories /var/lib/apt/lists/
, /var/lib/dpkg/
and /var/cache/apt/archives/
.
To remove the lock file, first remove the execute the below command.
sudo rm /var/lib/apt/lists/lock
If after the above command, it doesn't work then also delete the lock file from cache directory.
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
Then reconfigure the packages like this:
sudo dpkg --configure -a
In the last, update your packages repository list.
sudo apt-get update
This way you can solve this error. I hope you liked this article.