Grub2 embedding on fat FS

Hello all,
I’m having trouble with grub2 when running sudo nixos-rebuild switch, getting these errors:

building Nix...
building the system configuration...
updating GRUB 2 menu...
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/raid*[0-9]: not a block device
lsblk: /dev/mapper/disks*[0-9]: not a block device
Found Windows Boot Manager on /dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi
installing the GRUB 2 boot loader on /dev/disk/by-label/boot...
Installing for i386-pc platform.
/nix/store/5mvk29ha0y7rv20da3rk739w736s9gza-grub-2.04/sbin/grub-install: warning: File system `fat' doesn't support embedding.
/nix/store/5mvk29ha0y7rv20da3rk739w736s9gza-grub-2.04/sbin/grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/nix/store/5mvk29ha0y7rv20da3rk739w736s9gza-grub-2.04/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/ installation of GRUB on /dev/disk/by-label/boot failed

I have a different hdd with windows installed in my pc, which shows up on the grub menu, more strange however is that I’m only able to select 14 generations in the grub menu.

these are all the settings I have in my configuration.nix:

  # Use the systemd-boot EFI boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  #boot.loader.grub.configurationLimit = 5;

  boot.loader.grub.device = "/dev/disk/by-label/boot";
  boot.loader.systemd-boot.enable = true;
  boot.loader.grub.useOSProber = true;

thanks for the help!

You can not use systemd + grub for booting.

Are you on a system with EFI or legacy boot?

I am using EFI, yes.

Then first decide whether you want to use grub or systemd-boot, remove the configuration for the manager you do not want to use.

I have no experience using grub in a EFI boot system, though boot.loader.grub.device needs to point to a device not a partition. On my legacy boot system it is /dev/sda, I am not sure if this is the same on an EFI system, though there is still a comment left in that config that says # or "nodev" for efi only on the line that I set the device.

On my other system, which is EFI with systemd-boot, actual boot loader config consists of two lines:

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

Though I have to be honest, I have no clue why I have the canTouchEfiVariables in there… I think it was suggested somewhere, but I do not remember the exact details… I am not really an EFI expert and this system is actually the first that I installed with EFI boot.

1 Like

interesting, I didn’t know systemd-boot was a thing. let me try that out.

But you enabled it in your configuration:

And remember, before fiddling with boot settings, have your rescue disc in reach :smiley:

as well as grub, maybe the two programs interfered with each other

They definitely did. They are mutually exclusive.

1 Like

sudo nixos-rebuild build gave no errors, I am cautiously excited.

no errors on switch, rebooting…

YES, it worked like a charm! Got hung up on some xorg problems but that was not because of this. Everything boot related works perfectly now, thank you so much.

1 Like