TLDR summary: check the BIOS boot order is set to run the installed \EFI\Ubuntu\shimx64.efi
boot loader first, rather than boot from a device (which will use the default \EFI\Boot\bootx64.efi
path). The boot loop is caused by the HP BIOS and the Grub shim fallback EFI fbx64.efi
both changing the EFI boot order and then running the other.
You might also consider removing \EFI\Boot\fbx64.efi
to prevent the EFI boot order from being automatically and silently changed when you boot Ubuntu by selecting a device instead of an explicit EFI boot manager path.
Longer explanation:
I had this "Reset System" boot loop when booting a HP laptop with Ubuntu installed on an external USB drive. Manually selecting the Ubuntu bootloader at boot time (via ESC-F9 boot menu) worked, but the default boot failed with a boot loop. There was also the curious issue that booting Ubuntu changed the EFI boot entries. I will refer to the USB drive in the following text, because that's what I was using, but I believe this issue would also affect the internal drive in the same way.
The preconditions of the boot loop:
- In HP BIOS Setup, the USB drive has higher priority than any OS installed boot manager. This can be seen in
Boot Options > UEFI Boot Order
, where USB Flash Drive
appears above OS Boot Manager
. Note this order does not appear to be the default - if you select Exit > Load Setup Defaults
it will place OS Boot Manager
first.
The actual loop is caused by:
- Laptop boots. The USB drive has higher boot priority in the BIOS, so the BIOS changes the EFI boot order to set the drive as the first entry, and then runs the default bootloader
\EFI\Boot\bootx64.efi
which is a Secure Boot shim that in turn runs EFI\Boot\fbx64.efi
. fbx64.efi
(aka fallback.efi
) is a fallback boot manager described as:
Under any filename, fallback.efi is a sort of boot manager—but rather than present a menu of boot options, it scans the subdirectories of EFI on its own disk for files called BOOT.CSV, BOOTX64.CSV, or other architecture-specific variants of that filename. With this file found, it's read and processed to generate a new NVRAM entry. The program then launches the first of the new NVRAM entries it creates.
The fallback boot manager detects that Ubuntu is installed and changes the EFI boot order to set \EFI\ubuntu\shimx64.efi
as the first boot entry and reboots.
Goto 1.
Although in this case the boot loop happened with an external USB drive, I believe the same thing would happen if Ubuntu were installed to any drive, and the HP BIOS were set to boot from the drive device (as opposed to the Ubuntu EFI bootloader). After Ubuntu is installed, the EFI boot entries will be something like:
# efibootmgr
Boot0002* Internal Hard Disk PciRoot(0x0)/Pci(0x2,0x4)/Pci(0x0,0x0)/NVMe(0x1,00-00-00-00-00-00-00-00)/HD(1,GPT,...,0x800,0x82000)..BO
Boot0003* ubuntu HD(1,GPT,...)/File(\EFI\ubuntu\shimx64.efi)
Note that there are separate entries for the drive itself, and the Ubuntu boot loader on the drive. If the BIOS is set to boot from the Hard Disk first, then on every boot it will change the EFI boot order to set the drive to be first entry, then run the \EFI\Boot
fallback shim, which will in turn change the EFI boot order to set the \EFI\Ubuntu
entry to be first and reboot. On reboot, the BIOS will change the boot order back, and thus starts the boot loop.
Debugging
Unfortunately the shim shows no output apart from Reset System
. You can run mokutil --set-verbosity true
and mokutil --set-fallback-verbosity true
to turn on output, and mokutil --set-fallback-noreboot true
to skip the reboot and run Ubuntu.
This related non-HP bug report for a boot loop on removable media suggests removing \EFI\Boot\fbx64.efi
as a workaround to prevent a similar boot loop.
\EFI\ubuntu\grubx64.efi
(I'm not sure why the file path is given with backslashes).The customised boot option allows you to enter a path, but backslahes are not allowed so I've entered
– D.Yvel Jul 04 '22 at 20:43/EFI/ubuntu/grubx64.efi
. Gave this a go but unfortunately no luck and it's still looping.Not entirely sure what to make of it though. I see that sda2 has no OS, but the boot files that work when trying manually.
– D.Yvel Jul 04 '22 at 21:09