How to Recover or Rescue Corrupted Grub Boot Loader in CentOS 7

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

17 Responses

  1. Omar says:

    I keep getting the error ‘Welcome to emergency mode!‘ whenever I start my centos7 on my virtual box. I welcome your assistance.

  2. Gary says:

    I completed the steps listed here successfully. The only addition was that I had to manually mount /boot and /boot/efi.

    I ran grub2-install /dev/sda and grub2-install /dev/sdb (I have RAID1 for /boot and manually cloned /boot/efi).

    I got no errors, but when I try to reboot it just returns to the grub> prompt

  3. Vasu Upputuri says:

    After installing Grub if you don’t find the file “/boot/grub2/grub.cfg” then run the command grub2-mkconfig --output=/boot/grub2/grub.cfg which will automatically make grub.cfg with existing Linux images on the system.

    • Ravi Saive says:

      @Vasu,

      Thanks for sharing the tip with us, hope this will help other users who are unable to find grub.cfg file in Linux.

    • Partha says:

      Hi Vasu,

      I followed the steps, exited from console and while reboot i removed the CentOS DVD and now i am getting following error

      error: no such devices: 3fda0d3e-xxxx-xxxxx-xxxxx
      Entering rescue mode...
      grub rescue>
      

      Please can you help me how do i go from here?

      Thanks
      Partha

  4. Partha says:

    I am not able to recover my VM (Centos-7.1) . I followed the steps and after reboot i see grub>

    Can any one please help me

    Regards
    Partha

  5. Vishal Yadav says:

    I was unable to recover my centos 7 VM on VirtualBox following above steps. Though grub2-install was successful it goes to grub> prompt after reboot.

  6. Richard says:

    I think I found the fix for this!

    https://bugzilla.redhat.com/show_bug.cgi?id=1101352

    Short answer: “Looks like this is intentional to avoid the fallout of unsuspecting users running grub2-install. To regain ability to grub2-install on EFI, install package grub2-efi-modules.”

    • Mike Robinson says:

      Thanks Richard. I’ve installed grub2-efi-modules on my Centos 7.5 server. Let’s hope I never have to use the recovery procedure.

      Incidentally, I discovered that removing a working Centos 7 server drive from a laptop for a short period of time can cause the boot sector to become corrupted.

      You can read about my experience and the on-going saga at https://www.centos.org/forums/viewtopic.php?f=47&t=67772

  7. Mike Robinson says:

    The method for fixing a bad boot sector clearly doesn’t work in Centos 7.5. I’m getting the same results as Vijay.

    The /usr/lib/grub/ directory on my server contains another directory: /i386-pc. There is no /x86_64.efi directory anywhere on the server.

    Where is the author? Missing in action?

    You will be wasting your time if you follow the author’s instructions for repairing a bad boot sector.

  8. vijay says:
    # chroot /mnt/sysimage
    # lsblk
    

    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 238.5G 0 disk
    sda1 8:1 0 120M 0 part /boot/efi
    sda2 8:2 0 180G 0 part /
    sda3 8:3 0 14G 0 part [SWAP]
    sda4 8:4 0 43G 0 part /home

    # /sbin/grub2-install /dev/sda
    

    I am getting error like:

    /sbin/grub2-install: error : /usr/lib/grub/x86_64.efi/modinfo.sh doesn't exist. Please specify --target or --directory

    Can you please tell me what I need to do for this error

  9. Jamie says:

    Hey. Great article. Almost perfect but when I get to the grub2-install step it doesn’t work. It says only grub2-macbless in the list instead of all the ones you list. I tried reinstalling the grub files but it says there is an error with YUM on YumMain line 28 not found. Any ideas on what this is?

    • Chris says:

      It sounds like you didn’t successfully chroot to /mnt/sysimage?

      • Mike Robinson says:

        chroot doesn’t fix the problem.

        It sounds like there may be more than one reason why a Centos 7 system that has been operating successfully for several years suddenly decides not to boot up again. This article doesn’t consider any alternatives.

Leave a Reply to Ravi Saive Cancel reply

Your email address will not be published. Required fields are marked *

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