0

I need to re-create my UEFI boot entries. Which is Windows10 and LUKS with Linux Mint 20.

While trying to get my LUKS encryption partition to boot, I gave boot recovery a shot and got booted into my firm-ware recovery on re-boot which removed all UEFI entries after 20 seconds.

I really need my Windows partition to work immediately, so I am going to focus on that. I got a live usb with Mint 20 on and I can see that all partitions and UEFI files on the Boot partition are there.

After reading up on efibootmgr, I think that I need to do efibootmgr -c -d /dev/sda -p 2 -l \\EFI\\Boot\\Microsoft\\???.efi -L Windows10.

Is that correct? I am not set on the booter being GRUB2. I am also happy to use my firmware UEFI boot (which I believe can be managed via efibootmgr - see bottom of post).

  • UEFI BIOS Version: J3ET65WW (1.65) 2016-01-21
  • ME Firmware Version: 9.5.13.1706

How do I know which .efi file to use as loader?

/dev/sda2

$ tree . -L 3
.
├── EFI
│   ├── Boot
│   │   ├── bkpbootx64.efi
│   │   ├── bootx64.efi
│   │   ├── fbx64.efi
│   │   ├── grubx64.efi
│   │   └── mmx64.efi
│   ├── Microsoft
│   │   ├── Boot
│   │   └── Recovery
│   └── ubuntu
│       ├── BOOTX64.CSV
│       ├── grub.cfg
│       ├── grubx64.efi
│       ├── mmx64.efi
│       └── shimx64.efi
├── System Volume Information
└── boot-repair
    └── log
        ├── 20201014_021131
        ├── 20201014_022001
        └── 20201014_022629

EFI/Boot/Microsoft/Boot

$ tree EFI/Microsoft/Boot/ -L 1 | grep '.efi\|.dll\|.p7b'
├── bootmgfw.efi
├── bootmgr.efi
├── kd_02_10df.dll
├── kd_02_10ec.dll
├── kd_02_1137.dll
├── kd_02_14e4.dll
├── kd_02_15b3.dll
├── kd_02_1969.dll
├── kd_02_19a2.dll
├── kd_02_1af4.dll
├── kd_02_8086.dll
├── kd_07_1415.dll
├── kd_0C_8086.dll
├── kdnet_uart16550.dll
├── kdstub.dll
├── memtest.efi
├── winsipolicy.p7b

The linux boot recovery operation did install GRUB 2.04 and my PC boots into the minimal BASH-like terminal.

grub> list_env
error: file `/boot/grub.grubenv` not found.

grub> ls
(proc) (hd0) (hd0,apple2) (hd0, apple1) (hd0,msdoc3) (hd0, msdos2) (hd1) (hd1,gpt6) (hd1,gpt4) (hd1,gpt3) (hd1,gpt2) (hd1,gpt1)

GParted overview of my GDT partitioned SSD GParted overview of my GDT partitioned SSD

$ sudo efibootmgr
BootCurrent: 000A
Timeout: 2 seconds
BootOrder: 0001,0007,0000,0003,0005,0006,0008,0009,000A,000B
Boot0000  Setup
Boot0001  Boot Menu
Boot0002  Diagnostic Splash Screen
Boot0003  Lenovo Diagnostics
Boot0004  Startup Interrupt Menu
Boot0005  Rescue and Recovery
Boot0006  USB CD
Boot0007* USB FDD
Boot0008* ATA HDD0
Boot0009* ATA HDD1
Boot000A* USB HDD
Boot000B  PCI LAN
Boot000D* ubuntu
5
  • I found the following two questions that seems very relevant but not helpful: askubuntu.com/questions/1201862/… and askubuntu.com/questions/972595/luks-without-a-boot-partition Oct 27 '20 at 14:30
  • Examples of use of efibootmgr. You need to know which partition & drive is ESP. askubuntu.com/questions/486752/… See the example of restore Windows entry in IV.
    – oldfred
    Oct 27 '20 at 15:12
  • Even with no nvram boot entries, your EFI boot menu (some key at poweron) should be able to select the device and boot the EFI/Boot/bootx64.efi (which should be shim). Or just rename the bkpbootx64.efi to bootx64.efi and boot Windows directly.
    – ubfan1
    Oct 27 '20 at 15:56
  • @ubfan1 "got booted into my firm-ware recovery on re-boot which removed all UEFI entries after 20 seconds." Sorry no, the firmware deleted all entries after that. I will need to re-add them now. Do you have more information on bkpbootx64.efi and bootx64.efi? Oct 27 '20 at 16:08
  • 2
    bootx64.efi is just a copy of shimx64.efi, and bkpbootx64.efi is just a copy of the Microsoft/Boot/bootmgfw.efi. The grub install renames the original bootx64.efi to bkpbootx64.efi, and put the shimx64.efi copy there (and a copy of grubx64.efi). The device bootloader allows a device to be moved to a new machine and used for boot, without any nvram entry on that machine.
    – ubfan1
    Oct 27 '20 at 16:43
1

Can you boot into grub and then chainload Windows efi.

During grub you can press C to enter the CLI (you called it BASH-like terminal).

grub> set root=(hd0,gpt2) #sets / to the Efi partition
grub> chainloader /EFI/Microsoft/Boot/bootmgfw.efi #tell which efi file to laod
grub> boot #does the magic

if it works well, you might add this as a grub-entry. See here for more infos about creating an entry.

5
  • The chainload command does not exist but chainloader does. I get an error though: error: disk 'hd1,gpt2; not found. Perhaps because root is now (hd1,gpt2)? ls gives me (proc) (hd0) (hd0,gpt6) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1). Oct 27 '20 at 16:02
  • Thanks! This is a first step. I can boot Windows 10 from the CLI with chainloader /EFI/Microsoft/Boot/bootmgfw.efi and boot. Oct 27 '20 at 16:05
  • So i changed the root parition and corrected the spelling from chainloader. Everything else works now?
    – Boba Fit
    Oct 27 '20 at 17:28
  • 1
    Yes. Windows autofixed its own boot entry after the first boot.I will ask a separate question about the LUKS stuff. Oct 27 '20 at 19:39
  • I just want to specify that I did not use the set root command and it worked. I guess that bootmgfw.efi is looking for (hd1,gpt2) and setting root to anything, will change the location name of said partition. This is probably specific to my machine but applicable to anyone who install Windows10 on an already partitioned harddrive. Hence bootmgfw.efi will try to boot with the default root and partition names? Oct 28 '20 at 14:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.