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
What I did to fix it is:
- Boot up a rescue USB, mount the required partitions and chroot.
- Add a DNS server:
$ echo "nameserver *.*.*.*" >> /etc/resolv.conf
- Enable networking using ifconfig (in my case it was already enabled).
- Install some additional grub2 modules:
$ yum install grub2-efi-modules
- Reinstall grub, read “/etc/fstab” or “lsblk” command to find it:
$ /sbin/grub2-install /dev/boot/partition
- Reinstall grub:
$ yum reinstall grub-efi shim
- Rebuild grub.cfg file:
$ grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg