E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)

447,703

This may happen if

  1. 'Synaptic Package Manager' or 'Software Updater' is open.

  2. Some apt command is running in Terminal.

  3. 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.

Share:
447,703
GoodNite
Author by

GoodNite

Updated on September 18, 2022

Comments

  • GoodNite
    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
      Allen King over 2 years
      Perhaps 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
    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
    Pete Kelley over 4 years
    In 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
    Kreezxil over 4 years
    All these together worked like a charm for me.
  • Peter Krauss
    Peter Krauss over 4 years
    Some news about the UBUNTU 18 Livepatch?
  • Sameer Kumar Choudhary
    Sameer Kumar Choudhary over 4 years
    Follow this for detailed: solution itsfoss.com/could-not-get-lock-error, it resolved my issue as well
  • Shayan
    Shayan about 4 years
    Did all of this, still getting the error.
  • Peter Krauss
    Peter Krauss about 4 years
    A 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 redo apt 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. Even sudo killall apt apt results "apt: no process found"... So I do the next step, sudo rm ... and sudo dpkg --configure -a... Perfect! Restarts where I lost the apt process. Now I sse that fileJiXDNE is about ufw.
  • avn
    avn almost 4 years
    To 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> where process can be update, install etc...
  • QMaster
    QMaster almost 3 years
    Excellent on Ubuntu 20.04.1, Thanks.
  • Guillem Jover
    Guillem Jover over 2 years
    Please 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.