Preloader
Ubuntu
  • Estimated reading time: 1 Minute

How to solve Ubuntu 18.04 CLI error: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)

How to solve Ubuntu 18.04 CLI error: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)

If you are trying to install a new package on your system with the command line and you got the following exception:

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?

This exception happens when:

  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 the following command in your terminal:

sudo killall apt apt-get

Now try to run the command that triggers the exception once again and check if it works. If it doesn't work, proceed to run the following command:

sudo rm /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock*

Or delete every file individually:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

This removes the three possible lock files that generate the issue:

  • /var/lib/apt/lists/lock
  • /var/cache/apt/archives/lock
  • /var/lib/dpkg/lock*

After removing the lock files, you should be able to proceed with the original command that triggered the exception, however it should work now.

Happy coding !

Share:
Carlos Delgado

Carlos Delgado

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Related articles
How to install the latest version of Git in Ubuntu 20.04
26 Aug, 2022
  • Estimated reading time: 1 Minute
How to install aapanel in Ubuntu 20.04
14 Aug, 2022
  • Estimated reading time: 1 Minute
How to install Prometheus Node Exporter on Ubuntu 20.04
27 Mar, 2022
  • Estimated reading time: 4 Minutes
How to extract the content of a tar.gz file in Ubuntu
16 Nov, 2021
  • Estimated reading time: 1 Minute
How to install Anaconda in Ubuntu 20.04
6 Nov, 2021
  • Estimated reading time: 3 Minutes
How to install Elasticsearch 7 in Ubuntu 20.04
29 Apr, 2021
  • Estimated reading time: 5 Minutes
Our Sponsors

Our blog is proudly supported by industry-leading sponsors.