Author blami
Recipients blami
Date 2015-05-20.16:07:27
USB drive created as follows (
  - two partitions: sda1 formatted as vfat for ESP holding grml, and sda2 formatted as ext2 for 
  - 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
grub-rescue> echo $prefix

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:

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

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.
Date User Action Args
2015-05-20 16:07:28blamisetrecipients: + blami
2015-05-20 16:07:28blamisetmessageid: <>
2015-05-20 16:07:28blamilinkissue1352 messages
2015-05-20 16:07:27blamicreate