#!/bin/bash # Guest-side post-rollback verification for the disposable VM. # # Fetched and run by `serial-driver.py rollback` after the detached reboot. It # records the restored root/var generation, the package-database fingerprint, # kernel modules, the /home marker, the recovery BLS entry and `sys rollback # status`. The host compares these against the pre-rollback markers; a marker # alone would not prove package-state consistency. set -uo pipefail SYS="${SYS_BIN:-/tmp/sys}" USER_NAME="${USERNAME:-phoebus}" pkg_fingerprint() { find /var/db/pkg -mindepth 2 -maxdepth 2 -type d 2>/dev/null \ | sort | sha256sum | awk '{print $1}' } HOME_MARKER="$(cat "/home/$USER_NAME/rollback-marker.txt" 2>/dev/null || echo missing)" echo "===AFTER-KNOWN-GOOD pkgs=$(pkg_fingerprint) kernel=$(uname -r) home=$HOME_MARKER===" if [ -e /etc/phoebus/rollback-broken.txt ]; then echo "===AFTER-BROKEN-MARKER present===" else echo "===AFTER-BROKEN-MARKER absent===" fi echo "===AFTER-ROOT===" btrfs subvolume show / 2>&1 | sed -n '1,10p' echo "===AFTER-VAR===" btrfs subvolume show /var 2>&1 | sed -n '1,10p' if [ -d "/lib/modules/$(uname -r)" ]; then echo "===AFTER-MODULES ok===" else echo "===AFTER-MODULES missing===" fi echo "===AFTER-ENTRIES===" for d in /efi/loader/entries /boot/efi/loader/entries; do if [ -d "$d" ]; then ls "$d" break fi done echo "===AFTER-RECOVERY===" cat /efi/loader/entries/phoebus-recovery.conf \ /boot/efi/loader/entries/phoebus-recovery.conf 2>/dev/null || true echo "===AFTER-STATUS===" "$SYS" rollback status 2>&1 || true echo "===AFTER-DONE==="