fix(image): install lsb-release so cloud-init writes real apt suites - #56
Merged
Conversation
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
enabled auto-merge
July 31, 2026 05:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Deployed instances end up with
Suites: UNAVAILABLE UNAVAILABLE-updates UNAVAILABLE-backportsin/etc/apt/sources.list.d/ubuntu.sources, soaptcannot fetch anything.The image's own sources file is correct at build time. cloud-init overwrites it on first boot, and
cc_apt_configure.pygets the codename fromutil.lsb_release(), which shells out to thelsb_releasebinary rather than reading/etc/os-release. OnProcessExecutionErrorthat helper returnsUNAVAILABLEfor every field, and the value is templated straight into the suites. Thelsb-releasepackage 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_releaseis 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-releasefor the same reason.The structure test executes
lsb_release -csinside the image and compares it againstVERSION_CODENAMEfrom os-release, so a silent regression to the fallback string fails the build rather than shipping.Already-running instances need repairing by hand — replacing
UNAVAILABLEwith the running codename in that file is sufficient.