Troubleshooting & How-Tos

Repair missing UEFI entry for Fedora Linux

After a windstorm led to multiple power dropouts*, I found that my computer would no longer boot to Fedora. It booted to Windows still, but wouldn’t load GRUB.

Fixing it was confusing, because it wasn’t clear where the problem was. I found lots of references to how to reinstall GRUB2 or how to regenerate a GRUB boot menu (which you can fix by booting to a live USB stick and mounting the system image or using specialized recovery tools like this guide to using boot repair at TechRepublic), and lots of references to how to modify a Windows boot menu (depending on whether you are using UEFI or MBR), and so on, but the problem turned out to be that the UEFI firmware had lost the menu item, so it wouldn’t load GRUB, so GRUB couldn’t load Fedora.

I used Fedora’s guide to reinstalling GRUB to add back that missing menu item:

  • Boot to a Fedora Live image off of USB in UEFI mode.
  • efibootmgr -v to see if there was actually a boot entry in the firmware for Linux. (There wasn’t. Only an entry for Windows. Which I’d managed to accidentally rename as Linux somehow, but it was pointing to the \EFI\Microsoft\Boot\bootmgfw.efi file, which is why the system was able to boot to Windows.)
  • Use the Gnome Disks tool to identify which partition on which disk has the EFI boot system.
  • Create a new entry pointing to the shim.efi in the Fedora folder.
    sudo efibootmgr -c -w -L Fedora -d /dev/sdb -p 1 -l /EFI/fedora/shim.efi
    -L is a label, which you can assign whatever you want.
    -d is the disk with the EFI partition.
    -p is the number of the EFI partition.
  • Make sure you write the path to shim.efi in UNIX style (/), even though EFI stores DOS-style paths (), or you’ll end up with it trying to point to EFIfedorashim.efi, which still won’t work!
  • efibootmgr -v again to make sure the entry is present and points to the actual file (it should point to \EFI\fedora\shim.efi now).