- Member Success Stories (
-   -   GRUB HOWTO and troubleshooter (

aus9 10-01-2004 09:57 AM

GRUB HOWTO and trouble-shooter
Please do not post a question on this thread.


this post contains important change on inode size 256 for ext2 ext3 ext4

The solutions are
do not use a old live cd that has an old grub on it,
use a live cd that is known to have this fixed,
....currently sidux live cd or dvd is good
(b) change to lilo (grrrrr)
(c) change from ext format to xfs etc

This is document is GPL. Please do backups. Do at your risk.
Why grub??
(a) It can boot very large kernels over a number of floppies
(B) It can be burnt to cdr with your own compiled kernel or your distros
(b) Grub troubleshooting is easier with inbuilt commands especially the use of the tab key
(c) You install grub once then edit the menu.lst file without having to re-run grub
My examples may need you to modify if your /etc/fstab is different from mine. You may need /boot/vmlinuz instead of /vmlinuz for linux users.

GRUB is a boot loader normally installed in your Master Boot Record (MBR) to boot an operating system. I am only concerned with Linux and Microsoft types. Linux is Trade Marks of Linus Torvalds and Windows or Microsoft are Trade Marks of Microsoft Corporation. I abbreviate Microsoft as MS

Now a link to a WIKI file here

darin3200 for help with my splashimage howto
oneandoneis2 for inspiring me to look at Grub's command editor at boot. I did not do so initially because I am so good my grub was always successful. (I blush)
Luis R. Rodriguez for his original work on splashimage.
zatka for those who want to keep NTLDR (windows in mbr) but use grub on a partition
thegreedyturtle provides the partition error for SUSE
johnewing found another FC fix
samaujs for correcting my syntax for the windows map brackets needs a gap
motub for those who want to wind back to windows
thom for links on suse and solution
BIG Al for report on Mdk
doug_s for link on Mdk
KohlyKohl for his bios LBA suggestion
vectordrake confirms w98=xp=2000 Microsoft share configs
Carla Schroder for her loop info to test an iso b4 burning it
michaelk to mentioning MS needs to be on primary partiton
Not now, John! for flash media instructions
kilgortrout for UUID stuff
homey for LVM stuff

my APOLS to any who posted earlier or who I have missed.

Most distros can handle .rpm files so try
OR try .tar files at
Debian .deb files are at

Local hard drive files
/boot/grub/menu.lst (lst is short for list) grub
Backup files should be in /usr/local/share/grub/i386-pc. Search if they are not.

On line manual at

Be aware that grub2 is in development and is mentioned here

Note this does not overwrite your mbr only makes the file available.
KDE users in Konqueror-Click on the rpm file and kpackage should start then click on the rpm file and
click on install marked button. See the help in KDE if any problems.

Command/terminal/console/shell users

rpm -ivh /pathway-to-file/grub-file.rpm


tar jxvf /pathway/grub.tar.bz2
tar zxvf /pathway/grub.tar.gz
cd /grub-0.9.5
  ./configure && make install

Handy commands and info now become availble are: man grub
info grub
Backup stage 1 etc files MAY be in /usr/local/share/grub/ or /lib/grub/

GRUB counts drives detected, by counting from ZERO like this 0,1,2 etc.
So drives are (hd0) (hd1) (hd2) etc

Partitions, as listed in your /etc/fstab file for IDE types are
/dev/hda1 /dev/hda2 ..../dev/hda11 etc OR /dev/sda1 /dev/sda2.....etc for SCSI and SATA types.
In GRUB speak are (hd0,0) (hd0,1) (hd0,2) etc
Notice a simple rule is to subtract ONE to convert to GRUB speak. And both IDE or SCSI or SATA become (hdX).
eg /dev/sda15 becomes (hd0,14)

Floppy drives have the same count style but are (fd0) (fd1) etc.

Drives or partitions have to be in simple brackets and have no gaps even if a comma is used.
eg (hd0,0) not ( hd0, 0 )

How do I check what GRUB will detect?
Open /boot/grub/ with your favourite text editor or web browser. If you have no file it is not a problem unless you have a scsi device that Grub is having trouble with. And maybe raid but I don't have raid so don't know.

I suggest you keep a copy

If /etc/fstab has an entry like this
/dev/hda1........ /boot.........and some other stuff.
GRUB speak for this /boot partition is (hd0,0)

If you can't see /boot listed, then its on the same partition as /..... it is a SUB-FOLDER to /.
eg /dev/hda5........../.............and some other stuff.
GRUB speak is (hd0,4)

The boot partition or sub-folder will normally have a vmlinuz file (the kernel) maybe a initrd image file and normally these files link to another vmlinuz or initrd file like vmlinuz-2.6.7 and you may have other entries due to re-compiles you have done. More on these files discussed in the menu.lst examples.

The fstab tells you whether to use on the kernel (or initrd) line a structure like this
kernel /boot/vmlinuz etc OR
kernel /vmlinuz etc


Well if you have a separate /boot partition when you read the next section you will have got into it so relatively speaking the files will show up as /vmlinuz /initrd etc
WHEREAS if you have /boot as a sub-folder to / partition THEN you need to navigate into a sub-folder so its /boot/vmlinuz

Some computers have trouble reading a linux /boot partition that exceeds cylinder 1024. GRUB supports Logical Block Address (LBA) so you should not have a problem. You may need to change or upgrade your bios and then enable lba setting in your bios.

This tutorial uses root command. eg
root (hd0,0)
The ROOT comnand defines the search path for what happens next. For linux users, it defines the /boot partition or the /boot sub-folder of your / partition as per your /etc/fstab file For MS users it defines the search path for the MS bootloader.

If you read the manual you may realise you can instead of the root command, you can specify absolute paths. I recommend you learn only one way. All absolute or root expressions can be swapped.
eg ABSOLUTE .....kernel (hd0,0)/boot/vmlinuz root=/dev/hda15 ro becomes
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hda15 ro

ROOT is mentioned twice in my menu.lst file. Once to tell grub where is the /boot partition or /boot SUBFOLDER is and the second mention of root is actually a way of telling grub what partition / is on.
root (hd0,0) # first use of root
kernel /boot/vmlinuz root=/dev/hda5 ro # second use of root

So there can only be 2 types of the ROOT COMMAND

a) Preferred is to have a separate /boot the menu may look like this and notice no mention of /boot in the stanzas

title separate boot partition
root (hd0,0)
kernel /vmlinuz root=/dev/hda5 ro

title boot is a subfolder
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hda5 ro

moved to wiki link for grub here

Some people like to try different kernel appends or different kernels or maybe try to load a different partition with a new linux/windows on it?

To save having to use E for edit to amend grub or C for commands grub offers a fallback menu that need no input other than setting it up.
timeout 5
default 0
fallback 1

title slackware
kernel etc

title gentoo
kernel etc

#will allow slackware to boot if no choices made in 5 seconds and if it is buggy grub will load gentoo instead.

Now a separate thread as I have started to add pix here

open a terminal

(prompt or cursor changes to GRUB>.)
root (hd0,0)
setup (hd0)

Change the source of root (hd0,0) to where your /boot partition if different. Once GRUB is installed, you just edit the /boot/grub/menu.lst file to make changes. Instead of su you may have to use sudo?

Be aware that your bios may not have an option to boot from such a device
I am indebted to LQ user Not now, John! for the ideas here.

Plan a makes a ext2 format
open a terminal

mkfs.ext2 /dev/hdc
mount /dev/hdc /mnt/temp
cd /mnt/temp
mkdir grub
cd grub
(next command depending on your browser may overlap onto a second line but its typed as one command and ends  with /mnt/temp/grub)
cp /usr/share/grub/i386-pc/stage* /usr/share/grub/i386-pc/e2fs_stage1_5 /boot/grub/menu.lst /mnt/temp/grub
cd ~
umount /mnt/temp
grub  (prompt changes to grub)
root (hd2)
setup (hd2)

CHANGE /dev/hdc to whatever your device is detected as
CHANGE hd2 to hd3 etc if you have 2 drives etc
CHANGE the flash media /grub/menu.lst file to reflect the hardware please
Change the /usr/shareto grub to where your backups are, eg /lib/grub

Plan B makes a MS style to be more compatible with that other thing

mkdosfs -F 32 /dev/hdc
mount /dev/hdc /mnt/temp
cd /mnt/temp
mkdir grub
cd grub
(next command depending on your browser may overlap onto a second line but its typed as one command and ends  with /mnt/temp/grub)
 cp /usr/share/grub/i386-pc/stage* /usr/share/grub/i386-pc/fat_stage1_5 /boot/grub/menu.lst  /mnt/temp/grub
cd ~
umount /mnt/temp
root (hd2)
setup (hd2)

Some distros talk about /etc/GRUB.conf but with luck it will be linked to the real file which is /boot/grub/menu.lst This file can be amended by any normal editor with root priveledge.

When you install GRUB it creates the menu.lst file but if it did not, use the below examples to copy and paste into a text editor and then save as /boot/grub/menu.lst

EXAMPLE of single linux with no initial ram disk image eg Slackware distro kernel older than 2.6
# file is /boot/grub/menu.lst
title Slackware
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hda3 ro
....grubspeak says /boot folder was /dev/hda1 but / folder was /dev/hda3

EXAMPLE of single linux with initial ram disk image required eg Mandrake or kernel 2.6 PLUS
# file is /boot/grub/menu.lst
title Mandrake
root (hd0,0)
kernel /vmlinuz root=/dev/hda3 ro
initrd /initrd.img

EXAMPLE multibooting 2 or more linuxs
# file is /boot/grub/menu.lst
timeout 5
default 0

title Mandrake
root (hd0,0)
kernel /vmlinuz root=/dev/hda5 ro
initrd /initrd.img

title Slackware
root (hd0,9)
kernel /boot/vmlinuz root=/dev/hda13 ro

root (hd0,0)
kernel /vmlinuz root=/dev/sda3 ro

root (hd0,0)
kernel /vmlinuz root=/dev/sda3 ro sda=ide-scsi

DON'T FORGET you may need /boot preceding /vmlinuz or /initrd
Yes I its unlikely that mandrake and Scsi share the hd0,0 but they are only examples. Now as this had 4 entries the use of "default" means that unless you arrow down, at boot, to select a different entry, GRUB will boot Mandrake. Remember GRUB counts from zero. We need a timeout command to give you a chance to make the change. In the above example its 5 seconds. Once you arrow down or hit the tab key, the time count down stops. If you do nothing it will boot whatever the default number is. The word title merely acts as prompt to you as to what choices you have. Some people get really excited by eyecandy or graphics on bootup for the boot loader. You may casually notice no mention of bootsplash or splashimage commands in my files. Go to the link if you in need of eye candy. Not every distro supports eye candy.

New Kernel line alternatives UUID or label or LVM

Old style kernel line is either
kernel /boot/vmlinuzetc root=/dev/hda ro
or kernel /vmlinuzetc root=/dev/hda ro

But as pointed out to me by kilgortrout, modern distros have migrated to UUID or label.Ubuntu uses UUID. Fedora/Redhat uses label.

However, you may be able to use either if your initrd uses nash.

So to find your UUID, try these commands

blkid -s UUID
ls -l /dev/disk/by-uuid/
vol_id -u /dev/sda1

Change sda1 to whatever your real / partition is.

So the line may become
kernel /boot/vmlinuz-etc root=UUID=5efe0bdc-7d8c-11dc-a383-65fda1769893
or kernel /vmlinuz-etc root=UUID=5efe0bdc-7d8c-11dc-a383-65fda1769893

kernel /boot/vmlinuz-etc root=LABEL=whatever

It appears you can only change the label for partition if they are ext2 or ext3?....using e2label command

LVM users...I do not use but it appears you are forced to have /boot as a separate partition and then eg
kernel /vmlinuz-etc ro root=/dev/VolGroup00/LogVol00

Thanks to homey for reminding users to have a separate /boot partition if you decide to use LVM.

Volume names can be changed with vgrename if you have conflicts.

1) Incorrect GRUB counting
2) Incorrect spaces or format of (hdX) or (hdY,Z)
There are no spaces within the hd or partition brackets.
map (hd0) (hd1).....for windows users see below but there is ONE space between bracket sets.
3) GRUB missing stage 1 or stage 1.5 or stage 2 files in /boot/grub OR one or more are corrupt and likely to have 0 byte size
4) Failure to look at /etc/fstab to see what is where, or the fstab file itself is corrupt.
5) MBR loads to a grub with a cursor means (1) GRUB is truly in MBR but you have a stage 1 etc error or the kernel line for Linux is incorrect.
6) I am not rewriting all the error codes so refer to the manual please. But Gentoo has a forum of errors here.
Please be aware that RH and gentoo etc often use /etc/grub.conf instead of the /boot/grub/menu.lst
7) motub refers to issues for those who want windows bootloader to over-write MBR
A) fdisk /mbr
is one of the ways to restore the Windows bootloader (via a floppy disk)-- but the preferred way (under Win 2000 and XP) is to boot from the XP CD, go to the Recovery Console, log in as Administrator and type
which will also restore your Windows bootloader.
B) aus9 adds--I have read you may need to zero your mbr first but heed warnings of having a real rescue system that you know how to use, as it could be nasty if you make a mistake
dd if=/dev/zero of=/dev/hda bs=512 count=1
use IF AND ONLY IF (A) fails
C) However, you will then no longer be able to boot into Linux unless you have a boot disk (or use a CD to do a rescue boot), because the Windows bootloader will not contain a Linux entry (unless you copy the boot sector from the Linux partition to the bootsector of the Windows partition and add Linux to the Windows boot menu manually).
On the whole, it's much easier to install Windows first (to the partition that Windows expects to be installed to), and then install Linux, as Linux is much more aware of how to work with Windows (if present) then Windows is aware of how to work with Linux.
(I have editted slightly to broaden the answer to more users)
8)I found in my splashimage stuff that when I grabbed gentoo files but created my menu.lst file GRUB had no problem in embedding using my file.
9) Newer Distros may complain if use syntax
/boot/vmlinuz OR /boot/initrd so change entries to
/vmlinuz or /initrd etc
10) MS to boot needs to be on a primary partition
11) If your menu has a timeout command with "timeout 0" then you can instead of editting it, press the escape key quickly numerous times to get to the menu



moved to this link

New splashimage howto with downloadable images is now here

Original info by Luis R. Rodriguez

Don't forget the dual boot issues above.
please note that C drive must be on a primary does not need to have a bootable flag as the MAKEACTIVE command fixes all.

I tested with W98. vectordrake confirms it is the same for xp and 2000.
Until recently I used the rootnoverify with the hide command. I have decided to make it more linux like with the use of the root command but now greater use of the map command for drives and partitions.

# file is /boot/grub/menu.lst
timeout 5
default 0

title Slackware
root (hd0,4)
kernel /boot/vmlinuz root=/dev/hda6 ro
initrd /boot/initrd.gz

title Windows
root (hd0,0)
chainloader +1

We assume Windows on C drive? which is /dev/hda1 = (hd0,0) and in we are telling GRUB is .... whether DOS had it bootable or not, make it bootable, then accept a new bootloader to complete the process.

MICROSOFT (MS) on first drive and NON-FIRST partition
title MS on NON-FIRST partition
root (hd0,7)
map (hd0,7) (hd0,0)
map (hd0,0) (hd0,7)
chainloader +1

title GO TO mbr instead
rootnoverify (hd0)
chainloader 0+1

Here I no longer use the rootnoverify command but align to the linux way of defining root and verify that grub knows the filesystem fat.

The 2 map commands are to swap TRICK MS into thinking your hda8 or sda8 partition is actually first drive first partition. You need both swaps for it to work.
It does not matter if you mention hd0,7 or hd0,0 as the first command as long as they both show a true SWAP.

The title GOTO allows a sneaky way of getting to the mbr of the first drive, and then letting it boot to the C drive. Likely to be used by those who have MS on first drive and testing Linux on second drive.

You may have Linux on your first drive and decide to put MS on your second one.
I have done a separate post for my setup that may help your understanding.
It explains how to install by changing the bios.

The end of that post is this:Now you edit your /boot/grub/menu.lst file to add lines for MS.

Don't forget the dual boot issues as above

title windows plan A
root (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1

MS sits on /dev/hdc1 ( aka C drive) Grub says that is (hd1,0)
grub needs to check it finds a fat/MS file system
map says what you think is drive 1 is now drive 2 and what was drive 2 is now 1 so C drive now thinks its truly on first drive first partition. Hence MS is tricked.
makeactive says if this was not yet bootable make it so
chainloader says don't try to boot this DEAR GRUB, but let whatever that partition has a bootloader attempt to do so.
Note there is one space between the 2 map brackets.
It does not matter which drive you mention first as long as both are swapped.

title windows plan B as plan A failed more paranoid
rootnoverify (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1

KEEPING WINDOWS BOOTLOADER then chainloading grub on a partition
LQ user zatka found this link and updated as link changed


acid_kewpie 10-01-2004 10:14 AM

you have already submitted this as a linuxanswer, no need for another thread. it has been on our site for 3 months now.

aus9 10-01-2004 10:19 AM


heres the rough log of edits
1) Some of the links were broken
2) Give more credit to others
3) rework the notes in large kernel section to align floppy 2 note instead of floppy 1
4) add zatka's link for those who are scared to have grub in mbr on XP or 2000
5) add fallback
6) add gentoo error forum (subject to approval)
7) add backup mbr (mainly to floppy) (still no burner)
8) redo ntldr link as it changed
9) add thegreedyturtle link to fix SUSE partition table error
10) start cull as reached 25000 characters
11) reword the /boot partition to include words of SUB-FOLDER to try and make it clearer, I hope
12) samaujs found a syntax error in my map command....a bigger gap appeared to be truncated by the forum, I think. So I put a false z in there with a warning to replace it with ONE SPACE.
13) Large kernel 3 floppy tutorial made a link to the wiki document
14) Deleted simple floppy as most people, if using floppy will need to use the large kernel way.
15) Made mbr stuff a wiki link
16) add motub's windows suggestions
17) add thom for links on suse and solution
18) add Big Al for report on Mdk
19) add doug_s for link on Mdk
20) add KohlyKohl bios to LBA mode
21) make whole tut use $ symbol for commands, even if in su mode the correct symbol may be #
22) vectordrake confirms xp = 2000 = w98 for same conifgs
23) mdk 10.1 complains if I use menu.lst syntax /boot/vmlinuz so add a warning for new distros users
24) added new grub burn howto I boast its more info than grub manual
25) move the parted bug info to an archive link
26) move the burn to CDR info into main thread
27) move the trouble shooter to separate page as its now bigger
28) no longer for MS users recommend the rootnoverify command with some needing hide and unhide and stuff.

Instead I align Linux and MS users to the same root structure
root (hdX,Y)
then I use the map drives or map partitions to fix the hide and unhide issues and provide safer conditions HOPEFULLY for MS formatting tools etc

29) Amended ROOT command to explain search as per (28)
30) added grub to mbr for other drive as an alternative.......showing off as well
31) added timeout error for those needed help
32) added flash stuff (usb) from a post by Not now, John!
33) more choice from not now john on a device formatted as MS
34) burn grub and kernel moved to a new link off main post
35) UUID or label stuff on kernel line from kilgoretrout
36) homey has info on LVM
37) Francois du Poux for allowing me to host his stage2 grub file that has splashimage support
38) ext2/3/4 format systems now use inode 256 size which fails for legacy grub live cds solution is to use a sidux live cd.

aus9 10-01-2004 10:23 AM

G'day Chris

Just seen your post.

umm my last edittable post was a rough tutorial and I try to be accurate in my subject heading and originally that was correct.

No longer. Plus I reported it to try and get mods to change the subject heading to no available. I realise you guys and gals are busy with the normal stuff so I am trying to fix my past mistakes.

I will edit and link my old posts to this.

Hope that reveals my true intentions?

aus9 10-22-2004 09:39 PM

The ntldr link is now broken, will have to find a replacement

aus9 10-22-2004 09:49 PM

found it

darthtux 10-22-2004 09:56 PM

Great tutorial. Put it in my bookmarks :D

aus9 10-25-2004 04:36 AM

deleted as EDIT LOG better

spoonboiler 12-22-2004 09:47 PM

(first post... uh... hooray for me?? heh!)

I just wanted to thank you very very much for the help that this thread and the others on this topic has given me. I am a complete linux newbie, and had jumped in with both feet before I was ready, and your help saved me from a whole lot of 'weeping and gnashing of teeth'. Thanx! :) :) :)
I think I would have given up on linux if not for the information that I found here. Now I have a perfectly happy dual-boot Suse/WinXP-pro system, and I am slowly but surely learning some of the workings of linux.
Cheerz, all.

golien 03-31-2005 01:12 AM

Tope 04-05-2005 07:58 PM

I need you advice
Hi I'm a student. I'm trying to write an Operating system or at thr least an Operating system interface - i mean the desktop enviroment for my final year project. I intend to use grub bootloader first, use any kernel (Linux's or preferably Win NT bootloader and kernel) and then a GUI. I intend to write the GUI from scrath and infact i have started on that. Please i need expert advice and recommendations.
Although i'm a Newbie, i cannot figure out any longer how i found myself here so i will prefer if yoou can send me a mail into my e.mail box -

aus9 04-06-2005 07:15 AM


I have had to edit my howto due your question

please click on edit and delete (cull) all of your text and submit it so its blank.

Then consider doing a search or submitting a follow-up question on someone' s QUESTION thread or submit a new question.

thanks for your time.

When you do i will then cull this post as its rude but I need to be blunt.

speaking of transparent, I do not normally email anyone unless its Jeremy or something I tried to say without being rude. I will not help anyone by private email.

If its good enough for email its good enough for explicit howto instructions.
I do not provide private service. When I have time, which now a days is rare I may reply to posts.

thanks for your understanding

aus9 04-22-2005 07:54 PM

This is just a note to say I have severe time off restrictions at the moment so am unlikely to be updating the howto or trying to help people much in the near future.

If there is a really big issue that needs some response I am open to anyone copying and pasting my stuff and starting a new thread. Grub is bigger than my small ego.

Good luck

aus9 02-04-2008 05:26 AM

updates 2008
ok I have started some updates mainly the kernel line to show extra types


of course nothing has changed for me, I do not use LVM. raid, but I may change to UUID in lieu of /dev/sdaetc

saleemsupra 02-27-2008 04:53 AM

thanks a lot for guidence
Dear Sir

thanks a lot my problem of booting fedora7 has been resolved.


All times are GMT -5. The time now is 10:48 PM.