Understanding my /boot/efi/ tree

I am trying to debug an issue I have with fwupd, but first I want to understand what UEFI on my ThinkPad T470s is doing when I am trying to boot my Ubuntu 20.10.

This is what my /boot/efi contains:

/boot/efi/
└── EFI
    ├── BOOT
    │   ├── BOOTX64.EFI
    │   ├── fbx64.efi
    │   └── mmx64.efi
    └── ubuntu
        ├── BOOTX64.CSV
        ├── fw
        │   ├── fwupd-3b8c8162-188c-46a4-aec9-be43f1d65697.cap
        │   ├── fwupd-7a176688-0960-47ba-931b-7829849e8347.cap
        │   └── fwupd-d95d3ada-eef1-464f-8a2a-a11232b8556b.cap
        ├── fwupdx64.efi
        ├── grub.cfg
        ├── grubx64.efi
        ├── mmx64.efi
        └── shimx64.efi

I currently also have an older Ubuntu 16.04 installation and I am using an NVMe drive. My boot order is first "ubuntu", then my NVMe drive.
When I boot my system, I get a warning System bootloader not found, initializing defaults.. My system then boots from the nvme device and GRUB allows me to boot both in Ubuntu 20.10 and Ubuntu 16.04.

It looks like my firmware boot options "Ubuntu" and "Linux-Firmware-Updater" cannot be loaded (it returns to the boot menu without showing any error), so I am trying to understand if my /EFI/ tree is normal or I have messed something up.

Is the structure of this tree normal? Should I have both EFI/BOOT and EFI/ubuntu? Am I doing something wrong?


Edit: details requested:

$ sudo efibootmgr -v
BootCurrent: 0019
Timeout: 0 seconds
BootOrder: 0000,0017,0010,0011,0012,0013,0018,001A,001B,001C,001D,001E,0001,0019
Boot0000* ubuntu    HD(3,MBR,0xff767ef,0x64bb800,0x100800)/File(EFIubuntushimx64.efi)
Boot0001* Linux-Firmware-Updater    HD(3,MBR,0xff767ef,0x64bb800,0x100800)/File(EFIubuntufwupdx64.efi)
Boot0010  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011  Boot Menu FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot0012  Diagnostic Splash Screen  FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0013  Lenovo Diagnostics    FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
Boot0014  Startup Interrupt Menu    FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0015  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0016  MEBx Hot Key  FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0019* NVMe0 VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,001c199932d94c4eae9aa0b6e98eb8a400)
# (removed a few non-important entries)

The UUID of EFI/ubuntu/grub.cfg does not seem to correspond to anything from the efibootmgr list:

$ sudo less /boot/efi/EFI/ubuntu/grub.cfg
search.fs_uuid 4be2c650-c96c-4823-a833-28d345042788 root 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

The BOOT/bootx64.efi and EFI/ubuntu/shimx64.efi seem to be the same:

$ sudo md5sum /boot/efi/EFI/BOOT/bootx64.efi
78415fb8fb9b909f8029858113f1335f  /boot/efi/EFI/BOOT/bootx64.efi
$ sudo md5sum /boot/efi/EFI/ubuntu/shimx64.efi
78415fb8fb9b909f8029858113f1335f  /boot/efi/EFI/ubuntu/shimx64.efi

It also looks like I am using MBR, instead of GPT.

Asked By: MakisH

||

New hardware is UEFI based and then Ubuntu (and Windows if not pre-installed) should be installed in UEFI boot mode. Microsoft requires gpt partitioning for UEFI installs by vendors, but Ubuntu will allow UEFI install to MBR (msdos) partitioned drives, but probably should not.

You can see partitioning with lsblk:

lsblk -o name,mountpoint,label,size,fstype,uuid,partuuid | grep -E -v "^loop"
sudo parted -l

UEFI boots from UEFI boot entries, but to see details on which partition/files are used you can run efibootmgr which shows GUID/partUUID of ESP (EFI System Partition):

sudo efibootmgr -v

Then in ESP is a 3 line /EFI/ubuntu/grub.cfg as configfile to load full grub.cfg in your install’s / (root) partition (or /boot if separate partition).

ESP should have at least two folders, /EFI/Boot & /EFI/ubuntu. Windows adds /EFI/Microsoft. These folders contain boot files. The /EFI/Boot is a fallback or drive boot entry which is a copy of shimx64.efi from grub or if Windows, a copy of its bootmgfw.efi boot file.

So boot is UEFI, to ESP, to install.

An example of /EFI/ubuntu/grub.cfg can be seen [here][2].

References:

Answered By: oldfred
Categories: Answers Tags: , , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.