Fixing the EFI bootloader on CentOS 7

     

I’m told that Grub has been rebuilt and Shim has been re-signed with 7.4 so that might be the cause, but to me this is what a new VM looks like after being copied from the template disk:

For the googlers:

Failed to open \EFI\BOOT\grubx64.efi – Not Found
Failed to load image \EFI\BOOT\grubx64.efi: Not Found
start_image() returned Not Found

You might try to reinstall Grub2 and stuff but to me that didn’t work. I knew the OS is perfectly operable coz the Super Grub2 Disk boots it just fine. Just select shim.efi and you have your VM up and running.

Then I stumbled upon efibootmgr. To manually add an EFI entry to your system bootloader:

efibootmgr --create --label CentOS --disk /dev/sda1 --loader "\EFI\centos\shim.efi"

Where /dev/sda1 corresponds to /boot/efi. You can check if the IDs match correctly with blkid and efibootmgr --verbose. You should be able to see this new entry under your VM’s settings as well:

Why it worked automatically on anything prior to 7.4 is beyond me though.