Skip to contentSkip to conversation

Using grub2 on a USB stick

DISCUSSION Aaron Brice 1 participant 1 message Mar 12, 2010

lore
Share & tools
lore
#0 lore raw

I am trying to use grub2 on a USB stick. My situation is:

- I'm using RHEL4 which has grub 0.95 installed on the system, and creating another OS in a directory to install onto a USB stick, and I want to use grub2 on that USB stick (but not on the host system).
- I compile grub 1.98 with --prefix=~/grub
- The root of my target system is ~/fsimage. I added a ~/fsimage/boot/grub/grub.cfg and ~/fsimage/boot/grub/device.map which contains "(hd0) /dev/sdc" where /dev/sdc is my USB stick.
- I use genext2fs to create an ext2 image from ~/fsimage, and cat that to /dev/sdc1
- Run ~/grub/sbin/grub-install --no-floppy --root-directory=~/fsimage /dev/sdc

Based on this use case:
http://grub.enbug.org/UseCases/Ubuntu

But I get an error:
~/grub/sbin/grub-probe: error: cannot find a GRUB drive for /dev/sda1.
Check your device.map.
Auto-detection of a filesystem module failed.
Please specify the module with the option '--modules' explicitly.

Is there a way to get this to work? We had this working with grub 0.95 by using:

echo -e "root (hd0,0)\\nsetup (hd0)\\nquit" | /sbin/grub --no-config-file --batch --no-floppy --device-map=<(echo "(hd0) /dev/sdc")

But I'd like to switch it to grub2 if possible..

Thanks,
Aaron