Accept a degraded systemd as a booted one in the deb-install boot wait

The boot check piped `systemctl is-system-running --wait` into `grep -qE
'running|degraded'`, but the script runs `set -o pipefail` and is-system-running
exits non-zero for `degraded`. So the pipeline failed on a degraded system even
though grep matched, and the wait looped to its timeout. The older distros reach
`running` (exit 0) and passed; debian:trixie and ubuntu:26.04 reach `degraded`
because a unit that cannot run in a container (systemd-modules-load) fails, so
they timed out at every ceiling -- which is why the earlier timeout increase did
nothing.

Capture the state string and test it directly instead of trusting the pipeline
exit, so a degraded-but-booted system is accepted as intended. Validated: all
five distros pass, including the two that previously failed.
This commit is contained in:
Johnathan Corgan
2026-07-23 19:50:07 +00:00
parent 2bc0345174
commit bb9bca4d83
+13 -5
View File
@@ -32,7 +32,7 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
CACHE_DIR="$SCRIPT_DIR/.cache" CACHE_DIR="$SCRIPT_DIR/.cache"
DEB_CACHE_DIR="$CACHE_DIR/deb" DEB_CACHE_DIR="$CACHE_DIR/deb"
# Timeouts # Timeouts. Each wait loop below exits as soon as its condition is met.
BOOT_TIMEOUT=30 BOOT_TIMEOUT=30
SERVICE_TIMEOUT=20 SERVICE_TIMEOUT=20
DAEMON_TIMEOUT=15 DAEMON_TIMEOUT=15
@@ -75,11 +75,19 @@ start_systemd_container_with_tun() {
} }
wait_for_systemd() { wait_for_systemd() {
local name="$1" local name="$1" state
for _i in $(seq 1 "$BOOT_TIMEOUT"); do for _i in $(seq 1 "$BOOT_TIMEOUT"); do
if docker exec "$name" systemctl is-system-running --wait 2>/dev/null | grep -qE 'running|degraded'; then # `is-system-running` exits non-zero for `degraded` (a unit failed to
return 0 # start -- e.g. systemd-modules-load, which cannot load kernel modules
fi # inside a container -- even though the system did finish booting). This
# script runs `set -o pipefail`, so a piped `grep` would inherit that
# non-zero exit and reject an acceptable state, which timed out the
# newest distros (they reach `degraded`, older ones reach `running`).
# Capture the state string and test it directly instead of the pipe.
state=$(docker exec "$name" systemctl is-system-running --wait 2>/dev/null || true)
case "$state" in
running | degraded) return 0 ;;
esac
sleep 1 sleep 1
done done
# A boot that never reached `running` or `degraded` is not a warning: every # A boot that never reached `running` or `degraded` is not a warning: every