E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
447,703
This may happen if
'Synaptic Package Manager' or 'Software Updater' is open.
Some apt command is running in Terminal.
Some apt process is running in background.
For above wait for the process to complete. If this does not happen run in terminal:
sudo killall apt apt-get
If none of the above works, remove the lock files. Run in terminal: (Note that this can seriously break your system.)
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
then reconfigure the packages. Run in terminal:
sudo dpkg --configure -a
and
sudo apt update
That should do the job.
Author by
GoodNite
Updated on September 18, 2022Comments
-
GoodNite almost 2 years
I'm trying to run this command in the terminal:
sudo apt install software-properties-common
This is the error message I get:
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
-
Allen King over 2 yearsPerhaps reboot and try again. In my case, I tried to update using CLI command while the update was already ongoing and received the same error.
-
-
Manish Jain almost 5 years@CaTx This link will tell you what is happening behind provided solution itsfoss.com/could-not-get-lock-error
-
Pete Kelley over 4 yearsIn my case the machine had started just a little earlier and I got this problem. I tried again after about ten minutes (as I was looking at the situation) That time it ran ok. I vote this answer up but with a suggestion to emphasize to just try waiting before unlocking. And @Manish Jain -thanks! that reminder to gather a little info will help next time I have a similar issue! Cheers!
-
Kreezxil over 4 yearsAll these together worked like a charm for me.
-
Peter Krauss over 4 yearsSome news about the UBUNTU 18 Livepatch?
-
Sameer Kumar Choudhary over 4 yearsFollow this for detailed: solution itsfoss.com/could-not-get-lock-error, it resolved my issue as well
-
Shayan about 4 yearsDid all of this, still getting the error.
-
Peter Krauss about 4 yearsA case. During
apt upgrade
arrives an interactive choice (very strange about fileJiXDNE), and I wait to study... but lost internet connection. When back the error was there on redoapt upgrade
("heWaiting for cache lock")... Important to wait, and I do 10 minutes, but was repeating the error message 100 times, so I do ^C and start the recipe above. Evensudo killall apt apt
results "apt: no process found"... So I do the next step,sudo rm ...
andsudo dpkg --configure -a
... Perfect! Restarts where I lost theapt
process. Now I sse that fileJiXDNE is aboutufw
. -
avn almost 4 yearsTo add to what @PeteKelley said, running
ps aux | grep -i apt
showed that the system automatically started checking for updated when it was booted, hence the lock. It will look something like this/bin/sh /usr/lib/apt/apt.systemd.daily <process>
whereprocess
can beupdate, install
etc... -
QMaster almost 3 yearsExcellent on Ubuntu 20.04.1, Thanks.
-
Guillem Jover over 2 yearsPlease remove the incorrect advice to remove the lock files, as that's a certain recipe for database corruption. :/ I added a entry in the dpkg FAQ to cover this wiki.debian.org/Teams/Dpkg/…, And we have improved both the dpkg and apt error messages to print the process currently locking the files, and apt now even waits for the lock to be released. The presence of the files does not indicate that the file is locked.