Open cmm opened 3 years ago
I think you need to use nixos-rebuild switch --install-bootloader
(or nixos-rebuild boot --install-bootloader
). Without that flag it should still switch the current system, but that will most likely be lost on reboot as it will update the config for systemd-boot, but not for Grub, but Grub is still installed.
nixos-rebuild
does not reinstall the bootloader by default.
I marked this as stale due to inactivity. → More info
I think what's happening is that when you switch bootloaders, the old one always remains installed. It's not part of the new closure, so NixOS does not know to explicitly uninstall it.
You need to switch your firmware to the new bootloader too or manually uninstall the old bootloader.
Uninstalling all bootloaders on every boot would be the solution but that probably is not the best idea. We'd have to mark NixOS-installed bootloaders somehow and only uninstall those (unless activated in the current generation) to not disturb other distros installed besides NixOS.
Even that has problems though if you dual-boot NixOS as we wouldn't want to uninstall the other NixOS installation's bootloaders.
To do that we'd have to mark all of our bootloaders with an installation-specific ID somehow. I'm not sure that's possible.
Describe the bug Unable to get rid of grub
To Reproduce Steps to reproduce the behavior:
boot.loader.systemd-boot=false
andboot.loader.grub=true
(and configure it sensibly so it works, of course),nixos-rebuild switch
. The boot loader is now grubsystemd-boot
.nixos-rebuild switch
.nixos-rebuild switch
no longer actually switches (well, it does, but only until reboot)Expected behavior
nixos-rebuild switch
should [de]activate bootloaders according to the settings.Additional context It's a seemingly-normal and reasonably modern EFI minicomputer with a standard NixOS 20.09 on it (first installed 20.03, no installation tweaks that I remember),
boot
is its ownvfat
partition and has plenty of free space. I think it was on the unstable channel for a little while, not sure.Metadata Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result."x86_64-linux"
Linux 5.4.100, NixOS, 20.09.3301.42809feaa9f (Nightingale)
yes
yes
nix-env (Nix) 2.3.10
"home-manager, nixpkgs-21.03pre268255.e5b478271ea"
"nixos-20.09.3301.42809feaa9f, home-manager-20.03"
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information: