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正在运行…
解决方式 : 如下
- 找到含有APT的进程
ps -A | grep apt
- 干掉它们,干掉之后再执行ps -A | grep apt 直到杀光
sudo kill -9 1213 1258 2795
- 杀光之后,删除锁定文件
- 锁定的文件会组织Linux 系统中的某些文件或者数据的访问;
- 一旦运行了apt-get或者apt命令,锁定文件将会创建于
- /var/lib/apt/lists/
- /var/lib/dpkg/
- /var/cache/apt/archives/
- 文件夹内有个lock
- 删除这三个文件的lock
- sudo rm /var/lib/apt/lists/lock
- …
- 强制重置配置软件包
sudo dpkg --configure -a
- 更新软件源头
sudo apt update
OVER
History
41 sudo apt install vim
42 ps -A | grep apt
43 sudo kill -9 1213
44 sudo kill -9 1258 2795
45 ps -A | grep apt
46 sudo kill -9 15174
47 sudo kill -9 15179
48 ps -A | grep apt
49 sudo rm /var/lib/dpkg/lock
50 sudo dpkg --configure -a
51 sudo rm /var/lib/apt/lists/lock
52 sudo rm /var/cache/apt/archives/lock
53 sudo apt update
54 sudo apt install vim