Bootloader: Difference between revisions

imported>User
No edit summary
imported>Iceychris
m add a simple way of reinstalling the bootloader while the system is running
Line 55: Line 55:
* The ESP was re-made and nothing was kept
* The ESP was re-made and nothing was kept
* The ESP wasn't mounted and I want to re-generate the menu entries
* The ESP wasn't mounted and I want to re-generate the menu entries
==== From a running system ====
<syntaxhighlight lang="bash">
sudo nixos-rebuild --install-bootloader switch
</syntaxhighlight>
==== From an installation media ====


Booting from the installation media, mount the root partition, and the boot partition under <code>/mnt</code>. Next, bind system virtual file systems under <code>/mnt</code>. Finally, run the [https://github.com/NixOS/nixpkgs/blob/e140d71d6330786c40b4bd9c0d59af7ad1a5e86a/nixos/modules/installer/tools/nixos-install.sh#L191-L192 command that the installer would run]. This will re-install the bootloader.
Booting from the installation media, mount the root partition, and the boot partition under <code>/mnt</code>. Next, bind system virtual file systems under <code>/mnt</code>. Finally, run the [https://github.com/NixOS/nixpkgs/blob/e140d71d6330786c40b4bd9c0d59af7ad1a5e86a/nixos/modules/installer/tools/nixos-install.sh#L191-L192 command that the installer would run]. This will re-install the bootloader.