Boot Loader on BIOS-Based RHEL 8 Systems
Quick navigation
- Quick navigation
- 1. The main idea
- 2. BIOS, MBR, and GRUB2
- 3. The RHEL 8 boot sequence
- 4. Important GRUB2 files
- 5. Changing the GRUB2 configuration
- 6. Managing BLS boot entries
- 7. Using
grubby - 8. Reinstalling GRUB2 in rescue mode
- 9. Early kdump
- 10. Short summary
1. The main idea
On a BIOS-based RHEL 8 system, the boot chain is:
BIOS → MBR → GRUB2 → kernel + initramfs → systemd → default target
Each component starts the next one. Therefore, the location of a failure helps identify what must be repaired.
2. BIOS, MBR, and GRUB2
When the machine starts, BIOS performs a Power-On Self-Test (POST), initializes critical hardware, and looks for a bootable disk containing a Master Boot Record (MBR). BIOS loads the first part of GRUB2 from the disk and gives it control.
The MBR is only 512 bytes:
- It contains the disk partition table.
- Only about 446 bytes remain for boot-loader code.
- Additional GRUB2 modules are therefore stored in the MBR gap, between the MBR and the first partition.
The MBR gap should be at least 31 KiB. RHEL installations created by Anaconda normally start the first partition at sector 2048, leaving a 1 MiB gap, which is sufficient for GRUB2.
GRUB2 can store its first stage either in the disk’s MBR or in the first sector of a partition marked as bootable.
3. The RHEL 8 boot sequence
- BIOS runs POST and initializes critical hardware.
- BIOS searches the configured disks for a bootable MBR.
- BIOS finds GRUB2 and passes control to it.
- GRUB2 reads
/boot/grub2/grub.cfgand displays the boot menu. - GRUB2 loads the selected kernel and its
initramfsinto memory. - GRUB2 passes control, kernel arguments, and the
initramfslocation to the kernel. - The kernel uses drivers from
initramfs, initializes critical hardware, and starts/sbin/initas PID 1. On RHEL 8,/sbin/initlinks tosystemd. - The initial
systemdstartsinitrd.targetand mounts the real root file system at/sysroot. - The kernel switches from the temporary
initramfsroot to the real root file system.systemdthen re-executes itself from the real system. systemdactivates the default target and resolves unit dependencies.- The system reaches its intended state and presents a text or graphical login.
The initramfs is a small temporary file system containing the drivers and kernel modules needed to find and mount the real root file system.
4. Important GRUB2 files
| Path | Purpose |
|---|---|
/boot/ |
Stores kernels and initial RAM file systems. |
/boot/grub2/ |
Stores BIOS GRUB2 configuration and extension modules. |
/boot/grub2/grub.cfg |
Generated main configuration file for a BIOS system. |
/etc/grub2.cfg |
Symbolic link to the BIOS grub.cfg. |
/etc/grub.d/ |
Contains helper scripts used to generate grub.cfg. |
/etc/default/grub |
Contains variables used during configuration generation. |
/boot/grub2/grubenv |
A 1 KiB environment file containing values such as the saved or default entry. |
/boot/efi/EFI/redhat/grub.cfg |
GRUB2 configuration path on a UEFI system. |
Normally, do not edit grub.cfg directly. It is generated automatically and may be replaced after a kernel or configuration update.
5. Changing the GRUB2 configuration
Common variables in /etc/default/grub include:
GRUB_TIMEOUT— seconds before GRUB2 starts the default entry automatically.GRUB_DEFAULT— default menu entry; entry numbering starts at0.GRUB_CMDLINE_LINUX— kernel arguments added to every Linux boot entry.
After changing /etc/default/grub, regenerate the BIOS configuration:
grub2-mkconfig -o /boot/grub2/grub.cfg
This command combines the variables in /etc/default/grub with the scripts in /etc/grub.d/ and writes a new grub.cfg.
6. Managing BLS boot entries
The Boot Loader Specification (BLS) stores each boot entry in a separate drop-in file. This allows kernels and boot-menu entries to be added or removed without directly rewriting the main GRUB2 configuration.
To enable BLS configuration, add this setting to /etc/default/grub:
GRUB_ENABLE_BLSCFG=true
Regenerate the BIOS GRUB2 configuration:
grub2-mkconfig -o /boot/grub2/grub.cfg
Create the BLS entry for the currently running kernel:
kernel-install add "$(uname -r)" "/lib/modules/$(uname -r)/vmlinuz"
The resulting boot-entry files are stored under /boot/loader/entries/.
7. Using grubby
grubby is a convenient wrapper for managing BLS and kernel boot entries.
# Show the default kernel
grubby --default-kernel
# Show the index of the default entry
grubby --default-index
# List all kernel menu entries
grubby --info=ALL
# Display one specific entry
grubby --info /boot/vmlinuz-<kernel-version>
# Make a kernel the persistent default
grubby --set-default /boot/vmlinuz-<kernel-version>
Use grubby when you need to inspect entries, select the default kernel, or persistently add or remove kernel arguments.
8. Reinstalling GRUB2 in rescue mode
Reinstall GRUB2 when the MBR or MBR gap is damaged. If the installed system cannot boot, use a RHEL installation source or PXE rescue environment.
- Boot from the installation source.
- Select Troubleshooting → Rescue a Red Hat Enterprise Linux system, or append
inst.rescueto the boot command line. - Select the option that mounts the installed system under
/mnt/sysroot. -
Switch into the installed system:
chroot /mnt/sysroot -
Reinstall GRUB2 on the boot disk:
/sbin/grub2-install /dev/vda - Reboot and verify that GRUB2 loads correctly.
/dev/vdais only an example. Always identify the actual boot disk before runninggrub2-install; specify the whole disk, not a partition.
9. Early kdump
Traditional kdump might start too late to capture a crash that occurs during the early boot process. RHEL 8 provides early kdump for this situation.
Early kdump places the crash kernel and its initramfs inside the normal booting kernel’s initramfs. During early boot, they are loaded into the memory reserved with crashkernel, making it possible to capture an early kernel crash dump.
The required early-kdump dracut modules are provided by the kexec-tools package.
10. Short summary
| Situation | Correct action or location |
|---|---|
| Change global GRUB2 settings | Edit /etc/default/grub. |
| Apply changed settings on BIOS | Run grub2-mkconfig -o /boot/grub2/grub.cfg. |
| Inspect kernel boot entries | Use grubby --info=ALL. |
| Change the default kernel | Use grubby --set-default .... |
| Manage separate boot entries | Use BLS files under /boot/loader/entries/. |
| Repair a damaged MBR or MBR gap | Enter rescue mode, chroot /mnt/sysroot, and run grub2-install on the boot disk. |
| Investigate a crash during early boot | Use early kdump support. |
The safest mental model is simple: edit the source configuration, regenerate the generated file, and reinstall GRUB2 only when its disk-level boot code is damaged.