Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ankibalyan/eeb4b56671ad34e732a8 to your computer and use it in GitHub Desktop.
Save ankibalyan/eeb4b56671ad34e732a8 to your computer and use it in GitHub Desktop.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a
/************************************************************/
OR
/************************************************************/
The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.
If you try
ps aux | grep apt
that will catch processes containing the word apt, at least. If you see an apt-get process or an aptitude process that looks stuck, you can try
kill processnumber
and if that doesn't work try
kill -9 processnumber
This should kill the process and may remove the lock. Killing an apt or aptitude process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment