decisions DECIDED

322. The QEMU bootstrap is the one QEMU check

(The section number and title are provisional until the merge lands them.)

Background

The suite boots three emulators, qemu-system-aarch64, qemu-system-riscv64 and qemu-system-x86_64, and .qemu-version pins the release they must be. Two scripts provision a machine. script/bootstrap installs the Rust toolchain, python3, gh, ShellCheck, Ruby, a cross clang and the lint tools. script/ci-qemu builds the pinned QEMU from source into $HOME/.cache/nife-qemu, which helpers/qemu-path.sh puts first on PATH.

Before this ruling, bootstrap also handled QEMU. It installed a packaged QEMU (Homebrew's, or apt's five bootstrap-qemu packages) when none was on PATH, and then ran script/qemu-check. That check failed on a missing device and only warned on a version other than the pin. On a Linux failure bootstrap ran script/ci-qemu and checked again. CI never used the packaged path: every job runs script/ci-qemu first, so bootstrap found the pinned build and skipped its install. The packaged QEMU therefore served nobody in CI, and a cold Linux box installed it only for the build to shadow it. Two scripts held the question "is this the right QEMU", with two different answers to a version mismatch.

The decision

Ruled 2026-11-12 (UTC):

What follows in the tree:

How other systems do it

nife builds its pinned QEMU on purpose: an icount benchmark and a confinement test mean what they mean only on one emulator, so a developer and CI run the same release.

A concrete example

An Ubuntu 24.04 machine has apt's QEMU 8.2.2, which lacks riscv-iommu-pci. script/setup runs bootstrap, which leaves QEMU alone, and then script/ci-qemu. script/qemu-check reports the 8.2.2 binaries and the missing device. ci-qemu installs its build dependencies, builds the pinned release into $HOME/.cache/nife-qemu, sources helpers/qemu-path.sh and checks again. The pinned build is now first on PATH, so the check passes, and every later script/ entry point runs that build. A Mac whose Homebrew QEMU is one patch release past the pin takes the same route.