NixOS defaults to booting older generation?

This is a bizarre issue that’s recently appeared.

I issue nixos-rebuild switch, it builds my generation, I restart, it’s in my boot menu, but it’s not the default, so I have to manually switch to the new generation, how to I change the default?

2 Likes

I’m guessing it’s because the systemd gpt generator doesn’t detect your ESP partition and therefore doesn’t mount it, so all your changes are made to a local /boot and not the one on the ESP.

Try mounting it manually somewhere else to compare.

I have one machine where this doesn’t work and work around it by force mounting the ESP:

fileSystems = {
  "/boot" = {
    device = "/dev/disk/by-uuid/8355-E5B1";
    fsType = "vfat";
    options = [
      "nofail"
      "x-systemd.automount"
    ];
  };
};

Regards,
Peter

 mount | grep boot
/dev/nvme0n1p1 on /boot type vfat (rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

It’s mounted, as I said the menu has been updated, it’s just defaulting to generation 96, despite the menu option for generation 97-100 being available.

It looks like running nixos-rebuilt boot fixed it…at least for now.

2 Likes

I have the same problem occasionally, and the same workaround.