Documentation
¶
Overview ¶
Command qemufix repairs the GitHub Actions lanes that run a Go test binary under qemu user-mode emulation, broken fleet-wide by Ubuntu 26.04.
qemufix .github/workflows/ci.yml # rewrite in place qemufix --check .github/workflows/*.yml # report, change nothing (exit 1 if work remains)
THE DEFECT ¶
`ubuntu-latest` became Ubuntu 26.04 from 2026-10-19. There `qemu-user-static` is a VIRTUAL package and apt refuses to choose between its two providers:
E: Package 'qemu-user-static' has no installation candidate Package qemu-user-static is a virtual package provided by: qemu-user-binfmt-hwe 1:10.2.1+ds-1ubuntu4.4 qemu-user-binfmt 1:10.2.1+ds-1ubuntu3.3
The step exits 100 in about twenty seconds. 333 repositories in 258 organisations of this account carried the old line on 2026-10-25, having gone red between a green main and the next push without anything being committed.
THE TWO THINGS THAT ARE NOT THE FIX ¶
⚠ Installing a PROVIDER is not the fix. `qemu-user-binfmt` registers binfmt handlers; it does not ship the `qemu-<arch>-static` binaries these lanes invoke. A lane given only a provider takes its `command -v` branch and goes GREEN while testing nothing -- worse than red. `qemu-user` ships the dynamic `qemu-<arch>`, which is all `go test -exec` needs, so this installs `qemu-user qemu-user-binfmt` and accepts EITHER binary name.
⛔ Skipping on a missing emulator is not the fix either. Every rewrite here FAILS the lane when no emulator is found, and PRINTS which one it ran (`running ppc64le under qemu-ppc64le`). Without that line, "ran under emulation" and "skipped" are indistinguishable from a green tick -- which is how a fix for this looks like it worked while testing nothing.
WHY IT REFUSES RATHER THAN GUESSES ¶
A sweep that edits 333 files cannot be reviewed file by file, so the only safe failure is a loud one. qemufix recognises seven shapes (see Shape in patch.go) and exits non-zero NAMING THE FILE on anything else: a half-patched file, two install steps, a multi-line install it would have to replace wholesale, a `run:` that is not the step's last key, two emulated lanes of different shapes. The brief for this sweep said there were three shapes; reading the files found a fourth (`retry+case`, a third of the first batch). A tool that guessed would have silently mangled those.
⛔ Three more shapes came out of the thirty files the first version refused, and in each case the REFUSAL MESSAGE said something false about the lane:
"no `go test -exec=` step naming a qemu emulator" reads as "this lane never emulates". It is the opposite of true. Twelve go-macos repositories run a cross-built `pkg.test` under `"$QEMU"` (oneline+qemuvar) and five go-pkgx ones spell the flag with a SPACE, `-exec ${{ matrix.qemu }}` (guard+pkgxenv).
"step has no `run:` key" was true of the enclosing list item and irrelevant: the line it had read was a MATRIX DATUM, `exec: "-exec=qemu-riscv64-static"`. A command lives at or after its step's `run:`; anything before it is data (oneline+matrixflag).
Either message, believed, closes the file as nothing to do -- which is the same failure as the green tick this tool exists to remove.
It is idempotent: a file already carrying the fix comes back byte-identical and is reported `already-fixed`.