Ubuntu 16.04 上的文件锁定错误
错误如下:
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
也可能是这样:
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?
解决方法
1.找出并杀掉所有的 apt-get 或 apt 进程
$ ps -A | grep apt
$ sudo kill -9 processnumber
* 2.删除锁定的文件 *
$ sudo rm /var/lib/dpkg/lock
也可以删除 /var/lib/apt/lists/ 以及缓存文件夹下的锁定文件
$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
强制重新配置软件包
$ sudo dpkg --configure -a
更新你的软件包源列表
$ sudo apt update
或者
$ sudo apt-get update