Note:-
If you mis-spell the name of the file, you'll get and Error
15: File not found . If this happens simply re-type the
command.
Re-installing Grub
As per usual, there is more than one way to re-install Grub.
Such is the way of Linux. You can install / re-install Grub
from the Grub menu, or you can do so from within Linux.
Re-installing Grub from the Grub menu or grub> prompt
If you have the normal Grub menu in front of you, press the
the c key to get the Grub command prompt.
From the grub> command prompt enter the setup command. This
command takes two parameters, the first is the name of the
hard disk drive whose master boot record (mbr) is going to
hold Grub; the second parameter is the name of the hard disk
partition where the Grub files reside (ie. where the
/boot/grub/ folder is). Both of these parameters use the
Grub method of naming (see my aside above for an
explanation).
So, for example, is I want to put Grub onto the mbr on my
first hard disk drive and my /boot/grub/ folder lives on the
second partition on that drive, the setup command would look
like this :-
Code:
setup (hd0) (hd0,1)
One problem that I've come across using this method is
that , for reasons best known to itself, Grub seems unable
to find and display the pretty splash picture.
Re-installing Grub from within Linux
You need to get yourself a shell command prompt up (either
open a terminal window or press Ctrl Alt F1 to get a text
only console - Ctrl Alt F7 will return you to the GUI), and
you will need to be the root (su -) user (either logon as
root or enter su - followed by the root password).
From that command prompt you will need to enter the
grub-install command. This takes one parameter - the name of
the hard disk whose master boor record (mbr) will be having
grub installed on it. This being Linux, you will need to use
the Linux way of naming hard disk drives (see my aside,
above, for an explanation on naming standards) . There is no
need specify the hard disk partition that has the
/boot/grub/ folder, as the one on the Linux that you are
running will be used (this can, if needed, be overridden ,
see "info grub" for information).
So, if I want to use the mbr on the first hard disk (that
is, the hard disk that is master on the first IDE cable) I
would type (note, I've deliberately left the command prompt
in my example, please don't type it) :-
Code:
[root@localhost root]# grub-install /dev/hda
Installation finished. No error reported.
This is the contents of the device map
/boot/grub/device.map.
Check if this is correct or not. If any of the lines is
incorrect,
fix it and re-run the script `grub-install'.
# this device map was generated by anaconda
(fd0) /dev/fd0
(hd0) /dev/hda
And that's all there is to it.
Contents of the /boot/grub/grub.conf file
Following is the contents of my /boot/grub/grub.conf file.
It is probably a little bit more complex than yours, but
don't let this put you off.
Each operating system that appears on the Grub menu has its
own title statement.
As you can see from mt /boot/grub.conf file (below), I get
the choice of booting into Fedora core 2, Mandrake 10.0,
Slackware, BeOS, Windows 98 SE, and Fedora Core 1. The first
three of these operating systems are on my first hard disk (
hd0 ) , with Fedora core 2 and Mandrake sharing the same
/boot/ partition ( hd0,0 ), while the Slackware (reiserfs)
partition is very much stand alone. BeOS (a now obsolete,
but fun, operating system from http://www.bebits.com) and
Windows 98 SE (hey, what can I say Smile ) is on my third
hard disk, and my "just in case" Fedora core 1 is on my
second hard disk drive.
Code:
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core 2 (2.6.5-1.358)
root (hd0,0)
kernel /vmlinuz-2.6.5-1.358 ro root=LABEL=/1
hda=38792,16,63
initrd /initrd-2.6.5-1.358.img
title Mandrake 10.0
root (hd0,0)
kernel /vmlinuz-2.6.3-4mdk ro root=/dev/hda6
hda=38792,16,63
initrd /initrd-2.6.3-4mdk.img
title Slackware
root (hd0,4)
kernel /boot/vmlinuz-ide-2.4.22 ro root=/dev/hda5
hda=38792,16,63
title BeOS
map (hd0) (hd2)
map (hd2) (hd0)
rootnoverify (hd2,4)
chainloader +1
title Windows 98 SE
map (hd0) (hd2)
map (hd2) (hd0)
rootnoverify (hd2,0)
makeactive
chainloader +1
title Fedora Core 1 (2.4.22-1.2188.nptl)
root (hd1,0)
kernel /boot/vmlinuz-2.4.22-1.2188.nptl ro root=/dev/hdc1
initrd /boot/initrd-2.4.22-1.2188.nptl.img
Some explanations.
default=0 and timeout=10 means that unless I say otherwise,
Grub will load the first operating system (again counting
from zero) - Fedora Core 2 .
splashimage=(hd0,0)/grub/splash.xpm.gz is the full name of
the pretty splash image that is placed behind the Grub menu.
hda=38792,16,63 is because of a problem that Fedora has with
my first disk drive. Linux, unless you tell it otherwise,
gets the geometry wrong.
Both BeOS and Win98 need to be on the first hard disk. To
make them believe this, I have used the map facility within
Grub.
If you're still having boot problems
|