ci: fix QEMU binfmt registration for arm64 cross-build #18

Merged
nrupard merged 1 commit from feat/m1-image-distribution into main 2026-05-15 16:53:18 +02:00
Owner

The previous binfmt registration installed handlers for linux/amd64,linux/arm64. Listing the native arch alongside the foreign one tripped Forgejo's runner into binding the wrong QEMU emulator under /proc/sys/fs/binfmt_misc/qemu-aarch64, so when buildx ran the arm64 stage it tried to execute the arm64 /bin/sh through an amd64 emulator and bailed out with .buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture.

Replaces the explicit platform list with the canonical --install all invocation (the same one docker/setup-qemu-action@v3 uses internally), preceded by --uninstall 'qemu-*' to flush any stale registrations from earlier jobs on the same runner, and followed by a no-arg tonistiigi/binfmt run that prints the resulting handler table for diagnostics.

Also adds docker buildx rm multiarch || true before the create step so a previous run's broken builder container doesn't get reused and shadow the freshly-registered handlers.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

The previous binfmt registration installed handlers for `linux/amd64,linux/arm64`. Listing the native arch alongside the foreign one tripped Forgejo's runner into binding the wrong QEMU emulator under `/proc/sys/fs/binfmt_misc/qemu-aarch64`, so when buildx ran the arm64 stage it tried to execute the arm64 `/bin/sh` through an amd64 emulator and bailed out with `.buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture`. Replaces the explicit platform list with the canonical `--install all` invocation (the same one docker/setup-qemu-action@v3 uses internally), preceded by `--uninstall 'qemu-*'` to flush any stale registrations from earlier jobs on the same runner, and followed by a no-arg `tonistiigi/binfmt` run that prints the resulting handler table for diagnostics. Also adds `docker buildx rm multiarch || true` before the create step so a previous run's broken builder container doesn't get reused and shadow the freshly-registered handlers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ci: fix QEMU binfmt registration for arm64 cross-build
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
fa7ab7da3e
The previous binfmt registration installed handlers for `linux/amd64,linux/arm64`. Listing the native arch alongside the foreign one tripped Forgejo's runner into binding the wrong QEMU emulator under `/proc/sys/fs/binfmt_misc/qemu-aarch64`, so when buildx ran the arm64 stage it tried to execute the arm64 `/bin/sh` through an amd64 emulator and bailed out with `.buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture`.

Replaces the explicit platform list with the canonical `--install all` invocation (the same one docker/setup-qemu-action@v3 uses internally), preceded by `--uninstall 'qemu-*'` to flush any stale registrations from earlier jobs on the same runner, and followed by a no-arg `tonistiigi/binfmt` run that prints the resulting handler table for diagnostics.

Also adds `docker buildx rm multiarch || true` before the create step so a previous run's broken builder container doesn't get reused and shadow the freshly-registered handlers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nrupard deleted branch feat/m1-image-distribution 2026-05-15 16:53:19 +02:00
nrupard referenced this pull request from a commit 2026-05-15 16:56:14 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!18
No description provided.