💾 Archived View for hyperborea.org › tech-tips › fix-uefi.gmi captured on 2024-06-16 at 12:17:57. Gemini links have been rewritten to link to archived content
View Raw
More Information
⬅️ Previous capture (2022-04-28)
➡️ Next capture (2024-08-31)
-=-=-=-=-=-=-
🖥️ 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), 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.
This is how I added 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).
- I forgot that I’d left the computer on sleep mode instead of turned off all the way. After one of the outages it must have turned on — I’m not sure exactly, since I was in another room, but I came back in and it was on, stuck with the drive light active, unresponsive, while the room lights flickered repeatedly. I shut it off completely and didn’t turn it back on until the wind died down and the power settled out.
—Kelson Vibber, 2021-01-26
Web Edition
Tech Republic: How to Repair the Grub2 Boot Loader on Linux
Fedora Documentation: Reinstalling GRUB
More Tips
Fediverse: KelsonV@Wandering.shop