From 1c8f8af09290ee09f09a63074aadfd9704a0ae6a Mon Sep 17 00:00:00 2001 From: William Grzybowski Date: Mon, 19 Oct 2026 15:15:05 -0300 Subject: [PATCH] truenas-appliance-runner: read node B's ids in the call that sees its new boot, not in a later one sshd may refuse --- .github/actions/truenas-appliance-runner/ha.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/actions/truenas-appliance-runner/ha.sh b/.github/actions/truenas-appliance-runner/ha.sh index 2cbfacc..3667b11 100755 --- a/.github/actions/truenas-appliance-runner/ha.sh +++ b/.github/actions/truenas-appliance-runner/ha.sh @@ -241,17 +241,25 @@ unique() { # (run 39251437564 read B's ids over ssh and was refused). # A refused or timed-out connection (sshd not started yet, the network # not up) is just tried again. + # + # B's ids are read in the same call that sees the new boot, not in another + # one after it: sshd answering once does not mean it stays up. Middleware + # applies its own SSH settings as it starts and restarts sshd, and in run + # 39296815434 a later read was refused after this loop had seen the boot. + local out deadline=$((SECONDS + 600)) while [ "$SECONDS" -lt "$deadline" ]; do - now="$(ssh_ b cat /proc/sys/kernel/random/boot_id 2>/dev/null)" || now= + # shellcheck disable=SC2016 # expanded on the node + out="$(ssh_ b 'echo "$(cat /proc/sys/kernel/random/boot_id) $(cat /etc/machine-id) $(hostid)"' 2>/dev/null)" || out= + now="${out%% *}" [ -n "$now" ] && [ "$now" != "$boot" ] && break sleep 5 done if [ -z "$now" ] || [ "$now" = "$boot" ]; then die "node B did not come back over ssh from its reboot within 10 minutes" fi + b="${out#* }" "${TNCTL[@]}" wait "ws://${IP[b]}" "$APPLIANCE_USER" "$password" --timeout 600 >/dev/null - b="$(ids b)" [ "$a" != "$b" ] || die "node B still has A's ids after its reboot: $b" say "node B now has $b" }