BTS

Message4963

Author blami
Recipients blami
Date 2015-05-20.16:07:27
Content
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.
History
Date User Action Args
2015-05-20 16:07:28blamisetrecipients: + blami
2015-05-20 16:07:28blamisetmessageid: <1432138048.06.0.0940076512414.issue1352@bts.grml.org>
2015-05-20 16:07:28blamilinkissue1352 messages
2015-05-20 16:07:27blamicreate