Skip to content

Instantly share code, notes, and snippets.

@EngKhaledB
Last active October 9, 2018 13:04
Show Gist options
  • Save EngKhaledB/d477876227dc23324e19992b07261c4f to your computer and use it in GitHub Desktop.
Save EngKhaledB/d477876227dc23324e19992b07261c4f to your computer and use it in GitHub Desktop.
Fix of the errors: E: Could not get lock /var/lib/dpkg/lock , E: Unable to lock the administration directory.

The Error Message

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

The Fix

Check if there is processes uses apt?

ps -A | grep apt

Suppose that this is the result?

1314 pts/1     00:00:00 apt
1315 pts/1     00:00:00 apt

We need to kill the running processes.

sudo kill -SIGKILL 1314
sudo kill -SIGKILL 1315

Delete the lock Files

sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

Update apt-get

sudo apt-get update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment