From f72a07df64d8449895d0ceb860204b790a3c521c Mon Sep 17 00:00:00 2001 From: fidgetingbits Date: Mon, 3 Nov 2025 07:33:01 -0700 Subject: [PATCH] feat: Add check and warning for reboot inhibitor --- src/nixos-anywhere.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh index 3644d0b6..464d12cf 100755 --- a/src/nixos-anywhere.sh +++ b/src/nixos-anywhere.sh @@ -914,6 +914,29 @@ SSH nixosReboot() { step Rebooting + + # disable debug output temporarily to prevent log spam + set +x + + local inhibited + inhibited=$( + runSsh sh </dev/null; then + systemd-inhibit --list | grep "shutdown" + fi +SSH + ) + if [[ -n "${inhibited}" ]]; then + echo "WARNING: Reboot is currently inhibited. Manual reboot may be required. Run 'systemd-inhibit --list' on the target for further details" 2>&1 + if [[ -n ${enableDebug} ]]; then + echo "${inhibited}" 2>&1 + fi + fi + + if [[ -n ${enableDebug} ]]; then + set -x + fi + runSsh sh </dev/null && [ "\$(zpool list)" != "no pools available" ]; then # we always want to export the zfs pools so people can boot from it without force import