0

My title is borrowed from this question which describes a situation very close to mine, including three steps which both the OP and I have taken without success. However I'm using the Ubuntu 18.04.4 live USB to install Ubuntu 18.04.4. To recap, the things I've done, mostly in order, are:

  • get new HP Pavilion x360 in the mail
  • create Ubuntu 18.04.4 live USB
  • disable Secure Boot (BIOS) and fast startup (Windows)
  • reboot into live environment and install Ubuntu 18.04.4
  • find that no Grub menu comes up when I reboot - Windows comes on instead.

Boot-repair has been ineffectual. It asked me to run a certain command ("bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi") which has also been suggested by this AskUbuntu answer (albeit modified to "bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi") but neither of these commands has worked. A different AskUbuntu answer suggested editing /etc/systemd/system/boot-linux-next.service; I was hopeful that would work since it was specific to HP Pavilion laptops but that, too, failed. Does anyone have a solution?

(Note: I've left out some boot-repair output to keep this question from being too long.)

1 Answers1

0

It turns out this answer to an earlier question does work after all. I didn't explicitly test the premise of the answer, that HP laptops come with firmware that set the Windows entry first in the UEFI boot order each time the device is loaded. However, efibootmgr did show Windows placed earlier in the boot order than Ubuntu, even after reinstalling. After running efibootmgr to find out BootCurrent is 0000 for me (it may vary), I created a new startup script (/etc/systemd/system/boot-linux-next.service) with the following contents:

[Unit]
Description=Boot Linux next

[Service]
Type=oneshot
# Replace '0' in the next line with the appropriate code. Advice taken from https://askubuntu.com/a/1142709.
ExecStart=/bin/efibootmgr --bootnext 0

[Install]
WantedBy=multi-user.target

and ran sudo systemctl enable --now boot-linux-next.service. You should pay attention to the output of this command to make sure there are no errors - there seems to be a difference between Ubuntu 18.04.4 and later versions of Ubuntu where the latter are OK with relative paths for executables (efibootmgr) but the former requires an absolute path (/bin/efibootmgr). I was able to check the BootNext variable is set correctly by running efibootmgr; apparently the act of running systemctl causes the startup script to be run once. Booting has been normal since then, although I'm still concerned about what might happen the next time I try to boot Windows.