发新话题
打印

Linux apt安装停滞的解决办法

Linux apt安装停滞的解决办法

如果之前有一个apt或apt-get进程正在运行,之后的apt将无法运行,并提示
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (unattended-upgrade)

但此错误信息批处理里可能看不到。

此时需要终止该进程,才能运行下一个apt程序
kill -9 43843

预警检查:
apt-get check >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
    echo "you may have broken packages. Aborting..."
fi


fuser /var/lib/dpkg/lock
fuser /var/lib/dpkg/lock-frontend

disable unattended-upgrade
https://gist.github.com/plembo/428068f16e6f15c93959ff5448a50e0b
# cat /etc/apt/apt.conf.d/20auto-upgrades
APTeriodic::Update-Package-Lists "0";
APTeriodic::Unattended-Upgrade "0";

TOP

发新话题