Waiting for cache lock
找出哪个进程锁定了文件
sudo lsof /var/lib/dpkg/lock or sudo lsof /var/lib/apt/lists/lock or sudo lsof /var/lib/dpkg/lock-frontend
实例:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME xxxxxx 5383 root 7aC REG 6,3 0 210001 /var/lib/dpkg/lock-frontend
上面PID:5383就是进程代号。
终止进程
sudo kill -9 5383
删除/删除锁定文件
sudo rm /var/lib/dpkg/lock or sudo rm /var/lib/apt/lists/lock or sudo rm /var/lib/dpkg/lock-frontend //Run this in your case
从缓存文件夹中删除锁定
sudo rm /var/cache/apt/archives/lock
检查并更正被中断的dpkg进程(如果有的话)(因此,我们最终不会遇到损坏的软件包)
sudo dpkg --configure -a