本文共 842 字,大约阅读时间需要 2 分钟。
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?
根据提示,初步可以猜测存在某个进程占用了这个资源。找出并杀掉所有 apt-get 或者 apt 进程
ps aus | grep apt
如果方案一不奏效,那就试试方案二。
我们都知道,操作系统中一个进程为了避免在运行中,由于其所需的文件被其他需要该文件的进程打断,通常会将该文件进行锁定,阻止系统其他进程对这些文件或者数据的访问。
运行 apt-get 或者 apt 命令的时候,锁定文件将会创建于 /var/lib/apt/lists/、/var/lib/dpkg/、/var/cache/apt/archives/ 中。当apt-get或者apt进程由于某个原因被杀掉了,没有主动删除该锁定文件,就会出现这个问题,所以需要我们手动来删除这些锁定文件。
sudo rm /var/lib/dpkg/locksudo rm /var/lib/apt/lists/locksudo rm /var/cache/apt/archives/locksudo dpkg --configure -a #重新配置软件包sudo apt update #更新软件列表
对于桌面版的ubuntu,可以试试如下的命令,取消后台更新服务:
systemctl stop apt-daily.timersystemctl stop apt-daily.service
不行再杀apt进程:)
转载地址:http://bgiqi.baihongyu.com/