无人值守升级不会升级其他存储库

无人值守升级不会升级其他存储库

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

> 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";
> 
>

和这里:

>  cat /etc/apt/apt.conf.d/20auto-upgrades
> APT::Periodic::Update-Package-Lists "1";
> APT::Periodic::Unattended-Upgrade "1";

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

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

这些包来自附加存储库:

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

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

提前致谢。

答案1

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

//    "${distro_id}:${distro_codename}-updates";
Origin  = ${distro_id}
Section = ${distro_codename}-updates

因此我们需要:

  1. 找到 Origin 字段,
  2. 找到 Section 字段,然后
  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

第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

步骤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

步骤4:找到 Section 字段。

返回步骤 1 中的 URL。Section 只是 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

步骤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";

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

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

相关内容