Differences between revisions 4 and 5
Revision 4 as of 2025-12-03 04:39:13
Size: 1552
Editor: SamatJain
Comment:
Revision 5 as of 2025-12-09 09:08:20
Size: 2737
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 40: Line 40:
== efibootmgr ==

{{{#!bash
# On a Debian system
$ sudo efibootmgr --unicode
BootCurrent: 0006
BootOrder: 0006,0004
Boot0000* Hard drive C: VenHw(d6c0639f-c705-4eb9-aa4f-5802d8823de6)�
Boot0001* IBA XE Slot 0100 v2434 BBS(128,IBA XE Slot 0100 v2434,0x0)�
Boot0004* Integrated NIC 1 Port 1 Partition 1 VenHw(3a191845-5f86-4e78-8fce-c4cff59f9daa)
Boot0006* debian HD(1,GPT,d29fd1bb-05db-40a8-bedd-7e781d884cdc,0x800,0xf3800)/File(\EFI\debian\shimx64.efi)

# On an Ubuntu system
$ sudo efibootmgr --unicode
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,2001,2002,2003
Boot0001* Kubuntu HD(1,GPT,9c2855d5-633e-4091-aa3c-40e172d0ecfc,0x1000,0x96000)/File(\EFI\kubuntu\shimx64.efi)
Boot2001* EFI USB Device 䍒
Boot2002* EFI DVD/CDROM 䍒
Boot2003* EFI Network 䍒

OR

Boot0006* ubuntu HD(1,GPT,2535f000-ca5e-42fa-b4fd-1a40e99a5ed5,0x1000,0x96000)/File(\EFI\ubuntu\shimx64.efi)

# Delete unused boot entries
$ efibootmgr --delete-bootnum --bootnum 0007

# Create new entry (preferably, use grub-install)
$ efibootmgr --create --disk /dev/sda --part 1 --loader "\EFI\debian\shimx64.efi" --label "debian"
}}}

Notes related to Extensible Firmware Interface (EFI).

Reboot into BIOS

sudo systemctl reboot --firmware-setup

Ref

Repair for Linux

To reinstall UEFI entries, check what's installed with efibootmgr --verbose which will list all boot entries, and the default. If the entry for the OS is missing (usually "debian" or "ubuntu"), the entry may need to be re-added. Rather than manipulating EFI variables, it's easiest to reinstall grub which ensures all files/etc are in the right place.

If using a chroot to reinstall entries, first setup various bind mounts from outside the chroot into the chroot:

   1 CHROOT_ROOT=/mnt
   2 # mount --bind /dev/ $CHROOT_ROOT/dev
   3 # mount --bind /dev/pts $CHROOT_ROOT/dev/pts
   4 # OR
   5 mount --rbind /dev/ $CHROOT_ROOT/dev
   6 mount --bind /sys $CHROOT_ROOT/sys
   7 mount --bind /proc $CHROOT_ROOT/proc
   8 mount --rbind /run $CHROOT_ROOT/run
   9 
  10 modprobe efivarfs
  11 mount -o bind /sys/firmware/efi $CHROOT_ROOT/sys/firmware/efi

Also ensure the EFI partition is mounted at the correct location (e.g. usually /boot/efi).

After entering the chroot, reinstall grub with:

grub-install --target=x86_64-efi --efi-directory=/boot/efi 

Afterwards, double-check the boot entry shows up with efibootmgr.

efibootmgr

# On a Debian system
$ sudo efibootmgr --unicode
BootCurrent: 0006
BootOrder: 0006,0004
Boot0000* Hard drive C: VenHw(d6c0639f-c705-4eb9-aa4f-5802d8823de6)�
Boot0001* IBA XE Slot 0100 v2434        BBS(128,IBA XE Slot 0100 v2434,0x0)�
Boot0004* Integrated NIC 1 Port 1 Partition 1   VenHw(3a191845-5f86-4e78-8fce-c4cff59f9daa)
Boot0006* debian        HD(1,GPT,d29fd1bb-05db-40a8-bedd-7e781d884cdc,0x800,0xf3800)/File(\EFI\debian\shimx64.efi)

# On an Ubuntu system
$ sudo efibootmgr --unicode
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,2001,2002,2003
Boot0001* Kubuntu       HD(1,GPT,9c2855d5-633e-4091-aa3c-40e172d0ecfc,0x1000,0x96000)/File(\EFI\kubuntu\shimx64.efi)
Boot2001* EFI USB Device        䍒
Boot2002* EFI DVD/CDROM 䍒
Boot2003* EFI Network   䍒

OR

Boot0006* ubuntu        HD(1,GPT,2535f000-ca5e-42fa-b4fd-1a40e99a5ed5,0x1000,0x96000)/File(\EFI\ubuntu\shimx64.efi)

# Delete unused boot entries
$ efibootmgr --delete-bootnum --bootnum 0007

# Create new entry (preferably, use grub-install)
$ efibootmgr --create --disk /dev/sda --part 1 --loader "\EFI\debian\shimx64.efi" --label "debian"


CategoryCheatSheet

SamatsWiki: CheatSheet/EFI (last edited 2025-12-09 09:08:20 by SamatJain)