GNU GRUB: Difference between revisions

imported>Fadenb
fix grub textmode instructions
m Missing efi attribute for boot.loader.efi.canTouchEfiVariables
Tags: Mobile edit Mobile web edit Visual edit
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{expansion}}
{{expansion}}[https://www.gnu.org/software/grub/ GNU GRUB] , also known as the Grand Unified Bootlader, is a multiboot bootloader created and maintained by GNU. It is a versatile alternative to systemd-boot that supports both UEFI and Legacy BIOS.
 
== Usage ==
To install and enable GRUB on UEFI systems, add this to your system configuration:
{{File|3=<nowiki>
boot.loader = {
  grub = {
    enable = true;
    device = "nodev"; # "nodev" is used for UEFI
    efiSupport = true;
  };
  efi.canTouchEfiVariables = true;
};
</nowiki>|name=/etc/nixos/configuration.nix|lang=nix}}
Alternatively, to install and enable GRUB on Legacy BIOS systems, add this to your system configuration:
{{File|3=<nowiki>
boot.loader.grub = {
  enable = true;
  device = "/dev/sda"; #replace with the drive intended for boot
};|name=/etc/nixos/configuration.nix|lang=nix}}
For additional GRUB module configuration options, refer to [https://search.nixos.org/options?channel=25.11&query=boot.loader.grub boot.loader.grub.]


== FAQ ==
== FAQ ==


=== How do I remove older generations from the bootloader? ===
→ See [[Bootloader#FAQ]] as those questions also applies to GRUB.
 
=== this GPT partition label contains no BIOS Boot Partition ===
 
This error is caused by using grub for legacy boot with a disk formatted as GPT<ref>https://en.wikipedia.org/wiki/BIOS_boot_partition</ref>.


First, collect garbages in your system, then rebuild. The scripts will collect leftover files.
This can be fixed either by:


The first command, in the example below, removes everything older than 14 days.
* Using a MBR partition scheme
* Adding a <tt>BIOS boot</tt> partition among your GPT partitions. See https://github.com/nix-community/disko/blob/master/example/gpt-bios-compat.nix# for an example setup using [[disko]].


<syntaxhighlight lang="commands">
{{expansion|Add the steps required here. Explain as if inside the nixos installer environment.}}
$ sudo nix-collect-garbage --delete-older-than 14d
$ sudo nixos-rebuild boot
</syntaxhighlight>


=== How do I use GRUB in text mode? ===
=== How do I use GRUB in text mode? ===
Line 24: Line 46:
</syntaxhighlight>
</syntaxhighlight>


Only disabling the GRUB splash screen via <syntaxhighlight lang="nix" inline>boot.loader.grub.splashScreen = null;</syntaxhighlight> results in a similar output but that is not the real text only mode.
Only disabling the GRUB splash screen via <syntaxhighlight lang="nix" inline>boot.loader.grub.splashImage = null;</syntaxhighlight> results in a similar output but that is not the real text only mode.
 
<hr />
 
[[Category:Applications]][[Category:Booting]]