[FAQ] New system won't boot

Share your own howto's etc. Not for support questions!

[FAQ] New system won't boot

Postby Head_on_a_Stick » 2021-01-03 11:47

If a new system has been installed but the machine won't boot afterwards (or if it still boots into Windows for a multi-boot system) then the most likely cause is a defective UEFI implementation for which persistence of the UEFI boot entries is broken.

To check the boot entries load up a live ISO image and run this command (available from the efibootmgr package):
Code: Select all
efibootmgr -v

The last item for each entry should list the .efi loader (with a path relative to the EFI system partition). For Debian buster this should be "\EFI\debian\shimx64.efi".

The equivalent command in Windows would be
Code: Select all
bcdedit /v

If there is no entry for Debian then the firmware is probably broken but you can attempt to add an entry:
Code: Select all
# efibootmgr --create --label 'Debian' --disk /dev/sdX --part Y --loader \EFI\debian\shimx64.efi

Replace X & Y with the drive letter & partition number assigned to the EFI system partition. The command assumes this to be /dev/sda1 so if that is the case then those options can be omitted.

From Windows the command would be
Code: Select all
bcdedit /set "{bootmgr}" path "\EFI\debian\shimx64.efi"

^ That can also be used if Windows resets the default loader after an update.

If there is a Debian entry but it is not first in the boot order then use the "--order" switch to correct this (see the efibootmgr man page for details).

In the event that these changes do not persist (which is highly likely) then the shimx64.efi loader can be copied to the removable loader location and renamed to bootx64.efi (again, replace X & Y with the drive letter and partition number assigned to the EFI system partition[0]):
Code: Select all
# mount /dev/sdXY /mnt
# cp /mnt/EFI/debian/* /mnt/EFI/BOOT
# mv /mnt/EFI/BOOT/{shimx,bootx}64.efi

/EFI/BOOT/bootx64.efi (relative to the EFI system partition) should be booted in the absence of any NVRAM boot entries. Note however that OpenBSD, FreeBSD, DragonFly BSD, NetBSD, Haiku & 9front all use /EFI/BOOT/bootx64.efi as their UEFI bootloader so this method will break those systems. In that case rename bootx64.efi beforehand and create a custom boot entry for it.[1] This will have to be repeated whenever the other operating system "repairs" it's bootloader.

Some UEFI implementations are so broken that they will only start Windows' bootmgfw.efi loader:
Code: Select all
# mount /dev/sdXY /mnt
# mkdir -p /mnt/EFI/Microsoft/Boot
# cp /mnt/EFI/debian/* /mnt/EFI/Microsoft/Boot
# mv /mnt/EFI/Microsoft/Boot/{shimx64,bootmgfw}.efi

Note that this method will break Windows for multi-boot systems. In that case rename bootmgfw.efi beforehand and create a custom boot entry for it.[2] This will have to be repeated whenever Windows "repairs" it's bootloader.

For more on this problem see https://www.rodsbooks.com/efi-bootloade ... ive-naming

[0] The EFI system partition can be identified by using gparted or
Code: Select all
# parted --list

The ESP will have the "boot,esp" flags applied.

[1] Example stanza to add to the end of /etc/grub.d/40_custom (replace "$uuid" with the actual UUID of the EFI system partition):
Code: Select all
menuentry 'OpenBSD' {
   search --fs-uuid $uuid --set=root
   chainloader /EFI/BOOT/openbsd.efi
}

[2] Example stanza to add to the end of /etc/grub.d/40_custom (replace "$uuid" with the actual UUID of the EFI system partition):
Code: Select all
menentry 'Windows' {
   search --fs-uuid $uuid --set=root
   chainloader /EFI/Microsoft/Boot/windows.efi
}
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable