5

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!

6
  • Ubuntu fully supports EFI (thus GPT due to the Windows EFI/GPT requirement) there is absolutely no reason to switch to MBR. Suspect the behavior is explained by hybrid shutdown (i.e. Fastboot). Try disabling hibernation and see if that helps.
    – Ramhound
    Feb 28, 2020 at 17:22
  • 1
    I've been using EFI to boot Ubuntu for years, that's not the problem! The problem is that Windows Boot Manager seems to annihilate Grub. I will try disabling hibernation though. Feb 28, 2020 at 17:24
  • That is exactly the point. Ubuntu works just fine with GPT. So the advice to switch to MBR won't actually solve your particular problem, alright so it will solve your problem, because hybrid shutdown be enabled. However, just disabling hibernation will do that, so switching to MBR is to put it simply **bad advice.
    – Ramhound
    Feb 28, 2020 at 17:28
  • Some with HP have said UEFI update helps which it looks like you have done. But using efibootmgr to set boot order only works once. Grub uses efibootmgr to make it first in boot order with updates or Boot-Repair. Some also have said changing boot order in HP's UEFI then does stick or the edit of BCD so Windows sync of BCD & UEFI does not overwrite an Ubuntu entry.
    – oldfred
    Feb 28, 2020 at 18:26
  • One HP machine on which I wanted dual boot only worked when I renamed the original boot manager (bootmgfw.efi) and replaced it with the shimx64.efi or grub64.efi . See superuser.com/questions/1289741/dual-boot-ubuntu-disappeared and askubuntu.com/questions/244261/… Feb 28, 2020 at 18:55

1 Answer 1

7

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.

1
  • 1
    No apology needed or expected. Sharing your hard-earned solution is very gracious of you.
    – K7AAY
    Feb 29, 2020 at 0:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .