无人值守升级忽略了一些包

Mar*_*lka 8 upgrade apt unattended-upgrades

我设置了无人值守升级,但有些软件包没有自动更新。

root@survey:/home/martin# apt update

root@survey:/home/martin# unattended-upgrade -v --dry-run
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=xenial, o=Ubuntu,a=xenial-updates, o=Ubuntu,a=xenial-security, o=UbuntuESM,a=xenial
No packages found that can be upgraded unattended and no pending auto-removals

root@survey:/home/martin# /usr/lib/update-notifier/apt-check -p
python-rfc3339
python-zope.hookable
python-configargparse
python-zope.component
Run Code Online (Sandbox Code Playgroud)

origins 中的配置/etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}";
        "${distro_id}:${distro_codename}-updates";
        "${distro_id}:${distro_codename}-security";
        "${distro_id}ESM:${distro_codename}";
};
Run Code Online (Sandbox Code Playgroud)

据我所知,待处理的软件包来自官方的 ubuntu 存储库(Launchpad 链接),所以我看不出为什么unattended-upgrade.

命令的输出确实说

没有发现可以无人值守升级的软件包,没有挂起的自动删除。

是否存在这样的情况,该工具获取了一个包,来自允许的来源,但由于某种原因不允许无人值守升级?哪些进一步的措施能做些什么来找出为什么一些包没有资格?

ear*_*Lon 5

我相信您错过了20auto-upgrades,应该首先正确实施它,看看是否可以解决您的问题,然后再继续。您可以看到这是自动升级文档中的重要步骤。

$ cat /etc/apt/apt.conf.d/20auto-upgrades 
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
Run Code Online (Sandbox Code Playgroud)

如果您有该文件但它仍然无法正常工作,您可以尝试找出是什么原因导致软件包无法正常运行。我更喜欢Origins-PatternAllowed-Origins这与文档不同,但对我来说效果很好:

$ vim /etc/apt/apt.conf.d/50unattended-upgrades
# You need to customize configuration
Run Code Online (Sandbox Code Playgroud)

以下是关键“模式”组件的示例50unattended-upgrades

Unattended-Upgrade::Origins-Pattern {
        // Codename based matching:
        // This will follow the migration of a release through different
        // archives (e.g. from testing to stable and later oldstable).

        // Archive or Suite based matching:
        // Note that this will silently match a different release after
        // migration to the specified archive (e.g. testing becomes the
        // new stable).
//      "o=Ubuntu,a=stable";
//      "o=Ubuntu,a=stable-updates";
//      "o=Ubuntu,a=proposed-updates";
        "origin=Ubuntu,codename=${distro_codename}";
};
Run Code Online (Sandbox Code Playgroud)

这是一个不基于存储库进行限制的示例:

Unattended-Upgrade::Origins-Pattern {
        // Codename based matching:
        // This will follow the migration of a release through different
        // archives (e.g. from testing to stable and later oldstable).

        // Archive or Suite based matching:
        // Note that this will silently match a different release after
        // migration to the specified archive (e.g. testing becomes the
        // new stable).
//      "o=Ubuntu,a=stable";
//      "o=Ubuntu,a=stable-updates";
//      "o=Ubuntu,a=proposed-updates";
        "origin=Ubuntu,codename=${distro_codename}";
};
Run Code Online (Sandbox Code Playgroud)

您只会想要其中一个Origin-Patterns 或两个 Allowed-Origins,而不是两者都想要。这在 Debian 的无人值守升级文档中更加清晰和记录。

尝试仅启用此功能,这只是安全更新。测试它是否有效,并逐一添加其他模式,直到添加每个模式并验证每个更新不会破坏您的试运行测试。

如果您有混合系统,我还建议指定 Ubuntu 并为 Debian 系统编写完全不同的配置文件。


确保您没有持有任何可能阻止更新的软件包:

Unattended-Upgrade::Origins-Pattern {
      "o=*";
}
Run Code Online (Sandbox Code Playgroud)

确保您可以正常安装更新,或者apt配置为正确确定每个版本类型的优先级:

$ sudo apt-mark showhold
Run Code Online (Sandbox Code Playgroud)

某些更新需要重新启动计算机,您必须决定是手动执行此操作,还是允许apt在更新需要时在给定时间重新启动计算机。