发布于 2018-12-05 20:59:11
如果Apt数据(包和元数据)恰好在系统停止运行(关闭)时运行,则会损坏apt数据。无人值守-更新-关闭脚本暂时抑制关闭信号,直到apt完成。
脚本无法防止因突然停电或按住电源按钮而导致的损坏,而apt恰好正在运行。另一个原因是要避免这种情况,并保持定期备份。
脚本使用Python,包括开发人员的注释。随便读一读,自己看看。
发布于 2018-12-07 19:27:54
我最近也遇到了同样的问题,同时检查无人值守-在我的图像烘焙过程中在后台运行的升级。基本上,我会等待apt锁被释放,然后继续我的更新。
我以前做过这个:
while pgrep unattended; do sleep 10; done;
在执行我的任何脚本之前,它们会在一些奇怪的时间间隔内随机失败,没有人参与--升级正在运行,而我试图使用dpkg锁错误执行apt安装/升级/更新。
因此,我要求正确的方式检查无人值守的升级工作在后台和TJ-从IRC给我一个非常优雅的解决方案!在引导脚本繁忙时禁用u服务。如:
systemctl mask unattended-upgrades.service
systemctl stop unattended-upgrades.service
然后在你烤完你的蛋糕后重新启用:
systemctl unmask unattended-upgrades.service
systemctl start unattended-upgrades.service
此外,您还可以运行这个程序,以确保您不会过早地启动流程:
while systemctl is-active --quiet unattended-upgrades.service; do sleep 1; done
也许不是你要找的东西,但这对我非常有帮助。这可能与:https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1803137有关
https://askubuntu.com/questions/1098757
复制相似问题