Update Grub2 config on Silverblue

Hey all,

I installed NixOS on another partition and I’d like to have it show up in my boot menu. Running Silverblue 36, I tried running grub2-mkconfig and it finds it fine:

$ sudo grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Found NixOS 22.05 (Quokka) (22.05) on /dev/nvme0n1p4
Found Windows Boot Manager on /dev/sdc2@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

But it doesn’t actually change anything:

$ sudo cat /etc/grub2-efi.cfg | grep Nix

Also, manually looking in /etc/grub2-efi.cfg and /boot/grub2/grub.cfg it is unchanged and only lists Windows in the 30_os-prober section.

Any advice?

(The only topic I found about this seems to suggest grub2-mkconfig should just work, but it doesn’t for me.)

1 Like

Maybe this
$ sudo cat /etc/grub2-efi.cfg | grep Nix
should be changed to this
$ sudo cat /etc/grub2-efi.cfg | grep -i Nix
or
$ sudo cat /boot/grub2/grub.cfg | grep -i Nix
It seems possible that using that symlink may interfere. (It should not but who knows.)

Additionally, have you looked into /boot/efi/EFI/ and /boot/loader/entries/ to see if the proper subdirectory and files were created for NixOS?

1 Like

Thanks! The -i didn’t make a difference (and I did check the symlink target directly too).

NixOS does appear in EFI but not in entries:

$ sudo ls /boot/efi/EFI/
BOOT  fedora  Linux  nixos  systemd
$ sudo ls /boot/loader/entries/
ostree-1-fedora.conf  ostree-2-fedora.conf

I’m not sure what that means though. I’ve dug a little bit more in the grub2-mkconfig code and it seems the problem is that, while os-prober sees NixOS, linux-boot-prober can’t figure out a way to boot it, so no menu entry is generated. Trying to understand why now but bash debugging/reading is not my strong point :slight_smile:

I’ll also ask on the NixOS forums in case someone has an idea there.