Skip to content

Commit 902aa5e

Browse files
committed
vm: make boot-check work on a QEMU without virglrenderer, and write a real PNG
Two things found by actually running it, which had evidently not happened on this machine before: QEMU is not in this image and never has been. The vm/ tooling was written on the old Aurora host, which shipped it, so the gate that SETUP §3 and DESIGN §9.4 describe as the thing standing between a build and the laptop could not run at all here. A green build says nothing about whether the next step works. Installing it is not the whole story either. Homebrew's bottle is built without virglrenderer, so it offers virtio-vga but not virtio-vga-gl, and the script failed on the -device line with an error that pointed at nothing useful. boot-check.sh now checks for qemu up front, and picks the 3D pair when the build offers it and degrades to 2D with a loud warning when it does not. The fallback is worth having rather than a hard failure: tuigreet is an fbcon TTY program, so the whole boot path through greetd is genuinely exercised and the screenshot means what it says. niri is what is lost — it exits immediately without a render node — so the warning states plainly that a green 2D run proves the image boots to a login prompt and nothing more. Separately, screendump needs an explicit format. Without one it emits a PPM regardless of the filename, so vm/output/greeter.png has always been a 3.1MB PPM that no image viewer would open. It is now a 7.1KB PNG. SETUP §3 gains the prerequisite and a table of what each QEMU actually proves.
1 parent 3f6843a commit 902aa5e

2 files changed

Lines changed: 57 additions & 4 deletions

File tree

SETUP.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@ verification step to remember.
7474
The laptop is not touched until a VM boots this image to a usable niri session (§9).
7575
bootc-image-builder is **rootful**, so the disk build needs `sudo`; QEMU boot does not.
7676

77+
**QEMU is a prerequisite and is NOT in this image.** It never has been — the `vm/`
78+
tooling was written on the old Aurora host, which shipped it, and the gap went
79+
unnoticed because a green build says nothing about whether the gate that follows it
80+
can run. Install it before the first VM test on a fresh machine.
81+
82+
Which QEMU you install decides how much of the test you get:
83+
84+
| | greeter check | niri renders |
85+
|---|---|---|
86+
| `brew install qemu` | yes | **no** |
87+
| Fedora `qemu-system-x86-core` + `qemu-device-display-virtio-vga-gl` | yes | yes |
88+
89+
Homebrew's bottle is built without virglrenderer, so it has `virtio-vga` (2D) but no
90+
`virtio-vga-gl`. `boot-check.sh` detects that, falls back to 2D and says loudly what
91+
is lost. The fallback is still worth running — tuigreet is an fbcon TTY program and
92+
needs no compositor, so the whole boot path through greetd is genuinely exercised
93+
and the screenshot means what it says. What you do **not** get is niri: it exits
94+
immediately with no render node, so a green 2D run is proof the image boots to a
95+
login prompt and nothing more. Do not read it as proof of a working desktop.
96+
7797
```
7898
bash vm/export-image.sh # refresh vm/kb3lyb-sway.oci from the CURRENT image (do this first!)
7999
sudo bash vm/build-qcow2.sh # build the qcow2 (rootful)
@@ -89,8 +109,10 @@ sudo bash vm/build-qcow2.sh
89109
bash vm/retest.sh verify
90110
```
91111

92-
> QEMU must use `virtio-vga-gl` + `egl-headless` (boot-check.sh does) or niri exits
93-
> for lack of a GPU render node — a VM artifact, not an image bug.
112+
> niri needs `virtio-vga-gl` + `egl-headless` to have a GPU render node; without one
113+
> it exits immediately. That is a VM artifact, not an image bug. `boot-check.sh`
114+
> picks the 3D pair when the QEMU build offers it and degrades to 2D with a warning
115+
> when it does not — see the table above for what each mode actually proves.
94116
95117
---
96118

vm/boot-check.sh

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@ if [ "${1:-}" = "--shutdown" ]; then
3737
fi
3838

3939
[ -n "$QCOW" ] || { echo "!! no qcow2 in vm/output — run vm/build-qcow2.sh first"; exit 1; }
40+
41+
# QEMU is NOT in this image and never has been — the vm/ tooling was written on the
42+
# old Aurora host, which shipped it. It is a prerequisite you install yourself; see
43+
# SETUP §3.
44+
command -v qemu-system-x86_64 >/dev/null 2>&1 || {
45+
echo "!! qemu-system-x86_64 not found. See SETUP §3 — it is not part of this image."
46+
exit 1
47+
}
48+
49+
# virtio-vga-gl needs a QEMU built against virglrenderer, and not every build is.
50+
# Homebrew's bottle is not: it has virtio-vga (2D) only. Rather than fail on the
51+
# -device line with an opaque error, degrade deliberately and say what is lost.
52+
#
53+
# What survives 2D: the whole boot path through greetd to the tuigreet greeter,
54+
# which is what the screenshot below asserts — tuigreet is an fbcon TTY program and
55+
# needs no compositor. What does NOT: niri itself, which exits immediately with no
56+
# renderer, so the "log in over VNC and watch it render" step is unavailable.
57+
if qemu-system-x86_64 -device help 2>/dev/null | grep -q '"virtio-vga-gl"'; then
58+
VGA_DEVICE=virtio-vga-gl
59+
DISPLAY_BACKEND=egl-headless
60+
else
61+
VGA_DEVICE=virtio-vga
62+
DISPLAY_BACKEND=none
63+
echo "!! This QEMU has no virtio-vga-gl (built without virglrenderer)."
64+
echo "!! Falling back to 2D. The greeter check below is still valid; niri will NOT"
65+
echo "!! render, so do not read a successful run as proof of a working desktop."
66+
echo "!! For the full check install Fedora's qemu-device-display-virtio-vga-gl."
67+
fi
68+
4069
rm -f "$QMP"
4170

4271
echo ">>> Booting $QCOW (KVM, VNC 127.0.0.1:590${VNC_DISPLAY}, ssh localhost:${SSH_PORT})"
@@ -54,7 +83,7 @@ rm -f vm/serial.sock
5483
qemu-system-x86_64 \
5584
-machine q35,accel=kvm -cpu host -m 4096 -smp 4 \
5685
-drive file="$QCOW",if=virtio,format=qcow2 \
57-
-device virtio-vga-gl -display egl-headless -vnc 127.0.0.1:${VNC_DISPLAY} \
86+
-device "$VGA_DEVICE" -display "$DISPLAY_BACKEND" -vnc 127.0.0.1:${VNC_DISPLAY} \
5887
-netdev user,id=n0,hostfwd=tcp:127.0.0.1:${SSH_PORT}-:22 -device virtio-net,netdev=n0 \
5988
-device virtio-rng-pci \
6089
-qmp unix:"$QMP",server,nowait \
@@ -65,7 +94,9 @@ echo ">>> QEMU pid $(cat "$PIDF"). Waiting 75s for boot + niri session..."
6594
sleep 75
6695

6796
echo ">>> Capturing framebuffer screenshot -> $SHOT"
68-
qmp "{\"execute\":\"screendump\",\"arguments\":{\"filename\":\"$PWD/$SHOT\"}}"
97+
# format is REQUIRED. Without it screendump emits a PPM regardless of the file
98+
# extension, so $SHOT was a PPM called .png that no image viewer would open.
99+
qmp "{\"execute\":\"screendump\",\"arguments\":{\"filename\":\"$PWD/$SHOT\",\"format\":\"png\"}}"
69100
sleep 2
70101
ls -lh "$SHOT" 2>&1
71102

0 commit comments

Comments
 (0)