Hello GRUB developers/experts,
I have just run into some issues with GRUB and its device detection:
I have done a Linux installation (Oracle aka RedHat Linux 7.2) on an
EFI machine with GPT disks and a quite complex device setup (2 SSDs,
2 HDDs, 1 SATA BluRay-DVD-RW, 1 ATAPI DVD-RW, legacy floppy disk)
booting through the default GRUB build based on 2.02-beta that comes
with RHEL 7.2.
My scenario is the following:
- AMD 890FX chipset, presenting
- a SATA controller with
- two SSDs (devices 0 and 1)
- two HDDs (devices 2 and 3)
- one optical drive (BluRay-DVD-RW, device 5)
- one empty slot (device 6)
- a PATA controller with
- one optical drive (DVD-RW, device 1)
- a legacy ATA floppy disk drive
- several USB2 and USB3 controllers with (amongst other
non-storage USB devices)
- three USB mass storage devices representing empty slots on
my card reader.
While the GRUB menu works fine and my installation boots fine (which
is only due to the fact that GRUB and RHEL 7.2 identify all
partitions by UUIDs; trying to address devices by GRUB and Linux
device names would clearly have failed completely), it prints out
multiple error messages before the GRUB menu is displayed: "error:
failure reading sector <...> from 'hd0'" and "error: failure
reading sector <...> from 'hd9' (see first screenshot).
I was specifically wondering about what would be wrong with my (hd0)
drive and why GRUB at all detected a ten HDDs up to a (hd9) drive,
so I have just completed some investigation around this by adding
more verbose debug messages into file grub-core/disk/efi/efidisk.c
and would like to inform you about the results:
As you can see from the two attached screenshots, device detection
in method
static void name_devices (struct grub_efidisk_data *devices)
currently does not work as intended in the following ways:
- It adds (hd<n>) devices for optical drives that
currently don't have removable media inserted in both the ATAPI
and the SATA case - see (hd0) for ATAPI and (hd9) for SATA
- For these drives, the above "failure reading sector" message
is printed on an unsuccessful attempt to read from the empty
drive
- PATA CD drives (ATAPI) can be detected by having ACPI type 3
(GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) and subtype 1
(GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE)
- SATA CD drives (at least in my UEFI) seem to present the
exact same type/subtype values as "empty" unformatted SATA
HDDs, namely type 3 (GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) and
subtype 18 (GRUB_EFI_SATA_DEVICE_PATH_SUBTYPE)
- It also adds hd<n> devices for empty removable USB mass
storage devices, i.e. empty card reader slots - see (hd1) to
(hd4)
- These present as type 3
(GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE) and subtype 2
(GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE) - it looks like they can
only be distinguished from true SCSI HDDs by scanning
backwards in the ACPI device path (subtype 5 one ACPI level
above?)
- The issue with this is less the fact that GRUB adds these
devices at all, but rather the fact that
- optical drives get "hd<n>" device IDs assigned rather
than "cd<n>"
- USB mass storage devices get lower "hd<n>" device IDs
(hd1 to hd4) assigned than SSDs/HDDs
So in my case the error messages "failure reading sector" from
(hd0) and (hd9) are caused by the fact that GRUB sees my empty
PATA DVD drive as (hd0) and my empty SATA BluRay drive as (hd9).
Note that once I insert a valid media into either drive, the
respective drive will be properly detected as (cd0).
I would rather expect the four true SSDs and hard disks to be
detected as (hd0) to (hd3), but currently they will be known as
(hd5) to (hd8), which typically would be quite catastrophic. The
only reason that GRUB can still at all boot my system is that the
RHEL configuration searches the root partition "by UUID"...
Please let me know whether how to proceed, especially whether you
would like me to create (one or more?) bug(s) for these issues.
Many thanks in advance & best regards,
Andreas
|