Score:0

Dual-boot Windows10/Unbuntu Computer Always boots into Windows (bcdedit doesn't help)

us flag

I've been using a dual-boot pc for a few years now. I'm used to having to use bcdedit to update the boot manager after installing Windows updates, but after the most recent one, this doesn't seem to work any more.

I would normally run: bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi

This time, I've also tried: bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

Either way, the computer always boots straight into Windows 10. I can still get to the Grub menu by:

  • Restart the PC, and hold down ESC to pause startup
  • From the startup menu, select F9: Boot Device Options
  • From the boot option menu, select ubuntu (ST1000LM023 HN-M101MBB)

Can anyone recommend anything I should be checking, or the best next steps?

The computer is a HP Pavilion15 that I've had since 2014.

I'll probably remove Windows from this machine once I've fixed it - maintaining a Windows partition is becoming more trouble than it's worth! :)

Update Based on this answer I found, perhaps this is affected by the same firmware bug as that user described. The following steps restore the grub menu on startup: `cd /boot/efi/EFI #back up the old bootmgrfile mv Microsoft/Boot/bootmgrfw.efi Microsoft/Boot/bootmgrfw.old.efi #replace the Windows boot manager with grub cp ubuntu/shimx64.efi Microsoft/Boot/bootmgrfw.efi

for some reason it complains if this file isn't present too...

cp ubuntu.grub64.efi Microsoft/Boot/grub64.efi`

Problem with this approach is that the entry in the Grub menu for windows of course reloads Grub, rather than booting into Windows. Doesn't entirely bother me that I can't get into Windows at the moment, but I'd really like to know how to make this work correctly.

I've tried running os-prober and update-grub in the hope that it finds the windows bootloader at bootmgrfw.old.efi, but that's clearly not a thing!

Can anyone suggest a way of correcting the entry for Windows in the Grub menu, or generally a better approach to configure?

Score:0
vg flag

Run:

# Where X is your ma/dev/nvme0n1p1in boot drive. e.g. /dev/sda
# Note: if you're running an NVME drive, it may be /dev/nvme0 instead
sudo grub-install /dev/sdX
sudo update-grub

Then try again.

If it still doesn't work, then sudo efibootmgr may help you get it working from Linux instead (make sure to read the manual; you can easily end up with an unbootable system).

Note: In my experience if setting a boot OS doesn't stick; there's a chance it's a BIOS error: either the cheap Flash chip is dying, or the UEFI bios could use re-flash*. Either way you may end up with a bricked system; be careful.

* That can happen because NVRAM is garbage collected by UEFI, and often the garbage collector doesn't run or runs like crap; therefore you simply ran out of space.

Before proceeding I highly recommend you google your "motherboard model" (or laptop model) + "UEFI boot order problem" or "UEFI linux bricked" or something like that. See if there's other people with the same issue.

Update: While I was writing this you posted an update and you indeed suspect a firmware bug. It's tricky. You'll have to look up on the exact details of your Bios firmware. Some will work after a reflash. Others will end up with a bricked system.

The problem is likely that OSes only write up to 50% of the available NVRAM to avoid known firmware bugs; but the BIOS sees it's only 50% full so it doesn't run the garbage collector. And your OS sees the NVRAM is 50% full so it treats it as full.

Forcing the kernel to write to the other 50% could fix it... but if your firmware is buggy (very likely), you could end up bricking the laptop that can only be fixed with an SPI flash and a clip.

Darren Shinkins avatar
us flag
Thanks for your help with this - efibootmgr was very useful; I think that's confirmed what we suspected. This is the output from efibootmgr: BootCurrent: 0000 Timeout: 0 seconds BootOrder: 0001,3001,0000,0002,0004,2001,2002,2003 Boot0000* ubuntu Boot0001* Windows Boot Manager Boot0002* Ubuntu Boot0004* Windows Boot Manager Boot2001* USB Drive (UEFI) Boot2002* Internal CD/DVD ROM Drive (UEFI) Boot3001* Internal Hard Disk or Solid State Disk Boot3002* Internal Hard Disk or Solid State Disk ...cont'd...
Darren Shinkins avatar
us flag
...cont'd... I ran a command to change the boot order, bringing 0000 to the top. efibootmgr -o 0000,0001,3001,0002,0004,2001,2002 This appeared to work, but on rebooting, it still went straight to Windows, and the boot order reset. So I think we're looking at a firmware issue, which I'll continue to explore. Interestingly, when I set the next boot option, that works as expected: efibootmgr -n 0 Next next successive restart goes to grub, just for that one.
Score:0
eg flag

If the solution provided by @IvánAraolaza does not work, reinstall Grub2 when you'll boot Ubuntu.

You can also:

  1. Install Grub2Win in Windows and set it as your main bootloader and configure it.
  2. Boot from a USB stick/SD Card with Ikkiboot or Super Grub2 disk. They will recognize all your bootable systems and reinstall Grub2.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.