[kwlug disc.] am I asking too much of grub?

unsolicited unsolicited at swiz.ca
Tue Apr 22 01:13:08 EDT 2008


Chris Bruner wrote, On 04/21/2008 9:44 PM:
> I'm trying to boot off a usbkey using grub as my boot loader.
> I've gotten it to the point where it loads the stage2, but it can't seem 
> to understand the filesystem on the usbkey. (ext2)
> 
> My system is configured as
> /dev/hda1   swap
> /dev/hda2   linux (ext2)
> 
> sda1   linux (ext2)
> 
> I've also given it space at the beginning of the usbkey to have the grub 
> stage 1 part, so the start block of the partition is 2 instead of the 
> normal 1.
> 
> The grub menu.lst is
> 
> Title RoboDev
> root (hd0,0)
> kernel (hd0,0)/vmlinuz-2.6.25 root=/dev/sda1 ro vga 773
> 
> and so on
> 
> Instead of the normal grub menu coming up, I get the grub command prompt.
> 
> It seems it doesn't even get to the menu.lst
> Trying to do a manual load of the config file and kernel is similarly 
> fruitless, but I am able to load the files from the hard disk.
> 
> Does anyone have any idea what could be wrong?

I don't have all the answers, but ...

Interesting you pose this, as I am going through exactly these issues 
right now. In my case I am not only prepping usb keys, but I have a 
usb disk partitioned multiple times as staging areas for these keys 
while I figure things out. In my case, I have a 32 MB partition first 
on the usb disk, to grub into each partition depending upon the menu 
key. I want it to chain to the partition then continue. So when I dump 
to each usb key, that key's partition still works.

FWIW, if you don't have absolute success with this, you might consider 
grub for dos. https://sourceforge.net/projects/grub4dos and 
https://gna.org/projects/grub4dos/. The only reason I suggest this is, 
being dos, one can try the diskette, not have it quite right, stick it 
in another machine, pop it back and try again. Any machine. Without 
having to boot a live cd to get at menu.lst.

This isn't relevant here, but a couple things I've found: Once grub is 
loaded, from wherever it loads, it is (hd0,0).

 From the command line of grub, you can issue 'root (hd0,0)', and it 
should come back with what you expect. e.g. a partition was found and 
what type it is. In your case, if you land on swap, you know you're in 
the wrong place. If you don't land on swap, and the wrong place, 
there's only one place left to try! (-:

If it's the wrong one, you can do 'root (hd0,1)' or 'root (hd1,0)' in 
your case, and see if you've now gotten yourself to the right place. 
Repeat as required. When you run out of drives or partitions, it will 
tell you. [This was important for me in that I didn't realize grub 
always calls itself hd0,0, and with so many disks and partitions 
flying around, I quickly lost track of what where I wanted to be at 
the time was called.] Moreover, it was the only way I ultimately 
figured out that the machine I was working on wouldn't boot from usb, 
even with a grub diskette and chainloading. <sigh>

Once at a 'root (hdx,y)' you can then do find, or find /, or find 
/file, or find /file/file/file, to verify you're where you think you 
should be.

Not sure about grub, but grub for dos then lets you do 
chainloader()/file/file/file, boot, to make the attempt. i.e. With () 
you don't have to remember where the heck you are now.

I'm not certain from your example whether you're trying to boot hda2 
or sda1.

At a guess, you can try:

c - command line.
root (hd0,1) - for hda2? Or perhaps you want (hd1,0) for /sda1?
find /vmlinuz-2.6.25 - should show you you're in the right place. And 
probably reveal where it is if you're not.
kernel (hd0,0)/vmlinuz-2.6.25 root=/dev/sda1 ro vga 773
boot - should make things happen.

If your problem lies within your start block points then you are 
beyond my expertise for the moment.

(hd0,0)-> /dev/sda1, looks suspicious to me, but probably isn't.

(hd0,0)/vmlinuz-2.6.25 root=/dev/sda1 - does your mapping file within 
/boot/grub/device.map look right?

If you're booting from usb, and it's sda1, then isn't (hd0,0) = 
/dev/sda1, and is each in the right form for its place in the line?

HTH


More information about the KWLUG-Disc mailing list