grub - bunnyamin/bunnix GitHub Wiki
GRUB could in some contexts refer to the old GRUB 1 or the new GRUB 2. The new version could be called GRUB or GRUB2 while the old version could be called GRUB legacy. Make sure the intended GRUB version is installed.
GRUB could be installed with the i386-pc
modules for BIOS boot
, or the x86_64-efi
for the EFI boot
. Make sure the correct version is or both are installed.
UEFI requires GPT
, which BIOS can handle, while BIOS require MBR
, which UEFI cannot handle.
Size | Format | Flag | Label | Description |
---|---|---|---|---|
1 MiB |
unformatted |
bios_grub (ef02) |
BIOS boot partition for GRUB on GPT. | |
512 MiB |
FAT32 |
boot (ef00) |
ESP | ESP boot partition for UEFI. |
The computer must be in UEFI boot mode when installing GRUB for EFI. The file system must be vfat
or fat32
.
grub-install --debug --target=x86_64-efi --efi-directory=/boot/esp --removable --recheck --bootloader-id=grub
-
NOTE The
--removable
is only necessary if the drive is intended to be removed. -
NOTE Not required to provide a device, for example,
/dev/sda
.
UEFI boot search paths
\EFI\grub\grubx64.efi
\EFI\boot\bootx64.efi
Copy and rename grubx64.efi
(no longer necessary?)
cp /boot/EFI/grub/grubx64.efi /boot/EFI/boot/bootx64.efi
Error | Cause |
---|---|
source_dir doesn't exist. Please specify --target or --directory |
When --install=x86_64-efi on a system where EFI is not enabled. |
The computer must be in BIOS boot mode (that is, not in UEFI boot mode) when installing GRUB for BIOS legacy. The file system could be for example ext2
.
grub-install --debug --target=i386-pc --boot-directory=/boot/ --recheck /dev/sda
-
NOTE The Grub installation creates the
grub
dictionary. -
NOTE The device is not, for example,
/dev/sda1
or/dev/sda2
.
Error | Cause |
---|---|
source_dir doesn't exist. Please specify --target or --directory |
When --install=i386-pc on a system where EFI is enabled. |
-
8 Booting GRUB from the network
On the server, create a netboot directory for
i386-pc
,i386-efi
,x86_64-efi
. The directory structure could be for example/srv/tftp/netboot/grub
, where/srv/tftp/
is the root directory provided by tftp andnetboot/grub
the grub directory.
# grub-mknetdir --debug --net-directory=/srv/tftp --subdir=netboot/grub
Netboot directory for i386-pc created. Configure your DHCP server to point to /srv/tftp/netboot/grub/i386-pc/core.0
Netboot directory for i386-efi created. Configure your DHCP server to point to /srv/tftp/netboot/grub/i386-efi/core.efi
Netboot directory for x86_64-efi created. Configure your DHCP server to point to /srv/tftp/netboot/grub/x86_64-efi/core.efi
The TFTP module requests block size of 1024 bytes. It is a constant value in the source code and cannot be changed.
:: ruuning early hook [udev]
Starting systemd-udevd version ...
:: running hook [udev]
:: Triggering uevents...
:: running hook [net_nfs4]
IP-Config: eth0 hardware address .... mtu 1500 DHCP RARP
IP-Config: eth1 hardware address .... mtu 1500 DHCP RARP
If the client hardware has two or more network devices then it has been observed
that the order in which they are selected could change between each boot.
Therefore, manually assign the device to be used in grub.cfg kernel options.
For example, ip=:::::eth1:dhcp
.
If using an Intel CPU and patching it with intel-ucode.img
, ensure that it is the first parameter in initrd
: initrd /boot/intel-ucode.img
.
If the root filesystem is on a LV, ensure the kernel parameter root
points to the mapped LV name: root = /dev/mapper/<lvg-lv-name>
. This should be handled by GRUB automatically, however, there seems to be a bug; GRUB refuses to use the UUID and instead uses the /dev/mapper
path even if GRUB_DISABLE_LINUX_UUID=false
or commented out.
Available modules are found in the GRUB installed subfolder i386-pc
and x86_64-efi
.
- If enabling BIOS and UEFI boot mode, ensure
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
. - If installing grub package from an existing Arch Linux:
pacman --root "/mnt" --dbpath "/mnt/var/lib/pacman" -S grub
.
- systemd
GRUB_CMDLINE_LINUX="luks.uuid=<uuid> luks.name=x luks.options=discard rw"
- The luks.uuid could be prefixed with
rd
likerd.luks.uuid
, which saves the UUID only duringinitrd
. - The
luks.name=x
serves the same function asudev :x
, which is, the name of the/dev/mapper
given to the device after decryption.
- The luks.uuid could be prefixed with
- udev
GRUB_CMDLINE_LINUX="cryptodevice=/dev/by-uuid/<uuid>:x rw"
- The
:x
serves the same function as systemdluks.name=x
, which is, the name of the/dev/mapper
given to the device after decryption.
- The
- Generate configuration file
# grub-mkconfig -o /boot/grub/grub.cfg
.
Error | Cause | Remedy |
---|---|---|
Failed to connect to lvmetad [file, directory, socket] |
The error message alerts the user that the LVM cache will not be used and a new scan will be performed. This should not affect grub-mkconfig . Problem occurs due to running grub-mkconfig in chroot . |
The warning could be silenced by setting use_lvmetad=1 to use_lvmetad=0 in /etc/lvm/lvm.conf . |
error: no suitable video mode found Booting in blind mode
|
insmod efi_gop insmod font
|
grub> ls -l
grub> set root=(hd0,5)
grub> linux ($root)/boot/vmlinuz root=/dev/sda1
grub> initrd ($root)/boot/initramfs-linux.img
grub> boot
# When booted successfully, to permanently assign the linux and initrd values
...