如何禁用/跳过 22.04 上的分阶段更新?

Hol*_*ock 11 updates package-management 22.04

有谁知道是否有办法禁用或跳过 Ubuntu 22.04 上的分阶段更新,以便软件包安装候选者立即更新到软件包的最新版本?

我已尝试在此处禁用的建议 - https://discourse.ubuntu.com/t/phased-updates-in-apt-in-21-04/20345

但是,当我使用命令 apt-cache policy 检查时,所需软件包的候选版本始终保留为旧版本。

use*_*733 16

分阶段更新是为您的系统提供一层保护。禁用这一层保护的人员应该具备解决问题​​和提交错误的技能、经验和意愿。您自愿成为一名测试员。

只有知道自己在做什么的人才应该这样做。

如果您确实想绕过分阶段,请在命令中插入正确的 apt 选项:

apt -o APT::Get::Always-Include-Phased-Updates=true upgrade
Run Code Online (Sandbox Code Playgroud)

或者

apt -o APT::Get::Always-Include-Phased-Updates=true install <package_name>
Run Code Online (Sandbox Code Playgroud)
  • 在使用此选项之前,明智的做法是运行apt-cache policy <packagename>以验证您所讨论的软件包是否确实处于分阶段状态。这并不是解决所有与 apt 相关的问题的神奇咒语。

但是,如果您有一整个机器实验室怎么办?而且每个阶段都在不同的时间进行,这很混乱吗?

答案不是禁用定相。相反,通过设置通用的机器 ID 字符串,让所有机器齐头并进。

下面是一个 apt 配置文件示例,用于为 apt 设置机器 ID 字符串。我们就这样称呼它吧/etc/apt/apt.conf.d/20phased-updates。无论您选择什么,这个特定于 apt 的字符串对于您想要一起分阶段的所有机器都应该是相同的。您实验室中的每台机器都会获取此文件。

// To have all your machines phase the same, set the same string in this field
// If commented out, apt will use /etc/machine-id to seed the random number generator
APT::Machine-ID "aaaabbbbccccddddeeeeffff";
Run Code Online (Sandbox Code Playgroud)

或者,如果您确实想要最新和最好的自动安装,并随后逐步一起......

// To have all your machines phase the same, set the same string in this field
// If commented out, apt will use /etc/machine-id to seed the random number generator
APT::Machine-ID "aaaabbbbccccddddeeeeffff";

// Always include phased updates
// After your initial build, you would comment this out.
// If left in place you will *always* include phased updates instead of phasing all machines together.
APT::Get::Always-Include-Phased-Updates "1"; 
Run Code Online (Sandbox Code Playgroud)

  • @karel 这不是重复的重点吗? (2认同)
  • @HollySherlock 进行了编辑,以解决如何让整个实验室的机器分阶段组合在一起并进行构建的问题。 (2认同)
  • 我觉得这使得关闭分阶段更新听起来比实际情况要危险得多,特别是考虑到在旧版本的 Ubuntu 中,它们基本上总是关闭的。 (2认同)