User Tools

Site Tools


linux:system:disk:laptop-uefi-grub-fix

Fix EFI boot manager ignores boot order

Problem

Boot order cannot be altered by “efibootmgr”. After rebooting Windows 10 is again the first OS that is booted. This problem is caused by laptop UEFI firmware which hardcoded looks for: /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.

Fix

Step 1: replace bootmgfw.efi

cd /boot/efi/EFI/Microsoft/Boot
mv bootmgfw.efi bootmgfw.original.efi
cp /boot/efi/EFI/debian/grubx64.efi ./bootmgfw.efi

Step 2: Make Grub enry for original bootmgfw.efi Problem with this is that the Windows 10 entry in the grub boot menu is now also pointing to a grubx64.efi copy. Looping into grub again when you select “Windows 10”. So we need to make an extra grub menu entry pointing to the original bootmgfw.efi

nano /etc/grub.d/40_custom

Add the following to the bottom of the file:

menuentry 'Windows 10-fix' {
  search --fs-uuid --no-floppy --set=root 502B-5BC6
  chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.original.efi
}

Where 502B-5BC6 is obtained from finding the EFI partition with fdisk -l and the UUID with blkid:

fdisk -l

Device         Start       End   Sectors  Size Type
/dev/sda1       2048    534527    532480  260M EFI System
/dev/sda2     534528    567295     32768   16M Microsoft reserved
/dev/sda3     567296  99554804  98987509 47.2G Microsoft basic data
/dev/sda4  248051712 250058751   2007040  980M Windows recovery environment
/dev/sda5   99555328  99557375      2048    1M BIOS boot
/dev/sda6   99557376 239837183 140279808 66.9G Linux filesystem
/dev/sda7  239837184 248051711   8214528  3.9G Linux swap

blkid /dev/sda1
/dev/sda1: UUID="502B-5BC6" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="91ffaa62-7eed-  4257-99f0-1d5ce807e80f"

Update grub on disk

update-grub
linux/system/disk/laptop-uefi-grub-fix.txt · Last modified: by 127.0.0.1