Scot’s Newsletter Forums

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> What to do when you get the GRUB prompt
linuxdude32
post Jan 10 2004, 05:55 PM
Post #1


Board Bigwig
***********

Group: Members
Posts: 2,677
Joined: 3-June 03
From: Peterborough, Ontario, CANADA
Member No.: 1,400



GRUB stands for GRand Unified Bootloader. It's meant as a alternative to the widely-used LILO (LInux LOader). In many ways, it is superior to LILO. One such advantage of GRUB is that if the configuration file is incorrect or corrupted, you may still be able to boot your system. It does require a basic familiarity with using GRUB in Interactive mode. This tip is meant to help you do that.

Situation: You boot and you get some error about loading a GRUB kernel and then a black screen with this text (or similar):

QUOTE
GRUB  version 0.93  (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]

grub>


First of all, you need to know how GRUB numbers drives and partitions. Hopefully, Bruno doesn't mind me stealing this from one of his posts:

QUOTE
Grub uses its own naming structure for drives and partitions, in the form of (hdn,m), where n is the hard drive number, and m the partition number, both starting from zero. This means, for instance, that partition hda1 is (hd0,0) to Grub, and hdb2 is (hd1,1). In contrast to Linux, Grub doesn't consider CD-ROM drives to be hard drives, so if you have a CD on hdb, for example, and a second hard drive on hdc, that second hard drive would still be (hd1).


Note that GRUB doesn't care if it's SCSI or IDE, it still starts with hd.

So here's how to boot a kernel with that > prompt:

You need to specify the GRUB "root". Root can mean a lot of things in Linux, but in this case GRUB just needs to know the drive where the kernel is that you wish to boot. The following commands use this information. Here's how you specify the "root" (note that I'm showing grub> for clarity, don't enter it):

(don't hit <enter> at the end... yet)

grub> root (hd

and then hit the <tab> key, GRUB will stick in a zero if you only have a single hard-drive or give you a list of drives if you have more than one. This first number is referring to a physical hard drive, not just a partition. Enter a comma and then hit <tab> again and you'll see a list of partitions to choose from next like this:

QUOTE
Possible partitions are:
   Partition num: 0,  Filesystem type unknown, partition type 0x7
   Partition num: 2,  Filesystem type unknown, partition type 0x83
   Partition num: 3,  Filesystem type unknown, partition type 0x4
   Partition num: 4,  Filesystem type is fat, partition type 0xb
   Partition num: 5,  Filesystem type unknown, partition type 0x82
   Partition num: 6,  Filesystem type is reiserfs, partition type 0x83


This can help you choose the partition that has the Linux kernel on it if you're not sure. Pick a number and then type the remaining parenthesis and <enter> so a complete example line would look like this:

grub> root (hd0,5)

Now that's choose the kernel. If we're not sure the kernel is here, this next command will show us that, in which case you'd go back and choose another partition (or drive and partition if applicable in your situation):

(don't hit enter after this, yet)

grub> kernel /boot/

Hit <tab> again and you'll get a list of the kernels that grub sees on that partition in /boot. Isn't this cool? If it can't find any kernels, make sure you entered /boot after kernel and then go back to the previous root command and try a different one. Remember that GRUB counts beginning at zero so hda6 would show up in grub as (0,5). Assuming you find a kernel, type the unique letters to it (you can hit <tab> to finish it) and then enter a space to append "root=" on the end with the location of the Linux root directory. This root is the regular meaning of root in that it refers to where Linux normally mounts the "/" filesystem. Unless you've custom partitioned, it'll be the same drive and partition as where /boot is. This time you have to give it the term Linux uses to refer to that drive like "/dev/hda7". I don't think auto-complete works here so you'll have to be specific. Here's a sample line where /boot and / are on the same partition:

grub> kernel /boot/vmlinuz root=/dev/hda6

Note that /dev/hda6 and (hd0,5) refer to the same partition.

The next command may or may not be optional depending on whether your system needs an initrd file to boot. If you don't think you need it, just skip this part:

(don't hit <enter> yet)

grub> initrd /boot/

Hit <tab> again to show eligible initrd files and type enough letters to auto-complete the rest with another <tab>. The final example line will look similar to this:

grub> initrd /boot/initrd

Note the above settings on some paper so you know what they are. Now the last command:

grub> boot
(hit enter)

If you get a kernel panic and a blurb about needing a root, then you probably forget to add the root= part on the end of the kernel line, and if you get an error message referring to initrd, then you need this line. This is also why you should write down the settings you use. Reboot, and try again.

Once you've booted you should edit GRUB directly (the above changes didn't install anything, it just got you running) or use your distributions boot loader configuration tool (in SuSE, I use the one in YaST under System) to edit grub using the parameters above.

Hopefully this is helpful to people and I haven't made any bad typos. Corrections, suggestions or criticism is appreciated.


--------------------
Jason Wallwork, Registered Linux User #255670
Founder, Peterborough Linux User Group
Go to the top of the page
 
+Quote Post
Bruno
post Jan 10 2004, 06:11 PM
Post #2


Le Professeur Pingouin
Group Icon

Group: Forum Admins
Posts: 37,904
Joined: 4-April 03
From: Amsterdam
Member No.: 611



Hi Jason

Thanks dude ! . . And no I don´t mind !! biggrin.gif biggrin.gif
Do you think there is anything I should add to Tip or shall I just put a link to this post at the end ??


cool.gif Bruno

PS: Your PM box is blocked . . . I can not send you any because it refuses to take them and gives the message that your box is full.


--------------------
Go to the top of the page
 
+Quote Post
linuxdude32
post Jan 10 2004, 06:46 PM
Post #3


Board Bigwig
***********

Group: Members
Posts: 2,677
Joined: 3-June 03
From: Peterborough, Ontario, CANADA
Member No.: 1,400



QUOTE (Bruno @ Jan 10 2004, 05:06 PM)
Do you think there is anything I should add to Tip or shall I just put a link to this post at the end ??

PS: Your PM box is blocked . . . I can not send you any because it refuses to take them and gives the message that your box is full.

It doesn't seem simple enough for a tip and would probably just confuse beginners to Linux. I'm thinking just leave it here and anybody doing a search for grub would find it (assuming they were in SNLF, of course). A link from your tips would enable more people to find it if their system didn't boot all of a sudden. I only saw the one section you had on GRUB. Did you have another one that covered this already?

As for my mailbox, I suddenly saw the message the top saying it was full! I had no idea, but it's cleaned up now!


--------------------
Jason Wallwork, Registered Linux User #255670
Founder, Peterborough Linux User Group
Go to the top of the page
 
+Quote Post
striker
post Jan 10 2004, 07:00 PM
Post #4


linuxified
*************

Group: Honorary Moderators
Posts: 8,002
Joined: 14-July 03
Member No.: 1,695



Thanks Jason, copied this one and printed.
Much appreciated !


--------------------
striker
registered linux user:330454
Go to the top of the page
 
+Quote Post
Bruno
post Jan 10 2004, 07:07 PM
Post #5


Le Professeur Pingouin
Group Icon

Group: Forum Admins
Posts: 37,904
Joined: 4-April 03
From: Amsterdam
Member No.: 611



The thread is linked wink.gif


cool.gif Bruno


--------------------
Go to the top of the page
 
+Quote Post
pc-tecky
post Jan 10 2004, 07:33 PM
Post #6


Thread Head
******

Group: Members
Posts: 656
Joined: 20-September 03
Member No.: 1,924



Thanks, Bruno. I'm sure if it wasn't, it'd get lost over time.


--------------------
Registered Linux user #339748.
Go to the top of the page
 
+Quote Post
zox
post Jan 10 2004, 08:29 PM
Post #7


Multithreader
Group Icon

Group: Forum MVP
Posts: 1,234
Joined: 16-March 03
From: Ottawa, Canada
Member No.: 14



Thanks for info.
Hopefully Scot and Arena have nice backups of DB in case something goes wrong.
I'd hate to see all this nice info gone sad.gif


--------------------

Registered Linux User #314959
Go to the top of the page
 
+Quote Post
mhbell
post Jan 10 2004, 09:07 PM
Post #8


Forum Fiend
*********

Group: Members
Posts: 1,692
Joined: 26-April 03
From: Land of Sunshine, Yuma Arizona in Winter Nevada in Summer
Member No.: 896



Thanks Jason
Wish I would have had this the other day. But I got it going once everyone in the forum jumped in and helped me. BTW I installed the 2.6 0 kernel in SuSE 9.0 pro But I will save that for another post.
Mel
thumbsup.gif


--------------------
Registered Linux User #239772
Ubuntu 9.10 (Karmic Koala)
No More MS Windows
Blogger: http://melpctec.blogspot.com/
Go to the top of the page
 
+Quote Post
LilBambi
post Jan 10 2004, 09:40 PM
Post #9


Australisches Googler
Group Icon

Group: Forum Admins
Posts: 10,722
Joined: 19-March 03
From: Virginia
Member No.: 100



Thanks Jason! Having always used LILO in the past, it was great to read about GRUB and the step by step was great! Between this and Bruno's Tips about GRUB, I think all will be able to get the help they need with it.

thumbsup.gif


--------------------
Go to the top of the page
 
+Quote Post
Owyn
post Jan 10 2004, 09:42 PM
Post #10


Posting Prodigy
Group Icon

Group: Forum MVP
Posts: 2,068
Joined: 5-September 03
From: Canada
Member No.: 1,808



Well written Jason.

Bruno's tip and your description of the the Grub prompt complement each other very well.


--------------------
Owyn
Linux User #327270
Go to the top of the page
 
+Quote Post
linuxdude32
post Jan 11 2004, 08:38 PM
Post #11


Board Bigwig
***********

Group: Members
Posts: 2,677
Joined: 3-June 03
From: Peterborough, Ontario, CANADA
Member No.: 1,400



Thanks guys! You're all so encouraging. You're welcome to visit PLUG anytime. It'd be easier to do presentations if I got compliments like that all the time. Might go to my head, though! laugh.gif

Thanks for linking it, Bruno!


--------------------
Jason Wallwork, Registered Linux User #255670
Founder, Peterborough Linux User Group
Go to the top of the page
 
+Quote Post
havnblast
post Jan 11 2004, 08:43 PM
Post #12


Discussion Deity
************

Group: Members
Posts: 4,876
Joined: 9-March 03
From: North Dakota
Member No.: 3



I always did like Grub over Lilo

Great Job Jason!


--------------------
Kelly - Registered Linux User #317260
Home Page
Go to the top of the page
 
+Quote Post
SonicDragon
post Jan 11 2004, 08:50 PM
Post #13


Discussion Deity
Group Icon

Group: Forum MVP
Posts: 4,188
Joined: 26-March 03
From: USA - MA
Member No.: 396



Nice tip! Thanks!

I'm sure the PLUG with love it wink.gif


--------------------
~SonicDragon
Registered Linux User: 322485 -- Slackware-Current
Go to the top of the page
 
+Quote Post
quint
post Jan 11 2004, 08:53 PM
Post #14


Linux Miner
Group Icon

Group: Forum MVP
Posts: 3,893
Joined: 6-April 03
Member No.: 764



Excellent, Jason, thanks! Have always used LILO - without any problems - but I've got an "old" hdd laying around, so will use your post and Bruno's tip, in an experiment...I've always wanted to "explore" GRUB.


--------------------
~ ® Linux User # 314972 ~ ® Ubuntu User # 12930 ~

If you tell the truth you don't have to remember anything.
-- Mark Twain


Go to the top of the page
 
+Quote Post
jodef
post Jul 8 2004, 10:38 PM
Post #15


Multithreader
********

Group: Members
Posts: 1,409
Joined: 7-December 03
Member No.: 2,179



Jason must admit when I first read this tip a few months ago it seemed like gibberish.I have always used lilo.I did an install of Fedora a few months ago decided to try GRUB and liked it however configuring was troublesome so I went back to lilo.

I decided to give GRUB another try I like this lazy man's bootloader ie no copying of vmlinuz files required;no rescue CD etc thumbsup.gif w00t.gif configuring stumped me however rant.gif I remembered this post and tried it and after a few attempts got my 3 OSes to boot from GRUB w00t.gif

Thanks Jason for this very excellent tutorial thumbsup.gif thumbsup.gif

P.S. in the more recent versions of GRUB at least those I've tried the root option doesn't seem to be used ie I only had to configure kernel and initrd lines. wink.gif
Go to the top of the page
 
+Quote Post
ferry_ong
post Jul 9 2005, 04:29 PM
Post #16


New Kid
*

Group: Members
Posts: 1
Joined: 9-July 05
Member No.: 3,600



hi there,

i installed suse 9.1 personal in VMWare 4.5 (I put HD = 50 GB for this VM)
then put in some stuff, it was working Ok until I felt the system was really slow. Then power off the VM, then only get this grub prompt.

I've tried:
> root (hd0,0) --> I only have 1 hd
Filesystem type unknown, partition type 0x82

> kernel /boot/
Error 17: Cannot mount selected partition

what should I do?

thanks.
Go to the top of the page
 
+Quote Post
Bruno
post Jul 9 2005, 04:48 PM
Post #17


Le Professeur Pingouin
Group Icon

Group: Forum Admins
Posts: 37,904
Joined: 4-April 03
From: Amsterdam
Member No.: 611



Hi Ferry

Welcome to the forum

I never tried VMware so I can not really advise you about it . . . but it seems to me that once you installed it in VMware you need VMware to run it every time you want to boot it. Maybe installing SUSE on its own partition without VMware will be a better idea.


Maybe we should start a new topic about this so it will get more attention. So if you want me to split it off let me know and I will do that for you.


cool.gif Bruno


--------------------
Go to the top of the page
 
+Quote Post
Dard
post Jul 9 2005, 07:35 PM
Post #18


Thread Head
******

Group: Members
Posts: 626
Joined: 14-January 04
From: Florida usa
Member No.: 2,235



Thanks Jason, great job, after reading your GRUB tip I feel that I could actually use GRUB, and add other OS's to it.

It's my understanding that lilo is a 16 bit bootloader and grub is a 32 bit bootloader. And with mass adoption of 64 bit computers just a few years away I suspect that grub will the bootloader most distributions will use. Probably be real easy to port grub to 64 bit.


--------------------
Dard
Go to the top of the page
 
+Quote Post
burninbush
post Jul 10 2005, 09:26 PM
Post #19


Topic Cop
*******

Group: Members
Posts: 871
Joined: 28-June 05
Member No.: 3,585



"Grub uses its own naming structure for drives and partitions, in the form of (hdn,m), where n is the hard drive number, and m the partition number, both starting from zero. This means, for instance, that partition hda1 is (hd0,0) to Grub, and hdb2 is (hd1,1). In contrast to Linux, Grub doesn't consider CD-ROM drives to be hard drives, so if you have a CD on hdb, for example, and a second hard drive on hdc, that second hard drive would still be (hd1).

Note that GRUB doesn't care if it's SCSI or IDE, it still starts with hd.">seen up the thread


+++++++++++++

I gotta jump in here with a detail that commonly kills grub; it natively gets its info about drives from bios -- the first drive that bios finds in its POST search becomes grub's hd0, the second becomes hd1, third hd2, etc., etc.

We'd like to think that grub's ordering follows some absolute natural ordering scheme like /dev/hda, /dev/hdb, /dev/sda, etc ... BUT, any modern mobo will allow the user to set a custom boot order in cmos setup -- and thus that /dev/sda might very well become bios #1 'find', and thus grub's hd0.

Change boot order in bios, and every menu.lst on your machine is instantly wrong. This is the one place that lilo has a better design. [and so has loadlin.exe, the booter I use here]

There is a fix for this -- the /boot/grub/device.map file -- where absolute assignments are made. Sadly, many distros don't implement that file -- and hardly any publish any information about it; after you edit your menu.lst file, you must also check that it doesn't disagree with an existing device.map file.

There's another problem I haven't yet figured how to solve -- and that is giving grub in manual mode all of those kernel parms that don't match any known keyword in grub.

Onward!
Go to the top of the page
 
+Quote Post
réjean
post Jul 11 2005, 04:36 PM
Post #20


Discussion Deity
************

Group: Members
Posts: 3,160
Joined: 26-November 04
From: Cape Breton Nova Scotia Canada
Member No.: 2,935



Thanks Jason!
I too printed your tips in case I am on a machine that agrees with Grub. Unfortunately each time I tried to install a distro I got the dreaded Grub 1.5 (or something similar) with an Error 16 (or was it 17?) and there was nothing I could do to fix it. But for a more recent machine I will definitely give Grub a try and use your tips.
Thanks again!


--------------------

registered linux user #374889
Go to the top of the page
 
+Quote Post
moon
post Jan 4 2008, 10:33 AM
Post #21


Message Adept
***

Group: Members
Posts: 44
Joined: 26-May 03
Member No.: 1,238



Hi,
If grub does still does not install, u can try to edit/correct 2 more files:
/etc/fstab and /etc/mtab (correct hdax ref. to /)
That is what i had to do when i imaged an ext3 partn.(RIP) from hdc1 to hda1.
Regards
Go to the top of the page
 
+Quote Post
Bruno
post Jan 4 2008, 02:10 PM
Post #22


Le Professeur Pingouin
Group Icon

Group: Forum Admins
Posts: 37,904
Joined: 4-April 03
From: Amsterdam
Member No.: 611



QUOTE (moon @ Jan 4 2008, 03:33 PM) *
u can try to edit/correct 2 more files:
/etc/fstab and /etc/mtab (correct hdax ref. to /)
. . . sorry to interrupt . . but you should not change the /etc/mtab file, it gets dynamically build and only reflects what is mounted at a certain time. So changes in the /etc/fstab will automatically be reflected in /etc/mtab.


cool.gif Bruno


--------------------
Go to the top of the page
 
+Quote Post
moon
post Jan 8 2008, 10:38 AM
Post #23


Message Adept
***

Group: Members
Posts: 44
Joined: 26-May 03
Member No.: 1,238



QUOTE (Bruno @ Jan 4 2008, 01:10 PM) *
. . . sorry to interrupt . . but you should not change the /etc/mtab file, it gets dynamically build and only reflects what is mounted at a certain time. So changes in the /etc/fstab will automatically be reflected in /etc/mtab.
cool.gif Bruno


You r right Bruno ( provided the pcboots at least once).
Here is what happened in my case:
1.After restoring the image, i get a non-responding Grub prompt (blinking cursor after cool.gif...only cntrl-alt-del works.
2.I did initial boot with rip cd and then continued the boot via the restored image.
3.Boot failed midway (kernel panic)..i did not know about fstab at that moment.
4.So i try to reinstall grub (boot cd, mount partn, edit files, chroot, execute script grub_install )....failure. Finally, made the change to fstab.
5.Tried grub install again. Failure.
6.Only when mtab file was edited did grub install.

Regards

Hey i don't know how that smiley creeped in...it should read as " after the letter "B" of GRUB"
Go to the top of the page
 
+Quote Post
Bruno
post Jan 8 2008, 02:01 PM
Post #24


Le Professeur Pingouin
Group Icon

Group: Forum Admins
Posts: 37,904
Joined: 4-April 03
From: Amsterdam
Member No.: 611



Glad you got it fixed Moon . . . thumbsup.gif . . . . must have been a blib why mtab did not get updated with the new info automatically wink.gif


cool.gif Bruno


PS: About the smiley you got: if you type a "B" and a ")" without space between them you do get the secret code for cool.gif


--------------------
Go to the top of the page
 
+Quote Post
moon
post Jan 9 2008, 10:06 AM
Post #25


Message Adept
***

Group: Members
Posts: 44
Joined: 26-May 03
Member No.: 1,238



" must have been a blib why mtab did not get updated with the new info automatically "
Blib means a one off event?

I think "why mtab did not get updated with the new info automatically " is bec. i did not give a chance for pc to boot properly i.e. After step 4, step 2 (boot:root=/dev/hda1) should have been the next step again.

Just for completeness...step 4...."edit files" refer to grub_install script (install_device=(hd0,0), menu.lst, device.map

I will come back here if i confirm a peculiar behaviour of grub...it sort of "remembers" the HD on which it was installed (some bit for bit copy i did of slack11 partn. in RPM on another HD)
Regards
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 9th February 2010 - 07:23 AM