efibootmgr utility in Ubuntu. This process involves identifying the correct boot entry UUID for GRUB and setting it as the first option in the firmware's priority list. Afterward, you should verify the change by restarting the system to ensure the GRUB menu appears instead of the Windows Boot Manager.
Prerequisites and Safety Warnings
Before modifying boot records, it is critical to back up your current EFI System Partition (ESP). The ESP contains the boot loaders for both operating systems, and incorrect manipulation can render both Windows and Ubuntu unbootable. Create a backup of the entire/boot/efi directory or the partition itself. Additionally, ensure you are booted into Ubuntu, not Windows, when performing these steps. Modifying the boot order from within Windows is possible via third-party tools, but the native Linux method using efibootmgr is more transparent and reliable for troubleshooting.
Identifying the GRUB Boot Entry
The first step is to determine which boot entry corresponds to GRUB. Open a terminal in Ubuntu and run the following command:sudo efibootmgr
This command lists all current boot entries with their numbers and UUIDs. Look for an entry that mentions "ubuntu" or "GRUB". The output will resemble something like this:
BBootOrder: 0001,0002,0003
Boot0001* ubuntu
Boot0002* Windows Boot Manager
Boot0003* Hard Drive
In this example, 0001 is the number for Ubuntu's GRUB loader. Note the exact number or the UUID associated with it. If you do not see an Ubuntu entry, it may have been deleted during a previous cleanup, such as removing the Ubuntu boot partition mentioned in your context. In that case, you would need to reinstall GRUB or restore it from a live USB before proceeding.
Changing the Boot Order
Once you have identified the correct boot entry number for GRUB, you can set it as the primary bootloader. Use the-o flag followed by the new boot order sequence. To make GRUB the default, place its number first. For example, if GRUB is 0001 and Windows is 0002, the command would be:
sudo efibootmgr -o 0001,0002,0003
Replace the numbers with those found in your specific system. The order matters; the first number is the highest priority. After running this command, verify the change by running sudo efibootmgr again to confirm the BootOrder line reflects your new configuration.
Verifying the Change
Restart your computer to test the new configuration. Upon power-on, the system should now display the GRUB menu, allowing you to choose between Ubuntu and Windows. If the system boots directly into Windows, the change was not applied correctly, or the BIOS/UEFI has overridden the software boot order. In some cases, you may need to enter the BIOS/UEFI setup (usually by pressing F2, Del, or Esc during startup) and manually move the Ubuntu boot entry to the top of the list there as well. If you encounter issues, refer to our guide on Double Booting Windows 11 and Ubuntu 20.04 LTS on a New HDD for additional insights on managing multi-OS environments.Troubleshooting Common Issues
Sometimes, the GRUB entry may appear but fail to load properly. This often happens if thegrubx64.efi file is missing or corrupted in the EFI partition. Check the contents of /boot/efi/EFI/ubuntu/ to ensure the necessary files exist. If they are missing, you can repair GRUB by booting from a Live USB and using the chroot method to reinstall the bootloader.
Another common issue is Secure Boot interference. While modern versions of GRUB support Secure Boot, older configurations might require it to be disabled in the BIOS/UEFI settings. If you experience black screens or authentication failures after switching, try temporarily disabling Secure Boot to see if it resolves the problem.
For users dealing with complex hardware configurations, such as those involving virtualization or cron jobs, understanding boot priorities is equally important. You might find related challenges in Cron Won't Start VirtualBox VM: A Solution, where system state management is key.
Restoring Windows Boot Manager
If you decide to revert to Windows as the default bootloader, simply swap the order in theefibootmgr command. For example:
sudo efibootmgr -o 0002,0001,0003
This ensures that Windows Boot Manager loads first. You can also delete unused boot entries to clean up the list, but be cautious not to remove the active GRUB or Windows entries. Always double-check the numbers before deleting any entry.
Frequently Asked Questions
What if I don't see the Ubuntu entry in efibootmgr?
If the Ubuntu entry is missing, it likely means the GRUB bootloader was removed or the EFI partition was wiped. You will need to restore GRUB using a Live USB or reinstall Ubuntu to recreate the necessary boot files in the EFI partition.
Can I change the boot order from Windows?
Yes, you can use third-party tools like EasyBCD or the built-in Command Prompt tool bcdedit to manage boot entries. However, modifying the UEFI NVRAM directly from Linux using efibootmgr is generally more straightforward for dual-boot setups.
Does changing the bootloader affect my data?
No, changing the boot order only affects which operating system loads first. It does not delete or modify any files on your hard drives. Your personal data, documents, and installed applications remain intact.
Why does my system still boot into Windows after changing the order?
This can happen if your motherboard's BIOS/UEFI has a hardware-specific boot priority that overrides the OS-level settings. Enter your BIOS/UEFI setup and check the "Boot Priority" or "Boot Option Priorities" section to ensure Ubuntu is listed first there as well.
Is it safe to delete old boot entries?
It is safe to delete entries that correspond to operating systems you no longer have installed. However, always verify that you are not deleting the current active GRUB or Windows Boot Manager entries, as this would prevent your system from booting.