Title manually created grml96 USB drive fails to boot on EFI system due to grub misdetection of root device
Priority bug Status chatting
Superseder Nosy List blami
Assigned To Topics

Created on 2015-05-20.16:07:28 by blami, last changed 2015-05-21.10:50:08 by mika.

msg4967 (view) Author: mika Date: 2015-05-21.10:50:08
Thanks for verifying, but I fail to see a way how we can fix that (since the
"root=(hd0,msdos1)" is very specific to your setup). Any ideas?
msg4966 (view) Author: blami Date: 2015-05-21.10:31:29
just tried to create another flash drive using grml2usb --grub and boot fails same 
as before
msg4965 (view) Author: blami Date: 2015-05-20.19:58:20
I did not install grub, just copied files from GRML ISO image. I don't even 
have grub installed on my Debian system (I'm using rEFIt).

From passive look into grml2usb sourcecode it seems to me that 
copy_bootloader_files method does basically what I've done manually (and the 
mis-detection happens in efi.img which is just copied over from ISO) but 
there might be something I forgot. I'll try to run grml2usb --grub tomorrow 
and report back.

msg4964 (view) Author: mika Date: 2015-05-20.16:59:09

thanks for the detailed bug report. How did you install grub on the USB drive?
Does it work with using grml2usb with its --grub option?

msg4963 (view) Author: 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-21 10:50:08mikasetmessages: + msg4967
2015-05-21 10:31:29blamisetmessages: + msg4966
2015-05-20 19:58:20blamisetmessages: + msg4965
2015-05-20 16:59:09mikasetstatus: unread -> chatting
messages: + msg4964
2015-05-20 16:07:28blamicreate