Windows – How to UEFI dual boot Windows 10 and Ubuntu

grub2multi-bootUbuntuuefiwindows 10

TL;DR: In a Windows 10 / Ubuntu UEFI dual-boot scenario, booting Windows 10 from Grub causes Windows Boot Manager to overwrite / remove Grub. How can I stop this from happening?

My PC has been happily UEFI single-booting Ubuntu 18.04 for a long time. I recently decided to install Windows 10 and dual boot them. I've done this plenty of times in the old BIOS/MBR days so didn't anticipate major problems.

Installation Process

My installation process was:

  • Install Windows 10. As expected, this overwrote Grub with the Windows Boot Manager.
  • Use a live-usb and Boot-Repair to reinstall Grub.
  • Boot to my existing Ubuntu 18.04 installation and run update-grub which automagically picked-up the new Windows install.
  • Use Grub to boot Windows 10

The Problem

Here's where things went wrong. After spending some time in Windows I needed to boot back to Ubuntu. I restarted the machine and, to my surprise, found that it booted straight back into Windows 10 with no sign of Grub anywhere.

I restored Grub as before but found that booting into Windows caused Grub to "disappear" every time.

The Setup

  • HP Z420: latest BIOS
  • Boot Settings:
    • UEFI boot mode enabled
    • Legacy boot mode disabled
    • Secureboot disabled
    • Fastboot enabled
  • Single SSD (sda) with GPT Table
    • sda1 : EFI System Partition
    • sda2 : Ubuntu 18.04 (mounts sda1 under /boot/efi)
    • sda3 : Windows 10

Things I've Tried

  • A lot of the answers which pop-up around this seem to suggest Legacy/MBR dual-booting. I'd like to avoid the hassle and potential data loss of switching GPT to a DOS partition table and also … it's 2020 it feels like this shouldn't be a problem!
  • I tried deactivating and lowering the priority of Windows Boot Manager using efibootmgr as suggested here and here but Windows Boot Manager just re-enables itself when I boot Windows!

I would very much appreciate any assistance. I feel like this shouldn't be hard!

Best Answer

Apologies for answering my own question but in case it helps someone else in future.

As suggested in the comments, I tried the following:

  • Disabling Hibernate in Windows
  • Disabling Fastboot in BIOS

but neither of these worked.

I was about to try renaming the original boot manager when I stumbled across this answer. Running the command:

bcdedit /set "{bootmgr}" path \EFI\ubuntu\grubx64.efi

has prevented Windows Boot Manager from replacing Grub. I've even successfully turned Hibernate and Fastboot back on with no loss of Grub.

NB: It is important to get the EFI path correct. After running boot-repair from a LiveUSB to get grub back, it will tell you the full path to use since it isn't always identical to what is listed above.

Related Question