Skip to content

fix(image): install lsb-release so cloud-init writes real apt suites - #56

Merged
passcod merged 2 commits into
mainfrom
fix-apt-suite-unavailable
Jul 31, 2026
Merged

fix(image): install lsb-release so cloud-init writes real apt suites#56
passcod merged 2 commits into
mainfrom
fix-apt-suite-unavailable

Conversation

@passcod

@passcod passcod commented Jul 31, 2026

Copy link
Copy Markdown
Member

🤖 Deployed instances end up with Suites: UNAVAILABLE UNAVAILABLE-updates UNAVAILABLE-backports in /etc/apt/sources.list.d/ubuntu.sources, so apt cannot fetch anything.

The image's own sources file is correct at build time. cloud-init overwrites it on first boot, and cc_apt_configure.py gets the codename from util.lsb_release(), which shells out to the lsb_release binary rather than reading /etc/os-release. On ProcessExecutionError that helper returns UNAVAILABLE for every field, and the value is templated straight into the suites. The lsb-release package was never in the image's package list, so the lookup failed on every build. Confirmed by reading cloud-init's own source inside a built image and checking that /usr/bin/lsb_release is absent from the rootfs.

Installing the package restores the correct codename and keeps cloud-init's rewrite, which on EC2 points apt at the in-region mirror. Stock Ubuntu cloud images ship lsb-release for the same reason.

The structure test executes lsb_release -cs inside the image and compares it against VERSION_CODENAME from os-release, so a silent regression to the fallback string fails the build rather than shipping.

Already-running instances need repairing by hand — replacing UNAVAILABLE with the running codename in that file is sufficient.

cloud-init rewrites /etc/apt/sources.list.d/ubuntu.sources on first boot
and resolves the codename via util.lsb_release(), which executes the
lsb_release binary rather than reading /etc/os-release. That package was
never installed, so the lookup failed and cloud-init substituted its
UNAVAILABLE fallback into every Suites: line, leaving apt unable to fetch
anything on deployed instances.

Adds a spec item for the requirement, installs lsb-release, and asserts in
the structure test that lsb_release runs and agrees with os-release.

Existing instances need the suite repaired by hand; replacing UNAVAILABLE
with the running codename in that file is enough.
@passcod
passcod enabled auto-merge July 31, 2026 05:23
@passcod
passcod merged commit b0207fc into main Jul 31, 2026
38 checks passed
@passcod
passcod deleted the fix-apt-suite-unavailable branch July 31, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant