I'm trying to get grub2 to boot by xen image off of a USB thumb drive. However, it's not working for some reason.
My original grub entry was the following, and this works off of an LVM partitions HDD:
menuentry 'Xen 4 (Linux 2.6.32.50-xen)' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 6542fe50-82e2-467a-b832-7cf92f71bc98
multiboot /xen.gz placeholder noreboot
module /vmlinuz-2.6.32.50-xen placeholder root=/dev/mapper/xenserver-root ro
module /initrd.img-2.6.32.50-xen
}
But, not off the thumb drive which is partitioned as ext2 with no LVM.
Currently it looks like this:
menuentry 'Xen 4 (Linux 2.6.32.50-xen)' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 55425e50-82e2-4c74-b860-7cf92f91b423
multiboot /xen.gz placeholder noreboot
module /vmlinuz-2.6.32.50-xen placeholder root=/dev/sda1 ro
module /initrd.img-2.6.32.50-xen
}
The way I understand this is that set root='(hd0,1)' sets the root environment variable to be the first hard disk, first partition. Now, what does the search line do?
According to the grub2 documentation for the search command and if I'm understanding it correctly, if a disk with that uuid is found it will set root to that uuid... or is that the first partition on that disk?? so if it doesn't find it does that mean it defaults to (hd0,1)?
This is currently not working for me it says I need to load a multiboot kernel first. So it's obviusly not finding xen.gz. Could it be that I need to remove the --no-floppy? I know some BIOS' treat USB thumb drives as floppy disks. Although on my system it's coming up as /dev/hda. If it insert a hard disk it's /dev/hdb. Is this still going to work? What should I set the root= line to given that LVM is not installed and /dev/mapper/xenserver-root doesn't exist. I've seen some people set this to /dev/hdb1 but I'd like it to figure this out automatically or be generated by update-grub.
How would I get this working? I've tried lots of options, but obviously not the right one.
After a lot of experimenting, I did actually get it to work. And in the process I have found out what search does and learned a lot about grub and the grub command line in the process. It's not as difficult as it seems.
The problem with my entries is that i needed to prefix /boot/ to the filename for both multiboot & module entries.
I also found out that search does what I think it does. It looks for the file or filesystem uuid (depending on option) and sets root to be the disk location & partition number.
So the initial set root='(hd0,1)' line is a bit redundant. It seems as though it'll default to that if the search fails.