Easy refind boot by booting into systemd-boot from refind?

Hey, I am using and want to keep using refind. No other bootloader puts windows into its place quite like refind. As I understand refind cannot boot nixos because it doesn’t understand generations.

How would I workaround this the easiest? I thought booting into refind first, and from it boot into systemd-boot that boots just nixos. Other option that I’d prefer would be to instruct refind to just boot the last generation, is it possible?

When it comes to the first option, how would I set this up? Will it work? If I can get confidence it’ll work I can maybe figure this out. Would help if I knew how to instruct systemd-boot from nixos, to boot just nixos, not the other systems. Is it confgurable via nixos configuration, or its lower level written somewhere in the EFI partition?

For reference there’s this great pr https://github.com/NixOS/nixpkgs/pull/58121, but it’s unfinished and just sitting there unmerged.

Thansk in advance!

I’m curious what issues you have using systemd-boot to boot windows. I’ve been using that for several months now and it’s never failed me. You can either select windows from the systemd-boot menu, or use bootctl set-oneshot auto-windows from Linux to set an EFI variable telling systemd-boot to boot windows once.

Sorry I can’t really help with rEFInd though. As far as I understand, it will chainload any EFI OS, so you should be able to point it at the systemd-boot configured by NixOS. Only thing would be that you need to set boot.loader.efi.canTouchEfiVariables = false so that systemd-boot doesn’t tell the UEFI that it should be the default boot loader. And even then, some UEFIs will prefer /EFI/BOOT/BOOTX64.EFI over any boot entry anyway, so you may have to make sure that you have rEFInd in that file so that systemd-boot doesn’t overwrite it with itself.


While I don’t use it currently, I have used refind with both grub and systemd boot. I just followed the Wiki:


1 Like

Thanks! Should I have two boot partitions for the two bootloaders or both in the same partition? Which partition do I list in configurations boot.loader.efi.efiSysMountPoint?

Also I feel like I have a mess in the boot partition right now. It looks like:

 - refind
 - boot
 - manjaro
 - nixos
 - systemd

with some .efi files at the directories. How do I reset it to recreate it correctly and cleanly, with no artifacts of some older systems etc. I know I have a mess, because
nixos-rebuild switch
fails with
“Exception: could not find any previously installed systemd-boot”

If you have the ESP mounted at /boot, you don’t need to set this at all.

You only need one ESP. At least that’s how I’ve done it.

As far as NixOS is concerned, the ESP might as well be empty. When you run nixos-rebuild or nixos-install, it’ll configure the boot loader from scratch.

This is actually somewhat concerning. Do you have more details?

1 Like

Probably it had been overwriten by systemd-boot from Manjaro. Imo, we always have backup of directory /boot when installing two distro using systemd-boot by default.