utils/vmbox/lib
Krzysztof kuhy Rudnicki cf5982c9fa vmbox: give guest commands the sandbox's own X session
The image ships Xorg + i3 on tty1 precisely so locker and i3 tests can run,
but `vm run` executes through `sh -c`, which reads no profile. Every X tool
therefore landed with no DISPLAY and no XAUTHORITY and failed with
"Could not determine i3 socket path" -- indistinguishable from "this sandbox
has no X server". testsAndMisc's i3-configuration installer failed that way;
with the environment resolved it exits 0 and i3-msg reports {"success":true}.

XAUTHORITY is the awkward half: startx generates /tmp/serverauth.XXXXXXXX
with a fresh random suffix every boot, so it cannot be hardcoded. Resolve it
from the running Xorg's own -auth argument, falling back to a newest-first
glob.

The `[ -f ]` guard on the source line is load-bearing, not defensive
dressing. In POSIX sh, `.` on a missing file is a SPECIAL BUILTIN error that
exits the shell outright, and `|| true` does NOT rescue it -- written that
way, every `vm run` against a base image predating this snippet silently
produced no output at all. Found by doing exactly that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdyMBGCrGVGDWtJ9xe48f3
2026-08-22 21:51:54 +02:00
..
base.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +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: give guest commands the sandbox's own X session 2026-08-22 21:51:54 +02:00
screenshot.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
seed.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
serial_exec.py vmbox: fix the boot deadlock that made every sealed image unreachable 2026-08-22 21:06:06 +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: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00
verdict.sh vmbox: disposable Arch VM sandbox for destructive system tests 2026-08-22 20:47:56 +02:00