another meaningless subtitle

CentOS 7: failed to open \efi\centos\grubx64.efi

· by mafio · Read in about 1 min · (112 Words)
CentOS 7 EFI grub2

For some reason one of my CentOS 7 boxes decided to nuke itself yesterday, when I powered it on it prompted me with the following error: failed to open \efi\centos\grubx64.efi.
What I did to fix it is:
1. Boot up a rescue USB, mount the required partitions and chroot.
2. Add a DNS server:

$ echo "nameserver *.*.*.*" >> /etc/resolv.conf

3. Enable networking using ifconfig (in my case it was already enabled).
4. Install some additional grub2 modules:

$ yum install grub2-efi-modules

5. Reinstall grub, read /etc/fstab or lsblk command to find it:

$ /sbin/grub2-install /dev/boot/partition

6. Reinstall grub:

$ yum reinstall grub-efi shim

7. Rebuild grub.cfg file:

$ grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg