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:
- '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 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 !