test(vm): drive the static Rust installer from the VM harness

The guest script now fetches and runs the static phoebus-installer binary
instead of the Bash tree, keeping the 0600 secret files and NO_SECRET_LEAK
scan. Docs and the interactive launcher point at the Rust binary.
This commit is contained in:
Phoebus 2026-09-20 03:02:37 -07:00
parent 4071c7d1f5
commit f984b01cfc
3 changed files with 25 additions and 14 deletions

View file

@ -14,16 +14,23 @@ touching a physical disk. The target is always a qcow2 file.
- `qemu-system-x86_64`, `qemu-img`, OVMF firmware, Python `pexpect`.
- The reference Gentoo ISO.
- The static Rust installer (the guest never runs the Bash tree):
```sh
cd installer-rs
RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu
```
## Procedure
Serve the installer, the stage3 and the config to the guest:
Serve the static installer, the stage3 and the config to the guest:
```sh
cd /path/to/serve
tar czf installer.tar.gz -C /path/to/phoebus_os installer
cp installer/tests/vm/install.sh .
cp installer/tests/vm/test.conf.example test.conf # edit TARGET_DISK etc.
cp /path/to/phoebus_os/installer-rs/target/x86_64-unknown-linux-gnu/release/phoebus-installer .
cp /path/to/phoebus_os/installer/tests/vm/install.sh .
cp /path/to/phoebus_os/installer/tests/vm/test.conf.example test.conf # edit TARGET_DISK etc.
sha256sum stage3.tar.xz # set STAGE3_SHA256
python3 -m http.server 8000 --bind 127.0.0.1
```

View file

@ -1,10 +1,10 @@
#!/bin/bash
# Guest-side automation for a disposable VM installation.
#
# Run inside the Gentoo live environment. It fetches the installer and a test
# configuration from a host HTTP server (QEMU user networking reaches the host
# at 10.0.2.2), supplies secrets from 0600 files, and drives the deterministic
# backend with --install. It never uses the TUI.
# Run inside the Gentoo live environment. It fetches the static Rust installer
# and a test configuration from a host HTTP server (QEMU user networking
# reaches the host at 10.0.2.2), supplies secrets from 0600 files, and drives
# the deterministic backend with --install. It never uses the TUI.
#
# Environment:
# PHOEBUS_BASE_URL host base URL (default http://10.0.2.2:8000)
@ -29,22 +29,26 @@ printf '%s' "${USER_PASSWORD:-phoebus-user-test}" >/tmp/user.pw
chmod 600 /tmp/luks.pw /tmp/user.pw
cd /tmp || exit 1
if ! curl -fsSL "$BASE/installer.tar.gz" -o installer.tar.gz; then
if ! curl -fsSL "$BASE/phoebus-installer" -o /tmp/phoebus-installer; then
echo "===FETCH-FAIL==="; poweroff -f; exit 1
fi
rm -rf installer && tar xzf installer.tar.gz
chmod 0755 /tmp/phoebus-installer
curl -fsSL "$BASE/$CONF" -o /tmp/test.conf
echo "=== INSTALLER VERSION ==="
/tmp/phoebus-installer --version
echo "=== DISKS BEFORE ==="
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
bash installer/bin/ai-installer --config /tmp/test.conf --install --yes \
/tmp/phoebus-installer --config /tmp/test.conf --install --yes \
--luks-passphrase-file /tmp/luks.pw --user-password-file /tmp/user.pw
rc=$?
echo "===INSTALL-RC=$rc==="
LOG=/var/log/ai-installer/install.log
[ -r "$LOG" ] || LOG=/tmp/ai-installer/logs/install.log
LOG=/run/phoebus-installer/install.log
[ -r "$LOG" ] || LOG=/tmp/phoebus-installer/install.log
[ -r "$LOG" ] || LOG=/var/log/phoebus-installer/install.log
echo "=== LOG TAIL ==="
tail -n 60 "$LOG" 2>/dev/null

View file

@ -94,7 +94,7 @@ echo "Disk: $DISK"
echo "Workdir: $WORKDIR"
echo "Firmware:$OVMF_CODE"
echo
echo "Inside the VM run: /path/to/installer/bin/ai-installer"
echo "Inside the VM run: /tmp/phoebus-installer --plan"
echo "Remember: the scratch disk is disposable."
QEMU=(qemu-system-x86_64