I’ve a Ubuntu 18.04 LTS digital machine which I take advantage of for testing functions. Every time I begin this VM and take a look at replace or set up any software utilizing APT package deal supervisor, I get the next error:
E: Couldn’t get lock /var/lib/dpkg/lock-frontend – open (11: Useful resource briefly unavailable)
E: Unable to amass the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is one other course of utilizing it?
Or, one thing related errors like under:
E: Couldn’t get lock /var/lib/dpkg/lock – open (11 Useful resource briefly unavailable)
E: Unable to lock the administration listing (/var/lib/dpkg/) is one other course of utilizing it?
E: Couldn’t get lock /var/lib/apt/lists/lock – open (11: Useful resource briefly unavailable)
E: Unable to lock listing /var/lib/apt/lists/
It occurs each single time. I needed to look ahead to a couple of minutes to carry out a apt operation.
I do know some course of has locked the apt database whereas putting in or eradicating software program or updating the system within the background. I ran the “high” command to research the record of working processes. After wanting into the output of high command, I got here to know that
Repair “E: Couldn’t get lock /var/lib/dpkg/lock” Error On Ubuntu
Should you ever encountered with this drawback, look ahead to a couple of minutes till the at present putting in or updating or uninstalling job to finish.
But when the method is caught for some cause and it locked the apt database for a number of minutes, you don’t have any selection however take away the lock. In that case, observe the under process to repair it.
First allow us to discover out which course of
$ sudo lsof /var/lib/dpkg/lock
If the lock file is completely different, for instance /var/lib/dpkg/lock-frontend, you could find PID of the method that owns this lock file with command:
$ sudo lsof /var/lib/dpkg/lock-frontend
If the lock file is “/var/lib/apt/lists/lock”, run:
$ sudo lsof /var/lib/apt/lists/lock
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 1548 root 6uW REG eight,2 zero 1181062 /var/lib/dpkg/lock
As you possibly can see within the above output, the PID of the method that holds the lock file is 1548.
Simply kill it to launch the lock utilizing command:
$ sudo kill -9 1548
Now you can safely take away the lock with instructions:
$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock-frontend
$ sudo rm /var/lib/apt/lists/lock
Additionally you might must delete the lock file within the cache listing:
$ sudo rm /var/cache/apt/archives/lock
After eradicating the lock, run:
$ sudo dpkg –configure -a
This could repair the issue.
This technique will work simply positive 99% of time. However please be aware that if the replace course of is working and also you killed the method in the course of package deal set up, you would possibly find yourself with damaged system. In such circumstances, don’t panic, simply observe the under information to repair it.
Thanks for stopping by!
Assist us that can assist you:
Have a Good day!!