Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

问题描述

今天打开电脑,通常都是首先更新下系统。

sudo apt-get update

访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。没有问题,之后准备更新软件,

sudo apt-get upgrade

这时候有可能会提示,也有可能在update的时候就提示

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?

解决方法

  1. 刚启动电脑的时候,系统可能在默认更新,可以稍等下;
  2. 如果一段时间过后还是不可以,确认下自己是否已经在执行apt命令。如果有,则可以关闭或者等待执行完毕;
  3. 确定自己没有在执行的apt命令,执行ps -aux | grep 'apt-get'命令,查看是否有后台执行的apt命令;
  4. 如果有,则sudo kill -9 <process-id>
  5. 执行apt命令,如果还是不行的话可以尝试sudo rm /var/lib/apt/lists/lock,也许还需要执行
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

参考文献

  1. https://askubuntu.com/questions/452638/how-can-i-solve-unable-to-lock-the-administration-directory-var-lib-dpkg
  2. https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process

相关文章

ubuntu退出redis的示例:指定配置文件方式启动源码redis:roo...
ubuntu中mysql改密码忘了的解决方法:1.在终端中切换到root权...
ubuntu安装mysql失败的解决方法原因:可能是原有的MySQL还有...
使用centos和ubuntu建站的区别有以下几点1.CentOS是Linux发行...
ubuntu图形界面和字符界面切换的方法:可以通过快捷键CTRL+A...
ubuntu中重启mysql失败的解决方法1.首先,在ubuntu命令行中,...