これは、なにをしたくて書いたもの?
Ubuntu Linux 22.04 LTSにしてから、パッケージを更新しようとした時に
$ sudo apt upgrade
以下のようにパッケージの更新が保留されることが増えました。
以下のパッケージは保留されます: update-notifier update-notifier-common
これ自体は、個別にapt install
すれば解消できるのですが…。
Ubuntu Linuxでapt upgradeで保留されたパッケージがあった場合に、アップデートするには? - CLOVER🍀
どうも頻度が多すぎる気がします。
少し調べてみることにしました。
Phased Updates
調べてみると、Phased Updatesというものが関係しているようです。
Phased Updates自体は前からあったようですが、
Ubuntu 16.04 その69 - 段階的にパッケージのアップデートを提供するフェーズドアップデート - kledgeb
aptが対応したのは、Ubuntu Linux 21.04からみたいですね。
Ubuntu 21.04 その10 - APTがフェーズドアップデートに対応・apt/apt-getでもフェーズドアップデートが有効に - kledgeb
Phased updates in APT in 21.04 - Foundations - Ubuntu Community Hub
Phased Updatesというのは、リグレッション対策のためにアップデートの内容を一部のユーザーに提供して、問題がなければ徐々に
対象とするユーザーを増やしていくもののようです。
パーセンテージは最初は10%に設定されていて、そこからリグレッションの確認が6時間ごとに行われ、問題がない場合は10%ずつ
対象とするユーザーを増やしていくようです。最終的には54時間後または2日後に完全に提供されるとか。
The Phased-Update-Percentage is initially set to 10%, and a job is run (every 6 hours) that checks for regressions and if none are found the phased update percentage will be incremented by 10%. So an update will become fully phased after 54 hours or about 2 days.
つまり、放っておいてもそのうち適用されるということですね。
とにかく適用する
一時的に保留しないようにするには、-o
オプションでAPT::Get::Always-Include-Phased-Updates
をtrue
に指定します。
$ sudo apt -o APT::Get::Always-Include-Phased-Updates=true upgrade
ずっと適用するには、/etc/apt/apt.conf.d
配下にオプションを記述するとよいでしょう。
/etc/apt/apt.conf.d/99phased-update
APT::Get::Always-Include-Phased-Updates "true";
確認。
$ apt-config dump | grep -i phased APT::Get::Always-Include-Phased-Updates "true";
この説明は、apt_preferences
に書かれています。
Ubuntu Manpage: apt_preferences - Preference control file for APT
APT::Get::Always-Include-Phased-Updates
をtrue
にすると、Phased Updatesを考慮しなくなります(パッケージの更新がすぐに
インストールされます)。
set APT::Get::Never-Include-Phased-Updates or APT::Get::Always-Include-Phased-Updates to true such that APT will never/always consider phased updates.
APT::Get::Never-Include-Phased-Updates
をtrue
にすると、Phased Updatesによる段階的導入が済んだ後に更新されたパッケージが
インストールされることになります。
Phased updates in APT in 21.04 - Foundations - Ubuntu Community Hub
また、Phased Updatesの仕組みには乗るものの、マシン間で更新タイミングを合わせたい場合はAPT::Machine-ID
に同じUUIDを設定すれば
よいみたいです。
In case you have multiple systems that you want to receive the same set of updates, you can set APT::Machine-ID to a UUID such that they all phase the same
Ubuntu Manpage: apt_preferences - Preference control file for APT
この値をシードのひとつとして、Phased Updatesによる更新タイミングを算出するようなので。