E: Unable to lock the administration directory (/var/lib/dpkg/)

When using apt-get to install or update software, the following message will sometimes appear:
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 reason is that there may be other apt-get processes active.
The solution is to find out the apt-get process and kill it!
ps -ef | grep apt
sudo kill -9 <PID>

 

 

 

It was also said to use the following command:

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

However, be careful, it is very dangerous and may cause the operating system to become unbootable . (I executed the first command before, but did not execute the second one, which caused the operating system to fail to start, and a kernel error was reported at startup)

 

 

The second time I encountered this problem, I was going to try the first method, but I accidentally restarted the system, and after restarting, the problem disappeared.

 

https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process

https://stackoverflow.com/questions/18682233/cant-remove-any-existing-lock

http://blog.163.com/cobyeah@126/blog/static/140137653201142354756503/

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326213629&siteId=291194637