I’ve had a pretty good experience with UEFI booting my Pi4 (ZFS root on USB SSD, initially grub now systemd-boot), so I decided to try it on my Pi3 as well, which is BTRFS root also on a USB SSD.
Apparently the Pi3 bootloader requires MBR instead of GPT, and systemd-boot refuses to work with MBR.
I thought it would be no big deal – just use grub, but grub doesn’t seem to be producing any code in the EFI partition (I’m expecting something like efi/boot/bootaa64.efi).
When I run nixos-install, I get no errors, everything looks fine, just doesn’t boot. When I look closer, the boot*.efi file is missing.
When I nixos-enter into the image and manually NIXOS_INSTALL_BOOTLOADER=1 switch-to-configuration, I get the error below:
# NIXOS_INSTALL_BOOTLOADER=1 /run/current-system/bin/switch-to-configuration switch
updating GRUB 2 menu...
ERROR: Could not search B-tree: Function not implemented
Failed to retrieve subvolume info for /boot
Failed to install bootloader
BTRFS scrub comes up clean, the devices seems to mount and read normally.
Yes – @boot is a top-level subvolume mounted to /boot, with a FAT partition at /boot/efi. I’ve used this setup on my Pi4 (and other BTRFS-root UEFI machines) without issue.
Stuff like this is exactly why I tell people to just use systemd-boot and to mount the ESP at /boot. It’s so much simpler and you don’t have to deal with grub screwing things up half the time.
I mentioned above – systemd-boot refuses to install due to being MBR, so includes some additional levels of complexity (figuring out GPT with Hybrid MBR). Unless you’re aware of a way to get systemd-boot to work with the standard RPi3 MBR setup?
@Prince213 I have checked your blog post and it is a really nice guide, but how did you manage to run nixos-anywhere on the RPi3?
I am running into ‘out of space’ issues on the Raspberry Pi 3 (1GB RAM). The squashfs /nix/store overlay on tmpfs is just around 400MB, which seem to small, even with a minimal Raspberry Pi closure, to run nixos-anywhere.
Hi @qitta I’m sorry for the confusion. You don’t run nixos-anywhere on the Raspberry Pi, instead you run it on another machine, and nixos-anywhere will copy the closure directly to the newly formatted disk over SSH.
@Prince213 Thanks for your prompt response! I understand that nixos-anywhere needs to be run from another machine. The challenge I’m facing is that my minimal Raspberry Pi closure is approximately 800MB, whereas the available squashfs space after booting from the ISO is only around 400MB. As a result, any attempt to copy the 800MB closure to the Raspberry Pi – whether using nix-copy-closure or nixos-anywhere – ends up exhausting the squashfs/tmpfs.
For more context, the flake with your disko config (slightly adapted):
This is weird. I have a Raspberry Pi 3 Model B with 1 GB RAM and I wrote that blog post for this model.
I didn’t run into this issue, but I think the way nixos-anywhere does it is that it directly copies the closure to /mnt (the target file system) so it doesn’t require space on tmpfs or something like that.
Could you share detailed logs? Things like disko logs may help with debugging.
@Prince213 I just managed to install it using nixos-anywhere with the additional --no-disko-deps flag which only uploads the disko script but not the partitioning tools dependencies and is supposed to be run on low memory systems.