Re: UEFI grub install fails
Hi,
some remarks in hindsight about UEFI specs in regard to partitions:
The UEFI specs can be found at
https://uefi.org/specifications
with 2.11 being the current version (they generall stay backwards
compatible). See especially
https://uefi.org/specs/UEFI/2.11/05_GUID_Partition_Table_Format.html#legacy-master-boot-record-mbr
Van Snyder wrote:
> From fdisk -l:
> ...
> Disklabel type: dos
> ...
> Device Boot Start End Sectors Size Id Type
> ...
> /dev/nvme0n1p8 * 193429504 194545663 1116160 545M ef EFI (FAT-12/16/32)
UEFI 2.11, section 5.2.1, mentions MBR partition table as usable for
marking an UEFI system partition.
"If an MBR partition has an OSType field of 0xEF (i.e., UEFI System
Partition), then the firmware must add the UEFI System Partition GUID
to the handle for the MBR partition [...]"
Some partition editors report this type as "EF00". But this does not
mean that it has more than 1 byte of field width in the partition table
entry. Section 5.2.2. specifies:
"0xEF (i.e., UEFI System Partition) defines a UEFI system partition."
This is what bootable Debian ISOs for amd64 use to advertise
their system partition towards EFI.
The rules for recognizing a valid MBR do not exclude logical
partitions, but the C structure MASTER_BOOT_RECORD by which UEFI
publishes a detected MBR partition table has only 4 elements in its
MBR_PARTITION_RECORD array which is followed by another field named
"signature", which must contain the bytes 0xaa55. So the 4-element
array cannot be enlarged while keeping the struct compatible.
I.e. MBR partition 8 is quite surely out of reach.
All in all MASTER_BOOT_RECORD and the four MBR_PARTITION_RECORD
elements represent the 512 bytes of a MBR, but not the bytes which
describe logical partitions. (Those bytes are in the extended
partition, not in the first block of the disk.)
So it seems that logical MBR partitions are indeed unsuitable for
marking the UEFI system partition.
Another problematic aspect of /dev/nvme0n1p8 in above partition table
is that its "BootIndicator" flag is set. UEFI 2.11 table 5.2 says:
"This field shall not be used by UEFI firmware."
In practice, some EFI implementations interpret this "shall not" as
"must not" and refuse to use such a partition entry.
Others seem to simply ignore this bit.
-----------------------------------------------------------------------
Outside the specs, Microsoft has set the heuristic standard that any
partition with a FAT filesystem shall be considered a potential EFI
system partition, marked by the presence of a program named
\EFI\BOOT\BOOT*.EFI
where "*" is a CPU-type specific name part. (See Table 3.2 in
https://uefi.org/specs/UEFI/2.11/03_Boot_Manager.html#removable-media-boot-behavior
for CPU types and their boot program names.)
Pete Batard, author of the program Rufus, stresses this fact when
trying to convince producers of bootable ISOs to publish the content
of the EFI system partition also as sub tree /EFI/BOOT in the ISO 9660
filesystem (modulo upper case / lower case).
If so, one may copy all files from the ISO filesystem into a FAT
filesystem on a USB stick and hope that this stick will boot via EFI.
Have a nice day :)
Thomas
Reply to: