Repairing boot menu

I installed Fedora Silverblue to try the new version on my system with NixOS. SB doesn’t play well with pre-existing efi directories, and in the process, I reformatted the efi partion and the boot entries associated with NixOS are gone. Running grub2-mkconfig from SB does not find the NixOS images unfortunately.

I’m not very handy with grub, and am looking for some advice. I guess I could do a fresh NixOS install and rebuild with my configs, but it seems there should be a better way. I’d appreciate some advice.

Thanks

1 Like

There’s nothing to find, you wiped the ESP. Just boot the NixOS ISO, mount up your file systems, and run nixos-install. The cool thing about nixos-install is that it’s idempotent; you can run it on an already installed system and all it’ll do is make sure it’s installed correctly.

2 Likes

Also, NixOS generally wants to be the one in charge of the boot loader, because one of its hallmark features is being able to roll back to any generation in the boot menu.

1 Like

Boot again from the nixos installer iso/isb.

Mount the filesystems as you would during an install, under /mnt

Then either:

nixos-enter --root /mnt
nixos-rebuild switch --install-bootloader

or

nixos-install --root /mnt --no-root-password
4 Likes

Thank you all for the helpful replies.

Silverblue is also particular about controlling efi (it cannot even be installed using a pre-existing efi, though Fed Workstation can). So my question is, should I perform the above procedure using a separate efi partition or the same as SB? Will I be able to boot SB from the NixOS efi partition? I am asking the same thing in the Fedora channels, along with some other questions about booting oddities.

Also, could I perform the above procedure by chrooting from my running OS?

Cheers

1 Like

It works, you’re right.

nixos-enter --root /mnt
nixos-rebuild switch --install-bootloader

I’m very surprised switch worked in nixos-enter. It really ought to fail, as it tries to do a bunch of starting / stopping / restarting of systemd units which of course aren’t a thing in the chroot.

But nixos-rebuild boot --install-bootloader is expected to work (even though the log output of the command is confusing)

5 Likes

Yes your option fixes the problem for you, but we still don’t know if it fixed the problem for OP therefore it cannot be called the “solution” yet

Sorry I never closed this. I never actually tried the solution, I decided there was really no good reason to keep the Silverblue installation. I will assume that the above works and mark this as solved.