Fixing Grub2 on Centos 7

Grub2 is a very frustrating bootloader esp. when it fails. Here are some of things I have tried that have worked in the past related to Grub2 errors.

Symptom – System starts into Grub2 prompt or simply does not start.

This happened to me recently when yum package update broke something in Grub. The system was booting into Grub2 prompt. This happened on my system because of bad grub.cfg file. Assuming you still have a valid backup of this file available, you can follow the steps below:

1. Type commands

insmod normal
normal

2. The root directory should be automatically set to your EFI partition and Prefix should be set to the EFI folder. Then find out a valid backup file for grub.cfg in /efi/centos. For me it was, grub.cfg.1509824788.rpmsave

3. Issue command

configfile /efi/centos/grub.cfg.1509824788.rpmsave

4. You should now be able to see the Grub2 boot menu. Just select a valid entry and system should boot normally

5. Once in, overwrite the grub.cfg file with the backup file you used to boot. Reboot and hopefully you should be booting normally

Alternatively, if you have Centos7 Live USB, you can skip Steps 1-4. Boot into rescue mode. Then chroot into your root partition (chroot /mnt/sysimage). Once done simply replace grub.cfg file with a backup file (Step 5) above.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.