219

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?
1
  • 1
    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.
    – Allen King
    Jan 9 at 18:21

1 Answer 1

371

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.

11
  • 13
    @CaTx This link will tell you what is happening behind provided solution itsfoss.com/could-not-get-lock-error Sep 12, 2019 at 13:32
  • 4
    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! Nov 14, 2019 at 12:59
  • 2
    All these together worked like a charm for me.
    – Kreezxil
    Nov 22, 2019 at 15:12
  • 1
    Some news about the UBUNTU 18 Livepatch? Dec 9, 2019 at 9:43
  • 3
    Did all of this, still getting the error.
    – Shayan
    Apr 7, 2020 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.