[issue1352] manually created grml96 USB drive fails to boot on EFI system due to grub misdetection of root device

Ondrej Balaz bts at bts.grml.org
Wed May 20 18:07:28 CEST 2015


New submission from Ondrej Balaz <blami at blami.net>:

USB drive created as follows (https://wiki.grml.org/doku.php?id=usb#manual_approach):
  - two partitions: sda1 formatted as vfat for ESP holding grml, and sda2 formatted as ext2 for 
persistence
  - mounted grml96 2014.11 and copied all files over to sda1
  - moved contents of boot/isolinux/ to root of the sda1
  - ran syslinux

Drive boots just fine on 32bit and 64bit legacy BIOS systems (to syslinux) and on 64bit systems with 
hybrid UEFI/BIOS (using legacy mode to syslinux).

On system with UEFI only (Secure Boot disabled) drive boots only to grub-rescue> prompt with error 
stating "Invalid arch-independent ELF magic" while loading normal.mod followed by "E: Could not find 
root device!"

Further investigation shown that hybrid ISO+EFI drive grub sees following devices (listing only 
those related to drive itself):
(hd0)           iso file system
(hd0,msdos1)    fat file system
(hd0,msdos2)    ext2 file system

grub-rescue> echo $root
hd0
grub-rescue> echo $prefix
(hd0)/boot/grub/x86_64-efi

After following set of commands grub boots nicely into grml menu and works as expected:

grub-rescue> root=(hd0,msdos1)
grub-rescue> insmod normal
grub-rescue> normal

This is caused by mis-detection of root device in TMP_CONFIG stub here: 
https://github.com/grml/grml-live/blob/master/etc/grml/fai/config/scripts/GRMLBASE/45-grub-images

cat > "$TMP_CONFIG" <<EOF
search.file /conf/bootid.txt root
set prefix=(\$root)/boot/grub
insmod normal
normal
echo "E: Could not find root device!"
EOF

Where root device is determined using search.file /conf/bootid.txt. This file is present in both 
(hd0) and (hd0,msdos1) and grub seems to simply pick the first device from list from which 
normal.mod cannot be loaded.

After removing syslinux from drive everything seems to work fine but drive boots only on EFI systems 
and I want it bootable on 32bit legacy BIOS systems as well.

Currently it is possible to workaround unbootable state by fixing the root variable manually.

----------
messages: 4963
nosy: blami
priority: bug
status: unread
title: manually created grml96 USB drive fails to boot on EFI system due to grub misdetection of root device

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue1352>
_____________________________________


More information about the Bugs-changes mailing list