When a Linux system powers on, the very first program it executes is the bootloader. Its primary role is to initialize hardware and load the Linux kernel—the core of your operating system. GRUB (Grand Unified Bootloader) is the most widely used bootloader in Linux environments. In this guide, we’ll walk through installing, configuring, and troubleshooting GRUB on CentOS Stream systems.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- A CentOS installation ISO on USB, CD, or DVD
- Familiarity with basic Linux commands and partitioning
- Backup of important data before making bootloader changes
1. Boot into Rescue Mode
- Insert your CentOS installation media and boot from it.
- At the menu, select Troubleshooting.
- Choose Rescue a CentOS Stream System.
/mnt/sysroot:
2. Generate a New GRUB Configuration
Inside thechroot, generate a fresh GRUB config file:
| System Type | Command |
|---|---|
| BIOS-based | grub2-mkconfig -o /boot/grub2/grub.cfg |
| EFI-based | grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg |
3. Install GRUB to the Disk
First, identify your boot disk:/dev/sda (or your boot disk):
On EFI systems, reinstall the GRUB EFI packages instead of
grub2-install:4. Exit Rescue and Reboot
Leave the chroot and reboot into your system’s internal disk:5. Edit GRUB Defaults
After a successful reboot, open/etc/default/grub to adjust boot settings. For example, to set the GRUB menu timeout:
GRUB_TIMEOUT=1), then save and exit (:wq).
6. Regenerate and Apply the GRUB Configuration
After editing defaults, regenerate the config:| System Type | Command |
|---|---|
| BIOS-based | sudo grub2-mkconfig -o /boot/grub2/grub.cfg |
| EFI-based | sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg |