Grub syntax?

tbob

Member
Jan 5, 2005
50
0
0
So.... I know someone out there is going to know the answer to all this, but I can't seem to find a simple documentation on grub to do it myself. So here goes:

Someone installed a great Grub bootloader on my sony Vaio. It dual boots XP and linux. My only physical drive had a physical partiton (we'll call it C:, since I grew up using DOS), and 4 logical partitions. The largest of which appears first (D:), the second largest appears second (unreadable from windows, but about 2.5GB large), followed by two pretty small partitions (one I was told was for a Linux type 'swap file' or 'user data'. not sure how that works just yet... and the other one I guess must be for the grub loader).
rundown:
C: 11.3 GB
D: 13 GB
(unreadable in Win/Dos) 2.5 GB
(unreadable in Win/Dos) ??
(unreadable in win/Dos) ??


So silly me decides I need to split up my D: drive into two new partitions. I do it through XP because I want them to be NTFS (we're dealing with large files here). Now when I reboot, it says "loading Grub Stage2...." very briefly, then spits me out at a Grub prompt

grub>

My assumption here is that I am in Grub Stage1, but it can't find stage2 because I moved it. Worst case scenario, Stage2 was on D: and I deleted it. if that's the case, how do I get it back? Assuming first case, I decided to try to chainload XP myself.

so I pressed TAB to figure out what my commands were, and I used 'help' to figure out how to use those commands. but all of them require that I use a file name. how do I know what the files are called, or how to access a hard drive!?

Is there no 'ls' or 'dir' command? how am I supposed to know what to type? please help!

thanks!

also, once I am finally able to boot, how do I make the tax cuts permane... I mean, how do I change the grub menu files and configuration so that in the future, things will be OK?
 

tbob

Member
Jan 5, 2005
50
0
0
More info:

I typed in "root (hd0," then hit tab and it gave me the following list:

partition num: 0, filesystem type fat, 0xC
partition num: 4, filesystem type unknown, 0x7
partition num: 5, filesystem type unknown, 0x7
partition num: 6, filesystem type ext2fs, 0x83
partition num: 7, filesystem type unknown, 0x82
partition num: 8, filesystem type ext2fs, 0x83

so which one do I try to boot from? I can't tell which one is the Windows boot (C:[boot] is fat32, D: is NTFS, E: is NTFS)

I'm going to guess (hd0,0) is the XP booter, (hd0,4) and (hd0,5) are the NTFS guys, and the others...?

I guess I'll follow some of the docs to try to chainboot XP. any ideas on how to edit the config or menus?
 

tbob

Member
Jan 5, 2005
50
0
0
ok ok,

now I got XP to boot manually in the command-line by typing the following:

rootnoverify (hd0,0)
chainloader +1
boot

but how do I edit the GRUB menu without getting to the menu itslef!?
 

ColKurtz

Senior member
Dec 20, 2002
429
0
0
Try "setup (hd0)" from the grub prompt. This should reconfigure grub. If it doesn't boot to your linux disc and choose repair mode and run the command from there.

BTW, part0 is likely the XP drive, 4 and 5 are your new NTFS partitions, 6 and 8 are linux drives, and 7 is likely your linux swap drive.
 

silverpig

Lifer
Jul 29, 2001
27,703
12
81
Well 0x82 is linux swap so that isn't it.
It's going to be either partition 6 or 8 depending on where you installed your kernel. They are both linux system partitions.

Your grub.conf (when you can edit it) should probably look like this:

default 0
timeout 30
splashimage=(hd0,6 or 8 depending on which is your boot partition)/path/to/splash.xpm.gz (I'm going to guess /grub/splash.xpm.gz as you seem to have a dedicated /boot partition)

title=Linux
root (hd0,6 or 8)
kernel /boot/linux-kernel-name-here (or just linux-kernel-name-here if you have a separate partition) root=/dev/hdXY (this will change almost for sure. Probably just increment the number one (hda4 -> hda5))

title=WinXP
root (hd0,0)
chainloader +1

You have to make sure you change where it says (hd0,whatever) to (hd0,whatever+1) is most likely it, and /dev/hdXY to /dev/hdX(Y+1) to get the correct info to grub.
 

tbob

Member
Jan 5, 2005
50
0
0
yes yes, like magic!
now when I boot it says "GRUB loading stage 1.5" (not Stage2 anymore?)
I get a menu:

Red Hat Linux (2.4.7-10)
Windows XP

think you were right about the partitions. 0x7 must be NTFS ande 0xC must be fat32.

the XP menu option was set up as "rootnoverify (hd0,0)"
whereas the Linux is "root (hd0,5)".
however, when I try to select the Linux option, it fails. I'll change it to 0,6...

OK, in this case, it boots a while, then says:
Kernel panic: no init found. Try passing init= option to kernel

Thanks so much for your help! my questions now are:

1) do I need to have GRUB Stage2 loading or is Stage1.5 OK? (Stage2 had pretty graphics)
2) how do i fix linux?
3) why did it think linux was on (hd0,5) ?
4) how can I edit grub.conf?
 

tbob

Member
Jan 5, 2005
50
0
0
I just have a few basic questions now...

1) do I need to have GRUB Stage2 loading or is Stage1.5 OK? (Stage2 had pretty graphics)
2) how do i fix linux?
3) why did it think linux was on (hd0,5) ?
4) how can I edit grub.conf?