Tuesday, September 23, 2014

Snatching the root device from grub-install

# grub-install --debug --boot-directory /media/usb/boot /dev/sdh
[...]
grub-install: info: guessed root_dev `hostdisk//dev/sdh' from dir `/media/usb0/boot/grub/i386-pc'.
grub-install: info: setting the root device to `hostdisk//dev/sdh,msdos1'.
[...]
Goddamit, GRUB!  This is not what you've just set as root device -- core.img cannot possibly know what /dev/sdh means.

I can't believe I have to resort to strace to get the right answer:
write(2, "grub-mkimage --directory '/usr/lib/grub/i386-pc' --prefix '(,msdos1)/boot/grub' --output '/media/usb0/boot/grub/i386-pc/core.img' --format 'i386-pc' --compression 'auto'  'ext2' 'part_msdos' 'biosdisk' \n", 203) = 203
There: "(,msdos1)" is the actual root device.  Was that too much to ask?

No comments: