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.
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.
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.
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
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.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to Convert Comma Separated String into an Array in JavaScript
Use the split() Method You can use th...Data Binding in Angular9
In this Angular tutorial, we are going t...How to add elements to the beginning of an array in PHP
Use the PHP array_unshift() fu...How to forEach Over an Array in JavaScript
Use the forEach() Method You ca...How to Check If a Value Exists in an Array in JavaScript
Use the indexOf() Method You can use...