Ubuntu 24.04 often hijacks the default boot order by placing itself before Windows in the EFI System Partition, causing the system to bypass the BIOS priority settings and launch Ubuntu immediately. To resolve this, you must manually reorder the boot entries using efibootmgr in Linux or reset the NVRAM variables from within the Windows Recovery Environment to restore the correct startup sequence.
Understanding the Boot Order Conflict
When you install Ubuntu alongside Windows, the installer configures GRUB as the primary bootloader. GRUB then modifies the UEFI firmware’s NVRAM (Non-Volatile RAM) settings to ensure it loads first. This behavior is intentional for Linux users who want immediate access to their distribution, but it creates a conflict for dual-boot setups where Windows is the desired default operating system. Even if you set Windows to top priority in the BIOS/UEFI menu, the firmware may still honor the specific boot entry path stored in NVRAM that points directly to the Ubuntu GRUB binary. This results in the machine skipping the Windows Boot Manager entirely, regardless of the general device priority list. The issue is not a hardware failure or a corrupted installation. It is a software-level ordering problem within the UEFI variables. The firmware reads a list of boot options, and the one with the highest numeric value in the boot order variable is executed first. Ubuntu typically assigns itself a high-priority slot during installation. Consequently, the system boots into Ubuntu before the user has a chance to select an option at the POST screen.Verifying the Current Boot Entries
Before making changes, it is helpful to see what the system currently sees. You can boot into Ubuntu and open a terminal. Run the commandefibootmgr -v. This will display a verbose list of all current boot entries. Look for the entry labeled "ubuntu" or "GRUB" and note its boot number (e.g., Boot0001). Then look for the "Windows Boot Manager" entry and note its number (e.g., Boot0002). If the Ubuntu boot number appears earlier in the output than the Windows entry, this confirms that the NVRAM order is overriding your BIOS preferences.
Solution 1: Reordering via efibootmgr
The most direct fix is to use theefibootmgr utility while running Ubuntu. This tool allows you to manipulate the boot order without entering the BIOS setup every time. Open a terminal and execute sudo efibootmgr to view the current order. Suppose Windows is Boot0002 and Ubuntu is Boot0001. You can swap them by specifying the new order.
Use the following command structure to set Windows as the first boot option:
sudo efibootmgr -o 0002,0001,0000
Replace the numbers with the actual hex codes shown in your efibootmgr -v output. Ensure you include all existing boot entries in the new order to avoid losing access to other tools like recovery modes. After running this command, restart your computer. The system should now load the Windows Boot Manager first. If you wish to switch back to Ubuntu later, simply reverse the order in the command.
Solution 2: Resetting from Windows Recovery
If you cannot boot into Ubuntu or prefer to manage this from the Windows side, you can use the Windows Recovery Environment. This method is particularly useful if the Ubuntu partition is encrypted or inaccessible. First, boot into Windows and go to Settings > Update & Security > Recovery. Select "Advanced Startup" and click "Restart Now." Once the system reboots into a blue menu, navigate to Troubleshoot > Advanced Options > Command Prompt. In the command prompt, you need to identify the EFI partition. Usually, it is assigned a drive letter different from the standard Windows partitions. Rundiskpart, then list disk, and select disk 0 (assuming your main drive is disk 0). Type list vol to find the small FAT32 partition, typically around 100-500 MB. Note its volume number and assign it a letter, such as Z, using assign letter=Z. Exit diskpart.
Next, you can use the bcdboot command to repair or reorder the boot files, though efibootmgr is not available in Windows CMD. Instead, you can use the regedit tool to manually adjust the UEFI variables, but this is risky. A safer approach is to use a third-party tool or simply reinstall the Windows Boot Manager to force it to take precedence. However, many users find that deleting the Ubuntu boot entry from the Windows side is difficult. Therefore, returning to Linux to use efibootmgr remains the most reliable method for precise control.
Preventing Future Conflicts
To avoid this issue during future updates or reinstalls, consider separating the EFI partitions. By default, both OSes share the same ESP (EFI System Partition). Some users choose to create a separate partition for each OS during installation. This requires more manual partitioning but ensures that one OS does not overwrite the boot configuration of the other. Additionally, disabling Fast Startup in Windows can sometimes help prevent locking issues that complicate dual-boot management. For more detailed guidance on setting up a robust dual-boot environment, refer to our guide on Dual Boot with Ubuntu: A Step-by-Step Guide for Windows 10 Users. If you are experiencing password issues after such a setup, you might also find our article on Passwd Recovery Help: Dual Boot Hard Drive - Forgot Windows Log-in Password, Installed Ubuntu via Terminal useful.Frequently Asked Questions
Why does my BIOS say Windows is first but it still boots Ubuntu?
The BIOS general priority list is often overridden by specific UEFI boot entry variables. Ubuntu installs itself as a specific boot path in NVRAM, which the firmware executes before checking the general device priority. You must reorder these specific entries rather than just changing the device list.
Can I delete the Ubuntu boot entry to fix this?
Yes, you can delete the Ubuntu boot entry using efibootmgr -B -b 0001 (replacing 0001 with your Ubuntu boot number). However, this removes the ability to boot into Ubuntu until you reinstall GRUB or add the entry back. It is better to reorder than to delete unless you no longer need Ubuntu.
Does Secure Boot affect dual booting with Windows?
Secure Boot can interfere if the Ubuntu GRUB bootloader is not properly signed or if the keys are not enrolled. While modern Ubuntu versions support Secure Boot out of the box, misconfigurations here can cause boot failures. Check our guide on Getting Ventoy v1.0.99 to Work with Secure Boot Turned On for Dual Boot for insights on security settings.
What if I accidentally deleted the Windows boot entry?
If the Windows boot entry is missing from the UEFI list, you will need to rebuild it. You can do this by booting from a Windows installation media and using the bcdboot command in the recovery environment to restore the necessary files to the EFI partition. This will recreate the Windows Boot Manager entry.
Is it safe to edit NVRAM variables manually?
Editing NVRAM variables is generally safe if you use official tools like efibootmgr. Manually editing registry keys in Windows to change UEFI variables is dangerous and can render the system unbootable. Always backup your current boot order before making changes.
How do I remove Ubuntu completely from a dual boot?
To fully remove Ubuntu, you must delete its partitions from Disk Management in Windows and then restore the Windows bootloader. Our article on How to Properly Remove Ubuntu from a Dual Boot Machine with Windows provides step-by-step instructions for cleaning up the partitions and restoring the MBR/EFI state.