Repository navigation
fix: detect cross-arch build by comparing target platform to host - #242
Merged
Merged
Conversation
…t hardcoding arm64 use_qemu_static (mkimage) and the equivalent QEMU-install/setup checks in `test` and .github/actions/build/action.yml only ever triggered QEMU when building arm64 on a non-arm64 host. Building amd64 on an arm64 host (e.g. the manual-push workaround run from an Apple Silicon machine) silently skipped `debootstrap --arch amd64` and produced a native arm64 rootfs mislabeled and pushed as amd64, causing "exec format error" on real amd64 hosts (#240, #241). Comparing the requested platform against `dpkg --print-architecture` makes the check symmetric for either cross-build direction. ai-assisted=no
dgomezleon
approved these changes
Sep 3, 2026
This was referenced Sep 3, 2026
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.
Summary
use_qemu_staticinmkimage, and the equivalent QEMU-install/setup checks intestand.github/actions/build/action.yml, only ever enabled cross-arch handling for the amd64-host → arm64-target direction (hardcodedPLATFORM == "arm64").debootstrap --arch amd64and produced a native arm64 rootfs that got tagged/pushed asamd64, causingexec format erroron real amd64 hosts.latest,latest-amd64,bullseye-amd64,bookworm-amd64andtrixie-amd64have already been rebuilt from an arm64 host with this fix and re-pushed to Docker Hub, verified to contain genuine amd64 binaries.Fix
Compare the requested
$PLATFORMagainstdpkg --print-architecture(the actual host arch) instead of hardcodingarm64, so the check is symmetric regardless of which direction the cross-build goes.