在Ubuntu中遇到Unable to lock the administration directory (/var/lib/dpkg/),is another process using it? 问题解决办法

使用sudo apt-get update时报如下错误,查了下,有可能是apt-get或者一些前台GUI在执行期间停止了apt-get,导致apt锁死的状态。如下是查找的问题以及解决方法的截图。


在Ubuntu中遇到Unable to lock the administration directory (/var/lib/dpkg/),is another process using it? 问题解决办法_第1张图片
出现问题的图片

在Ubuntu中遇到Unable to lock the administration directory (/var/lib/dpkg/),is another process using it? 问题解决办法_第2张图片
image.png

image.png
--- 总结 ---
上述问题说明:

有可能是前端GUI在执行期间使用了apt-get,但是又直接关闭了终端,导致apt-get进程没有结束,锁进程。

出现问题翻译成中文如下:

:“E: 无法获得锁 /var/lib/dpkg/lock – open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?”
解决方法:

  1. 终端输入 ps -aux,列出进程。找到含有 apt-get的进程,直接 sudo kill PID。解决。
  2. 强制解锁命令
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

你可能感兴趣的:(在Ubuntu中遇到Unable to lock the administration directory (/var/lib/dpkg/),is another process using it? 问题解决办法)