• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

RHEL7/CentOS 7 – Recover/Reinstall GRUB2 with UEFI

May 31, 2018 By Cloud_Devops 7 Comments

This article will provide the step by step procedure to recover the GRUB RHEL7 / CentOS7 which uses UEFI. In last article, we have demonstrated the BIOS-based system’s GRUB recovery.  The newer system ships with UEFI firmware and here is the way to identify BIOS vs UEFI on Linux servers.  To recover GRUB2 on RHEL7 /CentOS 7 with UEFI, you must have the latest DVD or ISO image to boot the system in rescue mode.

 

When the EFI based VM or Server is not booting in hard drive, you will get below message or it will be stuck in GRUB.

UEFI - GRUB Corrupted
UEFI – GRUB Corrupted

 

Reinstalling grub2 on UEFI-based machines:

 

1. Boot the system using RHEL/CentOS latest DVD.

 

2. Once the system is booted from DVD, select “Troubleshooting” – >  Select Rescue a Redhat Enterprise Linux.

Rescue a Red hat Enterprise Linux
Rescue a Red Hat Enterprise Linux

 

3. Select Continue to mount the image under /mnt/sysimage.

Continue - Rescue Mode - RHEL
Continue – Rescue Mode – RHEL

 

4. chroot to the OS image.

chroot to OS Image - RHEL
chroot to OS Image – RHEL

 

5. Tried to list the EFI contents from the boot partition.  Here, efi directory looks empty.

List the EFI directory contents
List the EFI directory contents

 

6. Let’s restore the GRUB2 by re-installing grub2-efi and shim packages.

Reinstall grub2-efi and shim
Reinstall grub2-efi and shim

 

In Rescue mode, your system may not be able to communicate with the network. You could quickly configure local repo using the booted DVD like below if you need repo.

mount the DVD and configure REPO

    mount the DVD and configure REPO

 

7. Once the packages are reinstalled, please navigate to the “efi” directory and check it’s content.

efi directory restored - GRUB2
efi directory restored – GRUB2

 

8. Regenerate the grub.cfg file.

Restore grub.cfg
Restore grub.cfg

 

9. If SELINUX is enabled on the system, please create the “autorelabel” file.

SeLinux- Autorelabel
SeLinux- Autorelabel

 

10. Exit from chroot and reboot the system.

Filed Under: CentOS, RHEL7 Tagged With: CentOS7, RHEL7

Reader Interactions

Comments

  1. sherif says

    July 11, 2021 at 5:52 pm

    if i booted from live cd you mount : as mount /dev/cdrom /mnt

    but how to do so if i booted from a bootable device usb.

    Reply
  2. Marco says

    March 13, 2020 at 8:17 pm

    Tnx for the Guide! Really helped me!

    Reply
  3. Rich says

    September 25, 2019 at 6:28 pm

    Didn’t work for me. The grub.cfg file was installed properly, but there has never been a /usr/lib/grub/x86_64-efi directory.

    grub2-install warnings:
    this GPT partition label contains no BIOS Boot Partition: embedding won’t be possible
    Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged…
    error: will not proceed with blocklists

    Reply
    • Rich says

      September 25, 2019 at 6:30 pm

      I have to add this feedback for grub2-install:

      Installing for i386-pc platform.

      Reply
  4. Chris says

    March 21, 2019 at 7:17 pm

    Does your article assume there is already a /boot/efi partition available?

    How can I do this when the /boot and /boot/efi partitions were on a separate disk which failed?

    I add a new replacement disk /dev/sda. Should I partition this first? Or can I run grub2-install /dev/sda and resolve the efi issue afterwards? If so, how?

    Reply
    • Lingeswaran R says

      March 22, 2019 at 10:51 am

      This article talks about fixing the corruption (which means partition already exists). If you wanna install grub on a new disk, you must create the required partition first before running the command.

      Lingesh

      Reply
  5. David Morgan says

    February 6, 2019 at 1:01 am

    I am forever grateful and indebted to you. Thanks so much

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version