Change bootloader to grub

Hey there,

I’m an absolute beginner with nix, so the solution might look obvious for some of you but I couldn’t figure it out :slight_smile:

I tried to change the bootloader from systemd to grub, so I changed to previous code to this:

    boot.loader = {
        efi = {
            canTouchEfiVariables = true;
            efiSysMountPoint = "/boot/efi"; # ← use the same mount point here.
        };
        grub = {
            enable = true;
            efiSupport = true;
            #efiInstallAsRemovable = true;
            device = "nodev";
        };
    };

It’s basically just copied from here: Bootloader - NixOS Wiki

The problem I have is, that after running sudo nixos-rebuild --install-bootloader boot i still boot into systemd.

systemd-boot writes itself to $ESP/EFI/BOOT/BOOTX64.EFI, which grub doesn’t overwrite unless you have efiInstallAsRemovable = true;, which is mutually exclusive with canTouchEfiVariables = true;. Given that canTouchEfiVariables = true; is preferable, IMO, just delete $ESP/EFI/BOOT/BOOTX64.EFI.

Also, don’t set efiSysMountPoint = "/boot/efi"; unless you have actually moved your ESP to /boot/efi. And even then… why? I would recommend against it. Just having /boot and the ESP be one and the same is preferable IMO

1 Like