UEFI-Based Boot Loader RHEL 8 family Systems
Quick navigation
- Quick navigation
- 1. UEFI basics
- 2. UEFI and Secure Boot chain
- 3. Important GRUB2 differences: BIOS vs UEFI
- 4. Managing UEFI boot targets
- 5. Generating Boot Loader Specification entries
- 6. Managing kernel entries with
grubby - 7. Repairing GRUB2 on a UEFI system
- Quick summary
1. UEFI basics
UEFI replaces the legacy BIOS boot method. It supports modern hardware, disks larger than 2 TiB, and GPT partitioning.
Unlike BIOS, which searches disks for boot code, UEFI stores registered boot targets in firmware memory (NVRAM). Each target points to an EFI application on the disk.
For GRUB2 to boot in UEFI mode, the system needs an EFI System Partition (ESP):
- Formatted with a FAT file system
- Normally mounted at
/boot/efi - Recommended size: 512 MiB
- Usually created automatically by the Anaconda installer
2. UEFI and Secure Boot chain
With Secure Boot enabled, each boot component must be trusted and correctly signed.
The normal boot chain is:
- UEFI firmware starts
shim.efi. shim.efi, signed with a key trusted by the firmware, loadsgrubx64.efi.- GRUB2 loads the selected kernel and initramfs.
- The kernel starts
systemd, which brings the system to the configured target.
Additional keys can be built into shim or stored as Machine Owner Keys (MOK) in NVRAM. If a required key is missing, MokManager.efi can be used to enroll it.
If no normal boot entry exists, UEFI can start the fallback application:
/boot/efi/EFI/BOOT/BOOTX64.efi
It loads fallback.efi, which uses /boot/efi/EFI/redhat/BOOT.CSV to register shim.efi and boot the system.
3. Important GRUB2 differences: BIOS vs UEFI
| Component | BIOS system | UEFI system |
|---|---|---|
| Partitioning | MBR commonly used | GPT recommended |
| Boot source | Boot code in MBR | EFI application on ESP |
| GRUB2 directory | /boot/grub2/ |
/boot/efi/EFI/redhat/ |
| GRUB configuration | /boot/grub2/grub.cfg |
/boot/efi/EFI/redhat/grub.cfg |
| Configuration link | /etc/grub2.cfg |
/etc/grub2-efi.cfg |
| Kernel commands | linux16, initrd16 |
linuxefi, initrdefi |
grub2-mkconfig detects the firmware type and generates the appropriate commands automatically.
Critical warning: Do not use
grub2-installto repair GRUB2 on a UEFI system. It creates a generic, unsignedgrubx64.efi, registers the wrong boot target instead ofshim.efi, and can prevent a Secure Boot system from starting.
4. Managing UEFI boot targets
The efibootmgr utility reads and modifies boot entries stored in UEFI NVRAM. Root privileges are required for changes.
View the current boot order
efibootmgr
Important fields:
BootCurrent— entry used for the current bootBootOrder— order in which entries are triedBoot0003*— an individual active entry; the number is hexadecimal
Display each entry’s disk, partition, and EFI file:
efibootmgr -v
Delete an entry
Delete entry Boot0004:
efibootmgr -b 4 -B
Select a target for the next boot only
Boot from Boot0002 once without changing the permanent order:
efibootmgr -n 2
Create a new entry
Create an entry named LAB for an EFI application on partition 2 of /dev/sda:
efibootmgr -c -d /dev/sda -p 2 -L "LAB" -l '\EFI\LAB.efi'
The EFI application path must use backslashes.
5. Generating Boot Loader Specification entries
RHEL like systems can store kernel-specific Boot Loader Specification (BLS) entries in /boot/loader/entries/.
-
Enable BLS in
/etc/default/grub:GRUB_ENABLE_BLSCFG=true -
Regenerate the UEFI GRUB2 configuration:
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg -
Generate an entry for the running kernel:
kernel-install add "$(uname -r)" "/lib/modules/$(uname -r)/vmlinuz"
6. Managing kernel entries with grubby
On UEFI systems, run grubby as root.
Show the default kernel:
grubby --default-kernel
Show its menu index:
grubby --default-index
Persistently select another default kernel:
grubby --set-default /boot/vmlinuz-<kernel-version>
List all kernel menu entries:
grubby --info=ALL
Inspect one kernel entry:
grubby --info /boot/vmlinuz-<kernel-version>
7. Repairing GRUB2 on a UEFI system
Use this sequence when EFI boot files or grub.cfg are damaged or missing.
Step 1: Confirm the ESP
Verify that the EFI System Partition exists, is formatted with FAT, and is mounted at /boot/efi.
Step 2: Reinstall the signed EFI components
yum reinstall grub2-efi shim
This restores the trusted GRUB2 and shim files under /boot/efi.
Step 3: Regenerate the UEFI GRUB2 configuration
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
Step 4: Verify the firmware entry
efibootmgr -v
Quick summary
- Verify that the machine was booted in UEFI mode.
- Confirm that
/boot/efiis mounted and contains the RHEL EFI files. - Inspect NVRAM entries with
efibootmgr -v. - Reinstall
grub2-efiandshimif EFI files are missing or damaged. - Regenerate
/boot/efi/EFI/redhat/grub.cfg. - Inspect kernel entries with
grubby --info=ALL. - Do not run
grub2-installon a UEFI system. - On a UEFI system, boot repair is not about rewriting an MBR. The important pieces are the FAT-formatted ESP, signed
shimand GRUB2 applications, the UEFI NVRAM boot entry, the UEFI-specificgrub.cfg, and valid kernel/BLS entries.