Describe the bug
Contrary to https://nixos.wiki/wiki/Bootloader#Re-installing_the_bootloader adding --install-bootloader to nixos-rebuild... does not reinstall the boot loader.
Steps To Reproduce
Steps to reproduce the behavior:
sudo nixos-rebuild --install-bootloader switch
Expected behavior
nixos-rebuild should print roughly the following
Copied "/nix/store/3s1ygbkri8rc2z39cv53z55z4cqldpwq-systemd-247.6/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/3s1ygbkri8rc2z39cv53z55z4cqldpwq-systemd-247.6/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI".
Random seed file /boot/loader/random-seed successfully written (512 bytes).
Successfully initialized system token in EFI variable with 512 bytes.
Created EFI boot entry "Linux Boot Manager".
Additional context
A change in ~2019 added sudo -- as a prefix to various calls including switch-to-configuration whenever $SUDO_USER is set. This happens for both sudo nixos-rebuild ... and when run as root. (during the build? process sudo_user is set to root)
--install-bootloader relies on exporting NIX_INSTALL_BOOTLOADER to communicate through? switch-to-configuration.pl to systemd-boot-builder.py. sudo -- does not preserve NIX_INSTALL_BOOTLOADER effectively disabling this option.
Notify maintainers
@zimbatm ?
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 5.10.66, NixOS, 21.11 (Porcupine)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.15`
- channels(<user>): `"home-manager"`
- channels(root): `"nixos-21.11pre325810.2deb07f3ac4"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
Describe the bug
Contrary to https://nixos.wiki/wiki/Bootloader#Re-installing_the_bootloader adding
--install-bootloadertonixos-rebuild...does not reinstall the boot loader.Steps To Reproduce
Steps to reproduce the behavior:
sudo nixos-rebuild --install-bootloader switchExpected behavior
nixos-rebuild should print roughly the following
Additional context
A change in ~2019 added
sudo --as a prefix to various calls includingswitch-to-configurationwhenever$SUDO_USERis set. This happens for bothsudo nixos-rebuild ...and when run asroot. (during the build? process sudo_user is set to root)--install-bootloaderrelies on exportingNIX_INSTALL_BOOTLOADERto communicate through? switch-to-configuration.pl to systemd-boot-builder.py.sudo --does not preserveNIX_INSTALL_BOOTLOADEReffectively disabling this option.Notify maintainers
@zimbatm ?
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"and paste the result.Maintainer information: