Chapter 15. Reinstalling GRUB
Reinstall the GRUB boot loader to resolve issues caused by incorrect installation, missing files, or system corruption. Reinstalling GRUB is also necessary when upgrading packages, adding boot information to another drive, or restoring control over installed operating systems.
GRUB restores files only if they are not corrupted.
15.1. Reinstalling GRUB on BIOS-based machines Copy linkLink copied to clipboard!
To ensure your BIOS-based system remains functional at startup, reinstall the GRUB boot loader on the system after updating GRUB packages.
This overwrites the existing GRUB to install the new GRUB. Ensure that the system does not cause data corruption or boot crash during the installation.
Procedure
Install
grub2-pc:# grub2-pcReinstall GRUB on the device where it is installed. For example, if
sdais your device:# grub2-install /dev/sdaReboot your system for the changes to take effect:
# rebootSee the
grub2-pc(8)man page on your system for more information.
15.2. Reinstalling GRUB on UEFI-based machines Copy linkLink copied to clipboard!
To resolve boot issues, reinstall the GRUB boot loader on your UEFI-based system.
Ensure that the system does not cause data corruption or boot crash during the installation.
Procedure
Reinstall the
grub2-efiandshimboot loader files:# dnf reinstall grub2-efi-x64 shimReboot your system for the changes to take effect:
# reboot
15.3. Reinstalling GRUB on IBM Power machines Copy linkLink copied to clipboard!
To maintain system bootability on IBM Power systems, reinstall the GRUB boot loader on the Power PC Reference Platform (PReP) boot partition after updating GRUB packages.
This overwrites the existing GRUB to install the new GRUB. Ensure that the system does not cause data corruption or boot crash during the installation.
Procedure
List the disk partition that stores GRUB:
# bootlist -m normal -osda1Reinstall GRUB on the disk partition:
# grub2-install partitionReplace
partitionwith the identified GRUB partition, such as/dev/sda1.Reboot your system for the changes to take effect:
# rebootSee the
grub-install(1)man page on your system for more information.
15.4. Resetting GRUB Copy linkLink copied to clipboard!
To fix boot failures caused by corrupted files or invalid configurations, reset GRUB. This process removes current settings and reinstalls the boot loader with default values.
The following procedure will remove all the customization made by the user.
Procedure
Remove the configuration files:
# rm /etc/grub.d/* # rm /etc/sysconfig/grubReinstall packages.
On BIOS-based machines:
# dnf reinstall grub2-pc grub2-toolsOn UEFI-based machines:
# dnf reinstall grub2-efi shim grub2-tools grub2-common
Rebuild the
grub.cfgfile for the changes to take effect:# grub2-mkconfig -o /boot/grub2/grub.cfgThis applies to both, BIOS and UEFI based systems.
WarningThe path to rebuild
grub.cfgis same for both BIOS and UEFI based machines. Actualgrub.cfgis present at BIOS path only. The UEFI path has a stub file that must not be modified or recreated usinggrub2-mkconfigcommand.-
Follow Reinstalling GRUB procedure to restore GRUB on the
/boot/partition.