@ne9z - welcome and thanks for the solution.
I didn’t realise the OpenZFS project was as broad reaching as bootloader issues as well…
No, OpenZFS project definitely does not have anything to do with
bootloader issues: it is just me, being interested in writing Root on
ZFS guides, inevitably have to deal with bootloaders.
I found GRUB to be the most suitable solution, because it can boot from
ZFS pool, while systemd-boot does not support anything other than fat32.
To be able to natively boot from ZFS is crucial for Root on ZFS: say you
have a server at a remote location. You want it to be able to boot,
even if one of the disks completely fails and becomes unreadable. GRUB
is able to do that, with a redundant ZFS boot pool. Guess what happens
with fat32 (and systemd-boot).
I followed your link (and beyond) and there is more to GRUB than I
realised - I have been a “user” since the very beginning,and had many
GRUB issues over the years (most of them due to Windows!). I think I
have become stuck in my bootloader ways and so we drifted apart.
Windows is easy to boot – if you know how to do it. Assuming you are
using UEFI. It is known that Windows likes to overwrite the fallback
bootloader location with its own bootloader (Windows Boot Manager):
With that in mind, all you have to do is tell NixOS to not install GRUB
to that location (this is the default in the Root on ZFS guide, but
unsuitable if you are using any other OS), that can be done with the
updated, flake-based guide, by setting this option to false.
Then you can choose to boot whether NixOS, Windows, or some other system
inside the UEFI firmware boot menu. This has nothing to do with GRUB
anymore. You can also directly manipulate EFI boot entries with
View all current entries:
Creating an entry for archlinux:
efibootmgr --create --gpt --part=1 --loader="\EFI\archlinux\grubx64.efi" \
--label "ArchLinux" /dev/disk/by-id/ata-MYDISK-part1
You can also set which bootloader should be default, which should be
booted only once on the next boot, or even configure netboot if your
motherboard firmware supports it. See man page for details.
As I look to unlocking ZFS remotely (via ssh at startup or similar), I
am not finding systemd-boot an easy alternative either, and I am not
wedded to any particular technology or approach.
Remote unlock does not have anything to do with bootloaders, it is
mainly the job of initrd, this was documented in the guide but later
removed in favor of brevity.
I’ll be looking again at GRUB, and suggest others who have changed the
Nixos default boot do so as well - there may be some surprises
I hope the updated, flake-based guide would be easier to follow for new
users. Still, it is recommended to learn Nix via Nix Pills to be able to take full advantage of the Nix ecosystem.