Grub not showing newer generations

Hi!
I’ve set up a dual boot system with NixOS two weeks ago. I’ve created a few new generations since then but they’re not showing up as a boot entry (same for my Windows 11 install on another disk).

When I run nixos-rebuild switch everything works fine and os-prober also find windows boot manager.

Here’s my current boot settings:

  boot.loader.grub.enable = true;
  boot.loader.grub.device = "nodev";
  boot.loader.grub.efiSupport = true;
  boot.loader.grub.useOSProber = true;
  boot.loader.efi.canTouchEfiVariables = true;

I checked the grub config and it lists all generations that I have.

I also saw this issue but even though the problem is the same I already enabled all the potential fixes and they don’t help.

Running nixos-rebuild list generations will properly show all the generations and show that my current generation is correct.

I’m not sure if this issue arises due to me dual booting or what the actual cause could be, I tried a few things but nothing has worked so far.

New generations not showing up generally means that you’re not configuring the bootloader correctly. Or perhaps that you’re not running the same bootloader nixos is configuring.

If you’re not seeing errors when activating, that means the script that generates the menu thinks it did it’s job fine, but the bootloader you’re running probably isn’t looking at the same menu files it’s generating.

Keep in mind that nixos-rebuild doesn’t reinstall grub every time you activate, so if you change bootloader settings, it’s important to run nixos-rebuild switch --install-bootloader.

Another thing you may want to try is using boot.loader.grub.efiInstallAsRemovable to bypass the need to update efi variables, as that process can be finicky in some cases.

Side note: You may want to consider adding your windows entry through boot.loader.grub.extraEntries. You can just copy the entry os-prober generated directly from /boot/grub/grub.cfg. That keeps os-prober from running all over again every single rebuild… which can be slow.

Aside what tejing wrote another point could be:
Was your bootloader config placed on a separate partition and is possibly nowerdays not mounted when running nixos-rebuild?

That will also result in the behavior you are observing.
If it’s located on another partition, check your mountpoints and if the mounts if needed.

Whenever I read people describing the behaviour you describe, I want to ask whether they are sure to look at grub when booting…

The default generated bootloader is systemd-boot, and often people changed from that to grub, but only improperly, and are now booting through the systemdhboot that doesn’t get updated anymore…

2 Likes

@NobbZ It was indeed the wrong boot order. I for some reason had a linux boot entry which I used by default but after I created my grub dual boot setup I didn’t adjust it to NixOS so it didn’t work.

Thanks for the help everyone!

1 Like