Linux and Windows Dual-Boot Bootloader Override Issue

This article describes a way to address the problem of the firmware repeatedly setting “Windows Boot Manager” as the first boot option. It uses UEFI’s automatic recognition of `EFI/Microsoft/Boot/bootmgfw.efi`: first, back up the original Windows boot file, then copy the grub EFI file and rename it to `bootmgfw.efi`, so the system enters grub first. Next, modify the grub configuration in Linux to point Windows’ chainloader entry to the backed-up original EFI file. This way, even if Windows Boot Manager remains first in the boot order, the system enters grub first and can then boot Windows or Linux as usual.

Contents

Principle

Both UEFI firmware and Windows recognize this file:

EFI/Microsoft/Boot/bootmgfw.efi

Often, they have not actually “remembered an old boot entry.” Instead, each time the computer starts and scans this file, it creates a new Windows Boot Manager.

Since it insists on booting this file, the approach is simple:

  • Back up the original Windows boot file
  • Copy the GRUB EFI file over
  • Rename it to the original Windows EFI filename

That way, even if Windows Boot Manager continues to stay at the top of the boot order, what it actually boots is GRUB.

Then, in GRUB, change the Windows chainloading path to point to the original Windows EFI file you just backed up, and Windows will boot normally.


Steps

1)Enter PE and mount the EFI partition

After entering PE, mount the EFI partition and go to the directory:

EFI/Microsoft/Boot/

Find the original Windows boot files:

bootmgfw.efi

First make a backup and save it under a different name.
For example, I’ll rename it to:

bootmgfw.efi.bak

Then copy the EFI file corresponding to GRUB into this directory and rename it to:

bootmgfw.efi

That is, have grub replace the original Windows Boot Manager.


2) Booting Windows Boot Manager directly at this point will take you to grub

After completing this step, either of these boot entries:

  • Windows Boot Manager
  • or the original Linux boot entry

will take you to grub.

Don’t panic—this means the replacement has taken effect.
It’s just that grub still has the old filename recorded as the Windows boot target, so selecting Windows from grub won’t boot it yet.

Next, boot into Linux and fix the grub configuration.


3) Boot into Linux and modify the Windows boot path in grub.cfg

After booting into Linux, locate the grub configuration file. It’s usually here:

/boot/grub/grub.cfg

Then find the corresponding menu item in Windows, which originally pointed to:

bootmgfw.efi

At that point, change it to the filename you just backed up, for example:

bootmgfw.efi.bak

Save and exit.


4) Done

After completing these steps:

  • If the motherboard/firmware continues to put Windows Boot Manager first
    → it will actually enter GRUB first
  • The Windows menu entry in GRUB
    → will then chainload the real bootmgfw.efi.bak
  • In the end, both Linux and Windows should boot normally

In other words, even if Windows Boot Manager keeps “taking first place,” it will only help you enter GRUB first.

Enjoy!