Jump to content


What to do when you get the GRUB prompt


  • Please log in to reply
27 replies to this topic

#1 OFFLINE   linuxdude32

linuxdude32

    Board Bigwig

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,702 posts

Posted 10 January 2004 - 05:55 PM

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 (hdand 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/hda6Note 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/initrdNote 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

#2 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 10 January 2004 - 06:11 PM

Hi JasonThanks dude ! . . And no I don´t mind !! :whistling: :DDo you think there is anything I should add to Tip or shall I just put a link to this post at the end ??<_< BrunoPS: 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.

#3 OFFLINE   linuxdude32

linuxdude32

    Board Bigwig

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,702 posts

Posted 10 January 2004 - 06:46 PM

Bruno, on Jan 10 2004, 05:06 PM, said:

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

#4 OFFLINE   striker

striker

    handyman

  • Honorary Moderators
  • 8,501 posts

Posted 10 January 2004 - 07:00 PM

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

#5 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 10 January 2004 - 07:07 PM

The thread is linked <_<:whistling: Bruno

#6 OFFLINE   pc-tecky

pc-tecky

    Thread Head

  • Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 10 January 2004 - 07:33 PM

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

#7 OFFLINE   zox

zox

    Multithreader

  • Forum MVP
  • 1,234 posts

Posted 10 January 2004 - 08:29 PM

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  :whistling:

#8 OFFLINE   mhbell

mhbell

    Forum Fiend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,980 posts

Posted 10 January 2004 - 09:07 PM

Thanks JasonWish 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 :whistling:
Registered Linux User #239772
Open Suse 12.1 Gnome, Xfce, Cairo Dock, Cinnimon
Windows 7, Windows 8 Beta
Blogger: http://melpctec.blogspot.com/

#9 OFFLINE   LilBambi

LilBambi

    Australisches Googler

  • Forum Admins
  • 21,823 posts

Posted 10 January 2004 - 09:40 PM

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.:whistling:
Bambi
AKA Fran

Posted Image
My Public Key for Email :: BambisMusings Blog :: Fran's Computer Services Blog :: MyPassionIsBooks Blog :: 5BuckReview :: CNIRadio
"The Net interprets censorship as damage and routes around it." ~John Gilmore (Time Magazine, Dec 6, 1993)

#10 OFFLINE   Owyn

Owyn

    Posting Prodigy

  • Forum MVP
  • 2,068 posts

Posted 10 January 2004 - 09:42 PM

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

#11 OFFLINE   linuxdude32

linuxdude32

    Board Bigwig

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,702 posts

Posted 11 January 2004 - 08:38 PM

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!  B) Thanks for linking it, Bruno!
Jason Wallwork

#12 OFFLINE   havnblast

havnblast

    Discussion Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 4,878 posts

Posted 11 January 2004 - 08:43 PM

I always did like Grub over LiloGreat Job Jason!

#13 OFFLINE   SonicDragon

SonicDragon

    Discussion Deity

  • Forum MVP
  • 4,188 posts

Posted 11 January 2004 - 08:50 PM

Nice tip! Thanks!I'm sure the PLUG with love it B)

#14 OFFLINE   quint

quint

    Linux Miner

  • Forum MVP
  • 3,898 posts

Posted 11 January 2004 - 08:53 PM

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



#15 OFFLINE   jodef

jodef

    Multithreader

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,429 posts

Posted 08 July 2004 - 10:38 PM

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:  :D configuring stumped me however ;) I remembered this post and tried it and after a few attempts got my 3 OSes to boot from GRUB :w00t:Thanks Jason for this very excellent tutorial :w00t:  ^_^   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. :o

#16 OFFLINE   ferry_ong

ferry_ong

    New Kid

  • Members
  • Pip
  • 1 posts

Posted 09 July 2005 - 04:29 PM

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 hdFilesystem type unknown, partition type 0x82> kernel /boot/Error 17: Cannot mount selected partitionwhat should I do?thanks.

#17 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 09 July 2005 - 04:48 PM

Hi FerryWelcome to the forumI 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.o:) Bruno

#18 OFFLINE   Dard

Dard

    Thread Head

  • Members
  • PipPipPipPipPipPip
  • 626 posts

Posted 09 July 2005 - 07:35 PM

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.

#19 OFFLINE   burninbush

burninbush

    Multithreader

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts

Posted 10 July 2005 - 09:26 PM

"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!

#20 OFFLINE   rjean

rjean

    Discussion Deity

  • Forum MVP
  • 4,330 posts

Posted 11 July 2005 - 04:36 PM

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

#21 OFFLINE   moon

moon

    Message Adept

  • Members
  • PipPipPip
  • 44 posts

Posted 04 January 2008 - 10:33 AM

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

#22 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 04 January 2008 - 02:10 PM

View Postmoon, on Jan 4 2008, 03:33 PM, said:

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.:thumbsup: Bruno

#23 OFFLINE   moon

moon

    Message Adept

  • Members
  • PipPipPip
  • 44 posts

Posted 08 January 2008 - 10:38 AM

View PostBruno, on Jan 4 2008, 01:10 PM, said:

. . . 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.:D 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 :whistling:...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. RegardsHey i don't know how that smiley creeped in...it should read as " after the letter "B" of GRUB"

#24 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 08 January 2008 - 02:01 PM

Glad you got it fixed Moon . . .  :D . . . . must have been a blib why mtab did not get updated with the new info automatically ;):whistling: BrunoPS: About the smiley you got: if you type a "B" and a ")" without space between them you do get the secret code for :happyroll:

#25 OFFLINE   moon

moon

    Message Adept

  • Members
  • PipPipPip
  • 44 posts

Posted 09 January 2008 - 10:06 AM

" 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.mapI 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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users