Scot’s Newsletter Forums

Welcome Guest ( Log In | Register )

> 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

Posts in this topic
- linuxdude32   What to do when you get the GRUB prompt   Jan 10 2004, 05:55 PM
- - Bruno   Hi Jason Thanks dude ! . . And no I don´t mi...   Jan 10 2004, 06:11 PM
- - linuxdude32   QUOTE (Bruno @ Jan 10 2004, 05:06 PM)Do you t...   Jan 10 2004, 06:46 PM
- - striker   Thanks Jason, copied this one and printed. Much ap...   Jan 10 2004, 07:00 PM
- - Bruno   The thread is linked Bruno   Jan 10 2004, 07:07 PM
- - pc-tecky   Thanks, Bruno. I'm sure if it wasn't, it...   Jan 10 2004, 07:33 PM
- - zox   Thanks for info. Hopefully Scot and Arena have nic...   Jan 10 2004, 08:29 PM
- - mhbell   Thanks Jason Wish I would have had this the other ...   Jan 10 2004, 09:07 PM
- - LilBambi   Thanks Jason! Having always used LILO in the p...   Jan 10 2004, 09:40 PM
- - Owyn   Well written Jason. Bruno's tip and your desc...   Jan 10 2004, 09:42 PM
- - linuxdude32   Thanks guys! You're all so encouraging. Yo...   Jan 11 2004, 08:38 PM
- - havnblast   I always did like Grub over Lilo Great Job Jason...   Jan 11 2004, 08:43 PM
- - SonicDragon   Nice tip! Thanks! I'm sure the PLUG w...   Jan 11 2004, 08:50 PM
- - quint   Excellent, Jason, thanks! Have always used LIL...   Jan 11 2004, 08:53 PM
- - jodef   Jason must admit when I first read this tip a few ...   Jul 8 2004, 10:38 PM
- - ferry_ong   hi there, i installed suse 9.1 personal in VMWare...   Jul 9 2005, 04:29 PM
- - Bruno   Hi Ferry Welcome to the forum I never tried VMwa...   Jul 9 2005, 04:48 PM
- - Dard   Thanks Jason, great job, after reading your GRUB t...   Jul 9 2005, 07:35 PM
|- - burninbush   "Grub uses its own naming structure for drive...   Jul 10 2005, 09:26 PM
- - réjean   Thanks Jason! I too printed your tips in case ...   Jul 11 2005, 04:36 PM
|- - moon   Hi, If grub does still does not install, u can ...   Jan 4 2008, 10:33 AM
- - Bruno   QUOTE (moon @ Jan 4 2008, 03:33 PM) u can...   Jan 4 2008, 02:10 PM
|- - moon   QUOTE (Bruno @ Jan 4 2008, 01:10 PM) . . ...   Jan 8 2008, 10:38 AM
- - Bruno   Glad you got it fixed Moon . . . . . . . must ha...   Jan 8 2008, 02:01 PM
|- - moon   " must have been a blib why mtab did not get ...   Jan 9 2008, 10:06 AM
- - Bruno   Hi Noon I think maybe your problem is that you re...   Jan 9 2008, 02:15 PM
- - onederer   I've got a couple of links that you might like...   Jan 11 2008, 04:32 PM
- - Cluttermagnet   Wow! I'm going to have to read and reread ...   Jan 11 2008, 05:38 PM


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: 2nd September 2010 - 09:48 PM