- 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 |