Bootloader: Difference between revisions
imported>Samueldr m Ugh, wikimarkup != markdown |
imported>Samueldr m Adds a one-liner to detect Legacy / UEFI |
||
Line 2: | Line 2: | ||
== FAQ == | == FAQ == | ||
=== Am I booted in Legacy or UEFI? === | |||
The following command will print which boot mode you are using. This can be used on the NixOS installation image to determine which steps to follow in the guide. | |||
<syntaxhighlight lang="commands"> | |||
[ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "Legacy" | |||
</syntaxhighlight> | |||
=== How do I remove older generations from the bootloader? === | === How do I remove older generations from the bootloader? === |
Revision as of 15:44, 3 February 2018
FAQ
Am I booted in Legacy or UEFI?
The following command will print which boot mode you are using. This can be used on the NixOS installation image to determine which steps to follow in the guide.
[ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "Legacy"
How do I remove older generations from the bootloader?
First, collect garbages in your system, then rebuild. The scripts will collect leftover files.
The first command, in the example below, removes everything older than 14 days.
sudo nix-collect-garbage --delete-older-than 14d
sudo nixos-rebuild boot
Troubleshooting
Re-installing the bootloader
- Something happened, and the bootloader doesn't work as expected.
- The ESP was re-made and nothing was kept
- The ESP wasn't mounted and I want to re-generate the menu entries
Booting from the installation media, mount the root partition, and the boot partition under /mnt
. Next, run the command that the installer would run. This will re-install the bootloader.
mount /dev/[root partition] /mnt
mount /dev/[boot partition] /mnt/boot
NIXOS_INSTALL_BOOTLOADER=1 chroot /mnt \
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
The most common cause for this situation is when the ESP isn't mounted where NixOS expects it to be on UEFI systems. NixOS assumes the ESP is mounted under /boot
and that it is on the ESP that NixOS will install the files needed for the boot process for UEFI systems.[1] This issue should affect all supported UEFI bootloaders equally for NixOS.
The usual fix for this problem is to add the missing entry for fileSystems."/boot"
in hardware-configuration.nix
(or where your mount points are defined). Follow the steps in #Re-installing the bootloader to re-generate the menu entries, then boot in your system to add the missing configuration. The next generations should work as expected in your bootloader.