E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1637 (packagekitd) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to lock directory /var/lib/apt/lists/ code example

Example 1: dpkg: error: dpkg frontend lock was locked by another process with pid 4368

sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a

Example 2: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

ps aux | grep -i dpkg

// Kill processes which are running
sudo kill -9 

// Restart the accounts daemon
sudo systemctl restart accounts-daemon

Tags:

Misc Example