When you install a Linux operating system dual booting with Windows operating system (Both in EFI Boot Managers), sometimes you may ahve experienced that the Linux OS’s Boot Manager (Grub in this article) is not the first boot item. Instead of that, the Windows boot manager is loaded default so the Windows OS is started automatically. Most of times, changing EFI settings in BIOS will also not be possible or easy. Therefore this article explains how to resolve this Boot Manager Problems and take Grub as the first boot item. (Guide is done in Arch Linux).
Resolve Boot Manager Problems
In your Linux OS, you should be having grub as the boot manager with efibootmgr to use this guide properly.
First you need to add Windows OS to the grub’s OS’s list. For that, first you need to install os-prober package.
# pacman -S os-prober
Then reconfigure grub using following command.
# grub-mkconfig -o /boot/grub/grub.cfg
As you can see in the figure below, the Windows boot manager will be identified by the grub.
Finding files to be replaced
Now list everything in the /boot/efi/EFI (where you have mounted your EFI partition). So you can see folders for OS’s installed in your PC as follows.
# ls /boot/efi/EFI/
Now take a list of files in the arch directory.
# ls /boot/efi/EFI/arch/
As you can see, there’s an efi file inside the directory name grub64.efi. This file is the EFI boot loader of Arch linux. Since you have inserted Windows OS to its configuration, it has the link to Windows OS too.
Here we’re going to replace Windows boot manager with this Arch linux boot manager since the Windows boot manager is the default boot manager of your PC.
Now you have found the boot manager of Arch linux, what you have to find is the boot manager of Windows OS. Since you have added Windows OS to the grub.cfg, you may be able to find it there. So let’s open that file.
# nano /boot/grub/grub.cfg
You can find the path to the Windows boot manager in the menu entry of Windows in the grub.cfg file as follows.
Backup and Replace
Now you have to backup the Windows boot manager before replacing it. Let’s use bootmgfwBackup.efi as the name of the backup file.
# cp /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootmgfwBackup.efi
Now replace Windows boot manager with Arch Linux boot manager.
# cp /boot/efi/EFI/arch/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
Now you have to change the file name of the Windows Boot Manager in the grub.cfg to bootmgfwBackup.efi
# nano /boot/grub/grub.cfg
and change bootmgfw.efi to bootmgfwBackup.efi
Now Write Out, Exit and reboot so you can find whether it’s working or not.
If you have any idea to improve this article, please comment below or send them to our official email address.