我通过 ssh 进入我的 ubuntu 服务器并看到以下信息:
215 updates can be installed immediately.
38 of these updates are security updates.
To see these additional updates run: apt list --upgradable
2 updates could not be installed automatically. For more details,
see /var/log/unattended-upgrades/unattended-upgrades.log
我运行sudo unattended-upgrade
安装安全更新但出现以下错误:
Cache lock can not be acquired, exiting
有什么想法吗?我该如何解决?
答案1
这个问题有点老了,但是对于像我一样来到这里的人来说,这就是我所用的方法。
# See actual lock files:
sudo ls -l /var/lib/dpkg/lock /var/lib/apt/lists/lock /var/cache/apt/archives/lock
# Check if something is really running:
ps -ef | grep -v grep | egrep 'apt|dpkg'
# If so, wait for it (if very very long, maybe finally kill it).
# Remove lock files:
sudo rm /var/lib/dpkg/lock /var/lib/apt/lists/lock /var/cache/apt/archives/lock
# Make sure packages are all ok:
sudo dpkg --configure -a
现在您应该能够运行无人值守升级。
答案2
使用:
ps -ef | grep -v grep | egrep 'apt|dpkg'
检查该apt
命令是否正在其他窗口运行。