1

I'm running a dual boot Windows 10 and Ubuntu 15.10 on my HP Spectre X360. Everything worked fine until I updated Ubuntu and it asked me to restart the system. After the restart GRUB wouldn't show anymore and my computer would immediately boot into Windows.

I tried the following:

  • holding shift during boot: Nothing happens
  • Changing the boot order: Only Windows boot manager shows up so I can't change anything
  • doing a boot-repair: After running it I got this log http://paste2.org/0Cwwt45W but it didn't fix my problem.

So far I don't know what else to try.

Edit: I can hit esc, then "Boot Device Options" then "Boot from EFI file" then"EFI" then "Ubuntu" then "grubx64.efi" and boot Ubuntu that way.

Now the interesting entries in /var/log/apt/history.log are

Install: 
linux-headers-4.2.0-23-generic:amd64 (4.2.0-23.28, automatic)
linux-signed-image-4.2.0-23-generic:amd64 (4.2.0-23.28, automatic)
linux-image-extra-4.2.0-23-generic:amd64 (4.2.0-23.28, automatic)
linux-headers-4.2.0-23:amd64 (4.2.0-23.28, automatic)
linux-image-4.2.0-23-generic:amd64 (4.2.0-23.28, automatic)

Upgrade: 
linux-headers-generic:amd64 (4.2.0.22.24, 4.2.0.23.25)
grub-efi-amd64-bin:amd64 (2.02~beta2-29ubuntu0.2, 2.02~beta2-29ubuntu0.3)
grub-efi-amd64:amd64 (2.02~beta2-29ubuntu0.2, 2.02~beta2-29ubuntu0.3)
grub-common:amd64 (2.02~beta2-29ubuntu0.2, 2.02~beta2-29ubuntu0.3)
grub2-common:amd64 (2.02~beta2-29ubuntu0.2, 2.02~beta2-29ubuntu0.3)
linux-signed-generic:amd64 (4.2.0.22.24, 4.2.0.23.25)
grub-efi-amd64-signed:amd64 (1.55.2+2.02~beta2-29ubuntu0.2, 1.55.3+2.02~beta2-29ubuntu0.3)
linux-signed-image-generic:amd64 (4.2.0.22.24, 4.2.0.23.25)
linux-image-generic:amd64 (4.2.0.22.24, 4.2.0.23.25)
linux-generic:amd64 (4.2.0.22.24, 4.2.0.23.25)

5 Answers5

1

Windows 10 loves to see itself as the only installed OS on your computer, thus making you unable to boot into others. What you need to do is to set GRUB as the default boot manager in Windows through an admin Command Prompt or PowerShell.

Run this command:

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

If you use PowerShell, run this command:

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

Restart your computer then grub should show up after the HP logo.

Vin
  • 21
0

You'll have to change the bootorder in your BIOS. At startup you'll have to press a button to enter it. Most often F2 or del. There you'll have to choose your ubuntu partition as first priority to boot from. This all depends on your motherboard and your bios version. Search for your motherboard if you're not able to figure out which button to press on startup.

  • I can hit esc, then "Boot Device Options" then either select Windows boot manager or "Boot from EFI file". If I select the latter I can select a file to boot. The choices are "EFI" and "boot-sav". For "EFI" I can choose "Ubuntu" and boot Ubuntu that way. – Stefan Brunecker Jan 09 '16 at 13:13
0

It looks like you're machine is using UEFI. I assume that the new grub bootloader is not being recognized by the BIOS and hence it boots Windows. I observed this behaviour at a laptop which refused to boot into Linux (GRUB) unless "legacy boot" was selected.

This gives you two options:

  • try to open the one time boot menu at startup by pressing F12 or Esc (could be some other key, e.g. F9) and select something like legacy boot
  • open the BIOS settings with F2, Del (or some other key), navigate to startup resp. boot management and look for an option "enable legacy boot" or comparable there and activate it

If one of these steps work you know that it's an UEFI problem and your bootloader is still intact and working.

The other approach would be to check why UEFI now refuses to boot into Ubuntu even though it worked before. This can be caused by:

  • boot priority setting in the BIOS
  • GRUB fingerprint / signature has to be added to UEFI to be accepted as a legit boot loader
  • your GRUB is damaged and you could reinstall the bootloader from a Ubuntu Live CD
  • I enabled legacy boot and disabled secure boot but no change.

    In BIOS I have two Boot Orders:

    1. UEFI: There I can only select the Windows boot manager
    2. Legacy: There I can only select "Notebook Hard Drive"

    How do I add a GRUB fingerprint? Wouldn't boot-repair do it automatically?

    – Stefan Brunecker Jan 09 '16 at 13:07
  • What happens if you switch the order that is put Legacy Notebook Hard Drive before UEFI and reboot? – MarkWatney Jan 09 '16 at 14:59
0

Here's the problem, from lines 1220-1221 in your Boot Repair log:

efibootmgr: Could not set variable Boot0002: No such file or directory
efibootmgr: Could not prepare boot variable: No such file or directory

Translated to English, the efibootmgr utility (a key part of installing an EFI boot loader from Linux) tried to create a new variable (Boot0002), but when it tried to set that variable as the default, it had disappeared from the firmware's memory. Basically, this indicates a bug in the firmware (or possibly in efibootmgr), or at least some sort of firmware glitch or misconfiguration. There are several possible solutions and workarounds, such as:

  • Upgrade your firmware (what the manufacturer probably calls a "BIOS") and try again. This may fix the bug.
  • Locate the firmware option to reset everything to factory defaults, use that option, then try again. This may clear cruft out of the firmware's data store, thus making things work more smoothly.
  • Register GRUB with the firmware in some other way, such as:
    • Using bcdedit in Windows, as described in my answer to this question.
    • Using the GUI EasyUEFI tool in Windows.
    • Using an EFI shell, as described in the Arch Linux wiki.
    • The point of all of these options is that it's possible that at least part of the problem is in efibootmgr, so using another tool may work better.
  • If the computer's new enough, return it to the store for a refund and buy one that isn't broken by design.
  • Use the "Advanced" Boot Repair option to back up and rename boot loaders. This will put GRUB in place of the Windows boot loader, thus hijacking the working Windows entry, and put a copy of the Windows boot loader elsewhere. This is an ugly hack of a workaround that's likely to come back and bite you later, since most tools won't know about the highly irregular state this workaround creates. Nonetheless, it may be the only solution in some extreme cases.

I'd try the solutions in roughly that order until one works, although you can try them in any order you like.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • this answer assumes that the hardware is defective and is not a software configuration issue. –  Nov 14 '16 at 23:04
  • No, it doesn't. From my answer: "this indicates a bug in the firmware (or possibly in efibootmgr), or at least some sort of firmware glitch or misconfiguration." At no point in my answer do I blame hardware, although one of my bullet points does recommend returning the computer because it's broken -- but in context, it should be clear that it's the computer's firmware that I suspect is defective, not the hardware. If you know of a software bug or misconfiguration that can produce the specified results, please share that information. I note you haven't done so. – Rod Smith Nov 15 '16 at 14:08
  • The BIOS is in the motherboard, not the HDD. Grub resides in the first sector of the HDD. The error does not indicate that it is a BIOS issue. The manufacturer of the MOBO is typically responsible for the BIOS and flashing the BIOS should be a last resort and you need specialized knowledge to handle any further issues that may be caused by flashing the BIOS. You can fix grub without affecting the BIOS, even if you have UEFI (EFI). You can fix this issue by other methods, and boot-repair is known to not always succeed. –  Nov 15 '16 at 17:45
  • The only valid point I found in your answer was to attempt to use bcdedit, which can be a workaround and you are prompted by boot-repair to do so. efibootmgr can not create a new table if current one is missing. You need grub-install to rewrite the records to the first sector which is what boot-repair attempts to do for you in an automated fashion. efi shell should be the last resort, and BIOS should not be the first consideration; the boot order should be. if this issues are addressed and corrected, i will upvote. –  Nov 15 '16 at 17:53
  • jargonjunkie, you're very wrong. Although the firmware (what you call the "BIOS") is on a chip on the motherboard, that does not make it hardware. On an EFI-based system, which Bingoo90 clearly has, GRUB does not reside in the MBR; it's stored as a file on the EFI System Partition (ESP), and an entry in NVRAM points to that file. It's this NVRAM store that's becoming damaged in some way, which is evidence for a firmware bug causing damage. I suggest you read Adam Williamson's blog entry on how EFI works. – Rod Smith Nov 16 '16 at 19:40
  • regardless, the EFI system doesn't know where to point and can't point to any particular ESP because it isn't aware that it exists. The ESP is still in the HDD, even if it doesn't reside exactly in the first sector. The article even states that fact. "The file is the File(\EFI\opensuse\grubx64.efi) bit: that just means “load the file in this location on the partition we just described”. The partition in question will almost always be one that qualifies as an EFI system partition, because of the considerations above: that’s the type of partition we can trust the firmware to be able to access." –  Nov 17 '16 at 00:48
  • all that pretty much makes efibootmgr useless because it can only create an entry if you delete the previous entry, and you can only modify the ESP entries if your EFI is aware of the table entries and where they are located. Thats why it just boots straight past grub and in to windows. i know because that's how i fixed my computer when this same exact issue occurred on my PC. I even extensively tested to make sure that grub was in fact still there, and it was. my EFI just wasnt able to point to the correct entry and so it skipped right to windows. –  Nov 17 '16 at 00:50
  • jargonjunkie, I'm done arguing with you. You clearly don't know what you're talking about. (I, OTOH, maintain the rEFInd boot manager; I understand the EFI boot process very well.) – Rod Smith Nov 19 '16 at 19:14
0

Had similar Problem: Win 7 and Xubuntu 15.10 -> Grub never started. When I tried to restore grub got similar message:

Could not set variable Boot000B: No such file or directory

So I used (under Windows as Admin) bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi as written above. Grub now working fine, but without Windows choosable.

Adding Windows to grub: I followed https://wiki.ubuntuusers.de/GRUB_2/Skripte/ (german) ->Create a executable skrip "29_windows" in "/etc/grub.d"

#!/bin/bash
# EFI-Partition suchen und auswerten
if [ -f /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi ]; then
    EFI_UUID=$( grub-probe -t fs_uuid /boot/efi/EFI )
    echo "Menüeintrag für Windows eingefügt" >&2

cat <<EOF
menuentry "Windows 7 Pro (UEFI)" {
    insmod fat
    insmod chain
    search --no-floppy --fs-uuid --set=root ${EFI_UUID}
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
EOF
fi

and run

sudo grub-mkconfig
sudo update-grub

Grub found the Windows via script and automatically. Both are working so you may not need the extra script