From e07032c9a13e6733c8cbdd8800cc8151da5b5f10 Mon Sep 17 00:00:00 2001 From: Richie Cahill Date: Thu, 14 May 2026 11:36:39 -0400 Subject: [PATCH] setting forceImportRoot to false --- common/global/default.nix | 5 +- docs/zfs_failed_root_import_recovry.md | 76 ++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 docs/zfs_failed_root_import_recovry.md diff --git a/common/global/default.nix b/common/global/default.nix index bd48fa2..fce6a68 100644 --- a/common/global/default.nix +++ b/common/global/default.nix @@ -23,7 +23,10 @@ boot = { tmp.useTmpfs = true; kernelPackages = lib.mkDefault pkgs.linuxPackages_6_12; - zfs.package = lib.mkDefault pkgs.zfs_2_4; + zfs = { + package = lib.mkDefault pkgs.zfs_2_4; + forceImportRoot = lib.mkDefault false; + }; }; hardware.enableRedistributableFirmware = true; diff --git a/docs/zfs_failed_root_import_recovry.md b/docs/zfs_failed_root_import_recovry.md new file mode 100644 index 0000000..9fbdd24 --- /dev/null +++ b/docs/zfs_failed_root_import_recovry.md @@ -0,0 +1,76 @@ +# ZFS failed root import recovery + +## Fast path + +If the machine fails to boot because ZFS refuses to import `root_pool`: + +### GRUB + +1. At the bootloader menu, select the normal NixOS entry. +2. Press `e`. +3. Find the line that starts with `linux`. +4. Append this to the end of that line: + +```text +zfs_force=1 +``` + +5. Boot once with `Ctrl+x` or `F10`. + +### systemd-boot + +1. At the bootloader menu, highlight the normal NixOS entry. +2. Press `e`. +3. Append this to the end of the options line: + +```text +zfs_force=1 +``` + +4. Press `Enter` to boot once. + +## After boot + +Run: + +```bash +sudo zpool status +sudo zpool import +journalctl -b | rg "ZFS|zfs|import|root_pool" +``` + +## Expected result + +`sudo zpool status` should show `root_pool` as `ONLINE`. + +## Reboot test + +Run: + +```bash +sudo reboot +``` + +Do not add `zfs_force=1` the second time. + +## If it still fails + +Boot once more with: + +```text +zfs_force=1 +``` + +Then run: + +```bash +sudo zpool status -v +sudo zpool history | tail -n 50 +journalctl -b | rg "ZFS|zfs|import|root_pool" +``` + +## Notes + +- Root pool name is `root_pool`. +- This is a one-time recovery path after disk moves, controller changes, dirty exports, or interrupted imports. +- Some hosts also need the LUKS unlock USB key inserted before boot.