prepare-host: support Ubuntu resolute's qemu-user packaging changes#9790
Conversation
Ubuntu 26.04 (resolute) split qemu-user-static into qemu-user-binfmt
and qemu-user-binfmt-hwe, leaving qemu-user-static as a virtual
package with two providers. apt won't auto-pick a provider, so the
generated Dockerfile (and any direct ./compile.sh requirements run on
a resolute host) fails with:
E: Package 'qemu-user-static' has no installation candidate
Match the existing python2 pattern (release-conditional host deps)
and pick the concrete non-HWE package on resolute. Older releases
keep qemu-user-static.
📝 WalkthroughWalkthroughMake host QEMU package selection conditional on host_release (resolute → qemu-user-binfmt; others → qemu-user-static) and update chroot qemu deploy/undeploy to handle both primary and alternate binary names with preservation/restoration of .armbian.orig backups. ChangesQEMU host selection and chroot deployment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Not sure if this has been touched on yet, but the bins are also named differently on Resolute. No |
Ubuntu 26.04's qemu-user-binfmt drops the -static suffix on the actual
binary names: /usr/bin/qemu-aarch64 instead of /usr/bin/qemu-aarch64
-static. The chroot-deploy code in qemu-static.sh hardcoded the
historical name and would fail on resolute hosts even with the apt
package now resolved.
deploy_qemu_binary_to_chroot:
- Resolve the host source path: try /usr/bin/${QEMU_BINARY} (the
-static name) first, fall back to the bare name.
- Copy to both /usr/bin/qemu-<arch>-static and /usr/bin/qemu-<arch>
inside the chroot, so whichever path the host's binfmt
registration points at resolves at chroot time. The qemu-user
-static package on older releases registers the -static name; the
qemu-user-binfmt package on resolute registers the bare name.
undeploy_qemu_binary_from_chroot:
- Remove and restore both names symmetrically.
Reported by @pyavitz on the previous commit's PR.
|
@pyavitz good catch — pushed a follow-up commit (5518b77) that handles the binary-name change too:
PR title and body updated to reflect the broader scope. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/functions/rootfs/qemu-static.sh (1)
63-101:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
undeploycomment on line 67 says "deploy" — stale copy-paste.The inline comment at line 67 (
# Only deploy the binary if we're actually building a non-native architecture.) insideundeploy_qemu_binary_from_chrootis copied from the deploy function and says "deploy" instead of "undeploy".📝 Proposed fix
- # Only deploy the binary if we're actually building a non-native architecture. + # Only undeploy the binary if we're actually building a non-native architecture.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/functions/rootfs/qemu-static.sh` around lines 63 - 101, Update the stale comment inside the function undeploy_qemu_binary_from_chroot: replace the copied "deploy" wording in the comment that starts with "# Only deploy the binary if we're actually building a non-native architecture." so it accurately reflects undeploy semantics (e.g., "Only undeploy the binary if we're actually building a non-native architecture." or similar). Edit the comment near the dpkg-architecture check in undeploy_qemu_binary_from_chroot to correct the wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@lib/functions/rootfs/qemu-static.sh`:
- Around line 63-101: Update the stale comment inside the function
undeploy_qemu_binary_from_chroot: replace the copied "deploy" wording in the
comment that starts with "# Only deploy the binary if we're actually building a
non-native architecture." so it accurately reflects undeploy semantics (e.g.,
"Only undeploy the binary if we're actually building a non-native architecture."
or similar). Edit the comment near the dpkg-architecture check in
undeploy_qemu_binary_from_chroot to correct the wording.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5278f85f-f8dd-466a-91a4-5ee18bd8c889
📒 Files selected for processing (1)
lib/functions/rootfs/qemu-static.sh
Made arm64 image on x86 resolute host. |
|
Resolute Docker images works. |
Summary
Two changes, both required for
armbian/buildto run on Ubuntu 26.04 (resolute) hosts and for the daily framework Docker image to build there:Package name —
qemu-user-staticis virtual on resolute (split intoqemu-user-binfmt+qemu-user-binfmt-hwe). apt refuses to auto-pick a provider, soapt-get installerrors out:Match the existing python2 release-conditional pattern in
prepare-host.shand pickqemu-user-binfmton resolute. Older releases keepqemu-user-static.Binary name (raised by @pyavitz) —
qemu-user-binfmtships the binaries without the-staticsuffix:/usr/bin/qemu-aarch64instead of/usr/bin/qemu-aarch64-static. The chroot-deploy code inqemu-static.shhardcoded the historical name and would fail on resolute hosts even with the apt fix in (1).deploy_qemu_binary_to_chroot: resolve the source path by trying/usr/bin/${QEMU_BINARY}first, fall back to the bare name. Copy the binary to both names inside the chroot, so whichever path the host's binfmt registration points at resolves at chroot time. The oldqemu-user-staticpackage registered the-staticname; the newqemu-user-binfmtregisters the bare name.undeploy_qemu_binary_from_chroot: remove and restore both names symmetrically.runners.shalready had a fallback for executing host-side x86 binaries; this PR brings the chroot-side code into parity.QEMU_BINARYitself stays asqemu-<arch>-staticin the per-arch configs — the host-side resolution and the chroot-side dual-deploy mean the rest of the build framework can keep using the historical name.How to verify
Reproducer that hit (1) in CI:
armbian-ubuntu-resolute-amd64-latestfailing inapt-get install.Once this PR lands and the docker-armbian-build daily run picks it up, both
armbian-ubuntu-resolute-amd64-latestandarmbian-ubuntu-resolute-arm64-latestshould build cleanly.Test plan
./compile.sh requirementson a resolute host completes without theno installation candidateerror.BOARD=uefi-arm64) successfully copies the qemu binary into the chroot under bothqemu-aarch64andqemu-aarch64-static, and chrooted commands run.docker-armbian-build'supdate_docker.ymlproducesarmbian-ubuntu-resolute-{amd64,arm64}-latestand joins them intoarmbian-ubuntu-resolute-latest.Summary by CodeRabbit