无人值守升级不会升级额外的存储库

tom*_*tom 4 package-management unattended-upgrades

无人值守升级不会升级额外的存储库。对于其他软件包,升级确实有效。这是我所做的设置:

> cat  /etc/apt/apt.conf.d/50unattended-upgrades // Automatically
> upgrade packages from these (origin:archive) pairs // // Note that in
> Ubuntu security updates may pull in new dependencies // from
> non-security sources (e.g. chromium). By allowing the release //
> pocket these get automatically pulled in.
> Unattended-Upgrade::Allowed-Origins {
>         "${distro_id}:${distro_codename}";
>         "${distro_id}:${distro_codename}-security";
>         // Extended Security Maintenance; doesn't necessarily exist for
>         // every release and this system may not have it installed, but if
>         // available, the policy for updates is such that unattended-upgrades
>         // should also install from here by default.
>         "${distro_id}ESMApps:${distro_codename}-apps-security";
>         "${distro_id}ESM:${distro_codename}-infra-security";
>         "${distro_id}:${distro_codename}-updates";
> 
>
Run Code Online (Sandbox Code Playgroud)

和这里:

>  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)

但一段时间后,有些软件包还没有更新(也有没有保留):

> apt list --upgradable Listing... Done icinga2-bin/icinga-focal
> 2.12.1-1.focal amd64 [upgradable from: 2.12.0-1.focal] icinga2-common/icinga-focal 2.12.1-1.focal all [upgradable from:
> 2.12.0-1.focal] icinga2-doc/icinga-focal 2.12.1-1.focal all [upgradable from: 2.12.0-1.focal] icinga2/icinga-focal 2.12.1-1.focal
> amd64 [upgradable from: 2.12.0-1.focal]
Run Code Online (Sandbox Code Playgroud)

这些包来自附加存储库:

> /etc/apt/sources.list.d# ll total 12 drwxr-xr-x 2 root root 4096 Sep
> 14 08:27 ./ drwxr-xr-x 7 root root 4096 Sep 14 08:27 ../
> -rw-r--r-- 1 root root   57 Sep 14 08:27 icinga-main-focal.list
Run Code Online (Sandbox Code Playgroud)

请让我知道无人值守升级将如何完全发挥作用。

提前致谢。

use*_*733 13

无人值守升级使用以下格式:"Origin:Section";这是一个示例。

//    "${distro_id}:${distro_codename}-updates";
Origin  = ${distro_id}
Section = ${distro_codename}-updates
Run Code Online (Sandbox Code Playgroud)

所以我们需要:

  1. 找到原点字段,
  2. 找到“部分”字段,然后
  3. 以正确的格式包装它们。

第 1 步:找到您要添加的源的 URL。它位于您的 apt 源中。它在你的文件中/etc/apt/sources.list.d/icinga-main-focal.listURL 看起来像这样......

deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
  ...or...
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
  ...or...
deb https://downloads.plex.tv/repo/deb/ public main
Run Code Online (Sandbox Code Playgroud)

步骤2:在您的系统中找到该URL对应的Release文件。

http://security.ubuntu.com/ubuntu focal-security
  ...becomes...
/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_focal-security_InRelease


http://dl.google.com/linux/chrome/deb/ stable
  ...becomes...
/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_InRelease


https://downloads.plex.tv/repo/deb/ public
  ...becomes...
/var/lib/apt/lists/downloads.plex.tv_repo_deb_dists_public_Release
Run Code Online (Sandbox Code Playgroud)

步骤 3:使用 grep 查找“Origin”字段。

$ grep Origin /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_focal-security_InRelease
Origin: Ubuntu

$ grep Origin /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_InRelease
Origin: Google LLC

$ grep Origin /var/lib/apt/lists/downloads.plex.tv_repo_deb_dists_public_Release
Origin: Artifactory
Run Code Online (Sandbox Code Playgroud)

第 4 步:找到“部分”字段。

返回到步骤 1 中的 URL。部分只是 URL 后面的第一个单词。

http://security.ubuntu.com/ubuntu focal-security
  ...becomes...
Section: focal-security


http://dl.google.com/linux/chrome/deb/ stable
  ...becomes...
Section: stable


https://downloads.plex.tv/repo/deb/ public
  ...becomes...
Section: public
Run Code Online (Sandbox Code Playgroud)

第5步:将它们放在一起,并正确格式化。回想一下,格式是:"Origin:Section";。引号和尾随分号是重要的格式元素。

http://security.ubuntu.com/ubuntu focal-security
Origin: Ubuntu
Section: focal-security
Formatted line for Unattended Upgrades: "Ubuntu:focal-security";

http://dl.google.com/linux/chrome/deb/ stable
Origin: Google LLC
Section: stable
Formatted line for Unattended Upgrades: "Google LLC:stable";

https://downloads.plex.tv/repo/deb/ public
Origin: Artifactory
Section: Public
Formatted line for Unattended Upgrades: "Artifactory:public";
Run Code Online (Sandbox Code Playgroud)

第 6 步:将该行添加到 的正确部分/etc/apt/apt.conf.d/50unattended-upgrades

测试它:运行sudo unattended-upgrade,然后检查日志文件var/log/unattended-upgrades/unattended-upgrades.log以确保它运行时没有错误并且您的源已正确包含。

  • 非常感谢您详细且有用的回答。现在可以了:) (3认同)