Fresh installation with systemd-boot and zfs, but boot fails at GRUB black screen

Hi all, I’ve previously only used NixOS with GRUB and zfs, and have that config dialed in reliably. But now I’m working on a fresh new configuration using a similar zfs config, but with systemd-boot instead.

Installation works without error, but it throws a warning about /boot being world accessible. And when I reboot into the system, booting hangs at a black “GRUB” screen with no options or interactivity. Screenshot from my phone:

.

I’ve tried many different iterations, but same problem every time.

Here are the configuration.nix and hardware-configuration.nix for this config. Can anyone see what I might be doing wrong?

The disk setup is relatively simple - a single, brand new hard drive that has never had any other config installed on it. Two partitions, a FAT32 ESP /boot partition, and a ZFS / partition, created with these sgdisk commands:

1. sgdisk -n 0:0:+954M -t 0:EF00 -c 0:$BOOTNAME $DISK
2. sgdisk -n 0:0:0 -t 0:BF01 -c 0:$ZFSNAME $DISK

I completely wipe and reformat the hard drive every time I test a new config to get this working, so nothing should be left over from prior attempts. But every time, the same GRUB blank screen.

My process for wiping and reformatting between attempts is (after booting into the NixOS liveUSB):

1. umount -ARfv /mnt/boot/efi/ || :  # ||: = continue on non-zero/error
   umount -ARfv /mnt/boot/ || :
   umount -ARfv /mnt/ || :
3. zpool export $POOL
   zpool destroy $POOL
   zpool labelclear  -f /dev/disk/by-label/$POOL
4. wipefs -af "$DISK"
   sgdisk -Zo "$DISK"

Either that grub is being reinstalled from your config, which I didn’t spot a cause for in a brief read, or it’s not being wiped fully.

I suspect you may have it lurking in the boot sector, from a BIOS booting mode; it looks like your wipe is only clearing partitions. I’m not sure how much of the bootsector that sgdisk zaps, but it seems like it might be only the partition table? That would be consistent with it only printing the id and not loading the rest of grub. Try dd’ing some zeroes over the first MB or so of the disk.

Also, check your boot settings… you might actually be booting off a different device, and you probably want to be in EFI mode anyway.

1 Like

Yea, to expand on this part a little bit, I would disable CSM if I were you to avoid the option of legacy BIOS booting altogether. And I would use efibootmgr to check for unexpected UEFI boot entries.

2 Likes

Thanks, will try both and report back shortly.

Thanks, what’s CSM, a BIOS setting?

Can that be done in the LiveUSB environment?

Yep

Also yep. It’s just a program that displays and modifies the system’s UEFI variables

1 Like

I’m curious (not nagging, I hope), did this get resolved?