无人值守升级失败

无人值守升级失败

我在 apt-get Upgrade 上不断收到此错误:

Installing unattended-upgrades (0.93.1+nmu1) ...
Failed to start unattended-upgrades.service: Unit unattended-upgrades.service failed to load: Invalid argument. See system logs and 'systemctl status unattended-upgrades.service' for details.
invoke-rc.d: initscript unattended-upgrades, action "start" failed.
● unattended-upgrades.service - Unattended Upgrades Shutdown
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
     Docs: man:unattended-upgrade(8)

jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:29:32 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:32:41 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
jun 06 18:33:24 PRODUCTION systemd[1]: unattended-upgrades.service lacks ExecStart setting. Refusing.
dpkg: erro ao processar o pacote unattended-upgrades (--configure):
 subprocesso script post-installation returned exit status code 6
Errors were found while processing:
 unattended-upgrades
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不关心无人值守升级,它可以被删除。我尝试了 apt-get remove 但没有运气:

Removing unattended-upgrades (0.93.1+nmu1) ...
Failed to stop unattended-upgrades.service: Unit unattended-upgrades.service not loaded.
invoke-rc.d: initscript unattended-upgrades, action "stop" failed.
dpkg: error processing package unattended-upgrades (--remove):
 subprocess script pre-removal returned exit status error 5
Errors were found while processing:
 unattended-upgrades
E: Sub-process /usr/bin/dpkg returned an error code (1)

这些消息已被翻译,因为其中一些消息不是英文的。

我已经配置了 debian jessie 和 sid 存储库。

名称-a: Linux PRODUCTION 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

猫 /etc/debian_version: 9.0

我只是希望那个讨厌的错误消失,我不在乎如何。通过删除软件包或解决问题,但我似乎无法删除它,由于缺乏知识,我也无法修复它:)

有什么提示吗?

答案1

systemctl mask unattended-upgrades

解释:

管理员可以将同名文件放入 .systemd 单元中,从而覆盖 systemd 单元/etc/systemd/system

此机制还可用于“屏蔽”服务,使其不被套接字激活、手动启动或任何其他方法激活。如果存在到 的符号链接,则不会创建具有相同名称的文件,/dev/null而是会有效地忽略该单元。

所以你可以 ab(use) systemctl mask,将单元的内容替换为空。

为避免将来可能出现混淆,请在取出包装后检查是否取下面罩。 systemctl unmask unattended-upgrades

答案2

我也遇到了这个问题,看来是systemd太旧,不支持省略配置unattended-upgrades.service的文件ExecStart。确保该systemd软件包也已升级(版本 232 对我有用)。

如果问题仍然存在(就像对我一样),那么systemd在升级过程中可能不会重新启动(我认为它应该自动发生,但我认为它不适合我)。要解决这个问题,请运行:

sudo systemctl daemon-reexec

这将重新启动systemd,运行应该可以很好地支持新服务文件的较新版本。

答案3

使用最新的 systemd 和无人值守升级包的 Debian 9 也存在同样的问题。所以我编辑了这个文件:

/lib/systemd/system/unattended-upgrades.service

并添加这一行:

ExecStart=/bin/true

就在 ExecStop 行之前,现在一切正常,但服务未被屏蔽。

相关内容