Wednesday, January 18, 2017

Workaround for broken UEFI boot entries

UEFI Boot caveats

On some broken BIOSes like the HP Compaq Pro 6300, UEFI is fundamentally broken, and only allows for one UEFI boot manager from disk. The last written EFI loader will always take presedence, and if the .efi file referenced is deleted, it will not load the fallback loader /EFI/Boot/BOOTX64.EFI

When changing from BIOS from Legacy to UEFI, IPv4 PXE boot option may disappear
File > Apply Defaults and Exit (to fix)

After installing windows 7 with this command
bcdboot c:\windows /l en-us /s s: /f UEFI

The EFI boot files are created (does not overwrite existing files though) AND registered in UEFI boot menu (eg embedded into BIOS)
/EFI/Boot/BOOTX64.EFI
/EFI/Microsoft/Boot/bootmgfw.efi

The Second EFI is registered as Windows Boot Manager in the BIOS Boot menu

with my grub setup if I move the file
/EFI/Microsoft/Boot/bootmgfw.efi > /EFI/Microsoft/win7/bootmgfw.efi

This is now broken and will not boot

It can be fixed by reset BIOS
F10 to boot BIOS
File > Apply Defaults and Exit (to fix)
F10 to boot BIOS
Change settings from legacy to UEFI

this will reset the Boot menu and default to (fallback boot loader)
/EFI/Boot/BOOTX64.EFI

(another way is bcdedit /enum firmware - however must mount ESP)
eg bcdedit /store newBCD /delete {guid}
  bcdedit /import newBCD /clean


Additional programs are
- Visual BCD Editor
- BootICE
- efibootmgr (linux)
  efibootmgr -v
  sudo efibootmgr -b # -B (delete entry #)
- from reFINd / EFI2 shell
  bcfg boot dump -v
  bcfg boot rm 3 (if entry if #3 in list)