Two fixes for the auto-installer leaving baremetal-gui's ZFS root pool unable to import on its first real boot:
The actual root cause:nixos-install bind-mounts /dev, /proc, /sys (and usually /run) into /mnt to run the target's activation script in a chroot, and doesn't unmount them again afterward. Left in place, those nested mounts made ZFS refuse to unmount its own root dataset at /mnt -- confirmed live: zpool export -a failed with cannot unmount '/mnt': pool or dataset busy, and because auto-install.sh runs under set -e, that killed the script before it ever reached reboot. So the pool was never actually exported, silently defeating the export-before-reboot fix from #40 on every real run -- which is why the ZFS-import stall kept recurring even after that PR merged. Fixed by unmounting those leftover chroot mounts before attempting the export.
Debuggability follow-up: the systemd-based initrd locks the root account by default, so when the ZFS import unit did fail and dropped to emergency mode, sulogin refused a shell (looped re-entering the target instead of prompting) -- there was no way to see the real error without rebooting into separate installer media. Adds boot.initrd.systemd.emergencyAccess = true; to modules/platforms/baremetal.nix (scoped to this host only -- not promoted to common config, since it trades away console-lockout protection and the other hosts (linode-*/proxmox-*/server) don't have the same boot fragility) so the next occurrence is debuggable directly on the real boot.
Both verified with bash -n and scripts/codex-maintenance.sh (clean, only pre-existing documented secret-grep exceptions).
Two fixes for the auto-installer leaving baremetal-gui's ZFS root pool unable to import on its first real boot:
1. **The actual root cause:** `nixos-install` bind-mounts `/dev`, `/proc`, `/sys` (and usually `/run`) into `/mnt` to run the target's activation script in a chroot, and doesn't unmount them again afterward. Left in place, those nested mounts made ZFS refuse to unmount its own root dataset at `/mnt` -- confirmed live: `zpool export -a` failed with `cannot unmount '/mnt': pool or dataset busy`, and because `auto-install.sh` runs under `set -e`, that killed the script before it ever reached `reboot`. So the pool was never actually exported, silently defeating the export-before-reboot fix from #40 on every real run -- which is why the ZFS-import stall kept recurring even after that PR merged. Fixed by unmounting those leftover chroot mounts before attempting the export.
2. **Debuggability follow-up:** the systemd-based initrd locks the root account by default, so when the ZFS import unit *did* fail and dropped to emergency mode, `sulogin` refused a shell (looped re-entering the target instead of prompting) -- there was no way to see the real error without rebooting into separate installer media. Adds `boot.initrd.systemd.emergencyAccess = true;` to `modules/platforms/baremetal.nix` (scoped to this host only -- not promoted to common config, since it trades away console-lockout protection and the other hosts (`linode-*`/`proxmox-*`/`server`) don't have the same boot fragility) so the next occurrence is debuggable directly on the real boot.
Both verified with `bash -n` and `scripts/codex-maintenance.sh` (clean, only pre-existing documented secret-grep exceptions).
The systemd-based initrd (default here, since this host has a ZFS
root) locks the root account by default, so sulogin refuses a shell
if something in the initrd fails and it drops to emergency mode --
confirmed live: it just loops re-entering the target instead of
prompting, making an initrd-level ZFS import failure impossible to
diagnose from the console. Only affects the pre-switch-root initrd
shell, not the installed system's own login.
beatzaplenty
changed title from Allow initrd emergency shell access on baremetal-gui to Fix ZFS root import stall on baremetal-gui reboot2026-07-22 04:07:48 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Two fixes for the auto-installer leaving baremetal-gui's ZFS root pool unable to import on its first real boot:
The actual root cause:
nixos-installbind-mounts/dev,/proc,/sys(and usually/run) into/mntto run the target's activation script in a chroot, and doesn't unmount them again afterward. Left in place, those nested mounts made ZFS refuse to unmount its own root dataset at/mnt-- confirmed live:zpool export -afailed withcannot unmount '/mnt': pool or dataset busy, and becauseauto-install.shruns underset -e, that killed the script before it ever reachedreboot. So the pool was never actually exported, silently defeating the export-before-reboot fix from #40 on every real run -- which is why the ZFS-import stall kept recurring even after that PR merged. Fixed by unmounting those leftover chroot mounts before attempting the export.Debuggability follow-up: the systemd-based initrd locks the root account by default, so when the ZFS import unit did fail and dropped to emergency mode,
suloginrefused a shell (looped re-entering the target instead of prompting) -- there was no way to see the real error without rebooting into separate installer media. Addsboot.initrd.systemd.emergencyAccess = true;tomodules/platforms/baremetal.nix(scoped to this host only -- not promoted to common config, since it trades away console-lockout protection and the other hosts (linode-*/proxmox-*/server) don't have the same boot fragility) so the next occurrence is debuggable directly on the real boot.Both verified with
bash -nandscripts/codex-maintenance.sh(clean, only pre-existing documented secret-grep exceptions).Allow initrd emergency shell access on baremetal-guito Fix ZFS root import stall on baremetal-gui reboot