utils/vmbox/lib
Krzysztof kuhy Rudnicki ab8227e23f
Some checks are pending
file length / file-length (push) Waiting to run
palette drift / palette (push) Waiting to run
vmbox: fix the settle gate breaking shutdown verdicts on the serial transport
The previous commit skipped the poweroff settle when `ssh_rc != 255`, on the
reasoning that a successful poweroff kills the ssh connection and ssh reports
255. That holds for the ssh transport and for nothing else. `_run_transport`
falls back to the serial console whenever ssh does not answer -- and the
README calls serial "the transport of record for shutdown tests" -- where the
exit code comes from serial_exec.py and is 0 even while the machine is already
on its way down.

Result, reproduced: `VMBOX_TRANSPORT=serial vm run <vm> 'sudo systemctl
poweroff'` reported "still running" for a guest that had cleanly powered off,
with SHUTDOWN{guest:true} in events.jsonl and "reboot: Power down" in the
serial log. The one thing this tool exists to get right, silently wrong. My
five verdict re-tests all went through ssh, so none of them caught it.

Grepping the serial log for shutdown markers instead does not work either:
they land a second or two after the command returns, so the check loses the
race. The fix waits a short grace period (default 3s) for any sign of a stop
before committing to the 30s wait. Warm runs go from 0s to 3s; that is the
honest price of a correct verdict.

Re-tested: clean poweroff, reboot and panic on BOTH transports, plus
tests/destructive_demo.sh 7/7.

Also, per "a fix that needs a human to remember a flag is not a fix": the X
session wait is now automatic on the branch that actually boots the guest --
the only one that can race tty1's autologin -- instead of requiring
VMBOX_X_WAIT. Warm runs never reach that branch. The env var remains an
override. README numbers corrected to the measured 14s/3s and ~100s.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdyMBGCrGVGDWtJ9xe48f3
2026-08-22 23:28:57 +02:00
..
base.sh vmbox: 3-4x faster runs, a read-only host package cache, and vm scp 2026-08-22 23:17:21 +02:00
common.sh vmbox: derive the peer IP from the NIC's MAC; document that VM-to-VM is broken 2026-08-22 21:23:37 +02:00
launch.sh vmbox: VM-to-VM networking works (the transport was fine, my pairing was not) 2026-08-22 21:26:47 +02:00
overlay.sh vmbox: wait for qemu to release the overlay before recreating it 2026-08-22 21:28:02 +02:00
qmp.py vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
recorder.py vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
repo.sh vmbox: share host repos by bind mount, not symlink 2026-08-22 21:15:57 +02:00
run.sh vmbox: fix the settle gate breaking shutdown verdicts on the serial transport 2026-08-22 23:28:57 +02:00
screenshot.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
seed.sh vmbox: 3-4x faster runs, a read-only host package cache, and vm scp 2026-08-22 23:17:21 +02:00
serial_exec.py vmbox: bound every wait, so an unbootable guest fails instead of hanging 2026-08-22 22:31:39 +02:00
smoke.sh vmbox: add a serial transport so shutdown tests do not depend on sshd 2026-08-22 20:58:22 +02:00
ssh.sh vmbox: 3-4x faster runs, a read-only host package cache, and vm scp 2026-08-22 23:17:21 +02:00
verdict.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00