# 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.
