How to Fix Could not get lock /var/lib/dpkg/lock’ Error in Ubuntu OS

Аватар автора
CentOS Mystic
How to Fix Could not get lock /var/lib/dpkg/lock’ Error in Ubuntu OS Recently I was trying to install an application using the apt command on Ubuntu when I encountered the following error: 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? In fact, there is a similar error you may see: E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/ 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? Both of these errors are very similar to another common Ubuntu error Unable to lock directory /var/cache/apt/archives/ and the interesting thing is that the fixes for all these errors are similar as well. You can also use Linux command line to find and kill the running process. To do that use the command below: ps aux | grep -i apt You can use this process id to kill it: sudo kill -9 process id Another easier way would be to use killall command. This will kill all the instances of a running program. sudo killall apt apt-get You can now safely remove the lock files using the commands below: sudo rm /var/lib/apt/lists/lock sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock

0/0


0/0

0/0

0/0