unattended-upgrades template uses a pre-focal ESM origin, so ESM updates never install automatically
Summary
roles/common/templates/50unattended-upgrades.j2 allows the ESM origin as:
"${distro_id}ESM:${distro_codename}";That form matches no repository on focal or later, so an algo server attached to
Ubuntu Pro installs no ESM updates automatically, despite
unattended-upgrades being enabled and ESM being active. The template overwrites
Ubuntu's own /etc/apt/apt.conf.d/50unattended-upgrades, which has the correct
entries, so algo makes a working default worse.
Evidence
On a 20.04 algo server attached to Ubuntu Pro, the ESM repositories publish as:
$ apt-cache policy | grep -oE "o=UbuntuESM[A-Za-z]*,a=[a-z-]+" | sort -u
o=UbuntuESM,a=focal-infra-security
o=UbuntuESM,a=focal-infra-updates
o=UbuntuESMApps,a=focal-apps-security
o=UbuntuESMApps,a=focal-apps-updatesAnd unattended-upgrades resolves algo's template to:
$ sudo unattended-upgrade --dry-run --debug 2>&1 | grep -i "allowed origins"
Allowed origins are: o=Ubuntu,a=focal-security, o=UbuntuESM,a=focal, ...o=UbuntuESM,a=focal is not among the four published suites. The entry is inert.
Ubuntu's shipped default, for comparison:
"${distro_id}ESMApps:${distro_codename}-apps-security";
"${distro_id}ESM:${distro_codename}-infra-security";Impact
Limited but sharp. It does nothing on a release inside standard support, because
ESM is not attached. It matters precisely when a deployed server outlives its
release's support window — at which point ESM is the only source of security
updates, unattended-upgrades looks healthy, and nothing installs.
Two long-running 20.04 algo servers of mine had accumulated 159 pending ESM
packages each, including 104 kernel revisions, while reporting
unattended-upgrades: enabled. Before attaching Pro, apt list --upgradable
returned 1 — an EOL archive with nothing left to offer reads as a current system.
Suggested fix
Replace the single ESM line with the two security pairs:
- "${distro_id}ESM:${distro_codename}";
+ "${distro_id}ESMApps:${distro_codename}-apps-security";
+ "${distro_id}ESM:${distro_codename}-infra-security";The -infra-updates and -apps-updates pockets should stay out, matching
Ubuntu's default.
Worth considering separately: algo overwrites this file wholesale to change
Automatic-Reboot and Automatic-Reboot-Time. A drop-in at
/etc/apt/apt.conf.d/52-algo-unattended-upgrades setting only the options algo
cares about would inherit Ubuntu's origin list and avoid this class of drift
entirely.
Verified on Ubuntu 20.04.6 (Azure), algo at 20e22a8.
Source: trailofbits/algo