[Discuss] More Grub installation tips for newbies
John Blomfield
jabfield at shaw.ca
Fri Nov 23 16:40:39 PST 2007
Following on from the great tutorial from Joydeep Bakshi:
http://jbakshi.50webs.com/Linux_tutorial/GRUB/GNU%20GRUB%20simplified.html
are just a few more tips I was reminded of while partitioning my backup
computer hard drive and installing Fedora 8 in one partition and Ubuntu
in another. As a Fedora freak I naturally installed Fedora 8 first,
checked it was OK, installed some extra software and then installed
Ubuntu. To my surprise when I fired up my computer again I found that
Ubuntu had replaced my nice Fedora Grub GUI with a cheap text imitation
text screen! Now Fedora always asks during installation, if you want
Grub and if so which drive to install it in and where to overwrite the
MBR (master boot record). Now I may have been answering the call of
nature at the time or something but I don't remember Ubuntu asking about
Grub or if it did and I was not paying attention and it must have timed
out on the option. My problem was then to recover my nice Fedora GUI
with the additional entries for Ubuntu. The first issue to be aware of,
see the above tutorial, is the way Grub specifies hard drives but also
that Linux hard drive designations do not correspond to the order of
partitions on the hard drive but rather the order in which they were
created. For instance, when I re-partitioned my hard drive I deleted
some at the top of the drive and some at the bottom and left one
partition in the middle untouched. Then I created new partitions in the
unallocated regions this resulted in the following order:
sda4, sda2, sda3, sda1 from cylinder 0 to the the end, instead of the
orderly 1,2,3,4. To further confuse the issue Ubuntu calls these hda4,
hda2, hda3, hda1 and then Grub calls these (hd0, 3), (hd0,1), (hd0, 2),
(hd0, 0). I would make a table but it doesn't look good if you are using
text only email.
So now what to do about Grub! The following is also useful if you have
a dual boot already set up with MSWindows and then you re-install
MSWindows, which overwrites your MBR including Grub.
1. First reboot your computer using a Linux Rescue disc (you do know
where it is don't you?) or sometimes the disc 1 of your distribution or
perhaps a live CD.
2. I used my Fedora 7 rescue disc since I had not downloaded the Fedora
8 version but I have now.
3. Once booted you are asked if you want to mount the Linux versions it
has found and since it was a Fedora rescue disc it found the Fedora
installation. Then do this at the prompt:
# chroot /mnt/sysimage - this gives you access to your
installation image, this name could be different with different
distributions.
4. Then do the following:
# login
login: root
passwd: ******
# cd /boot
/boot# grub
grub > find /boot/grub/stage1
"response in my case" (hd0, 2) (hd0, 3)
-what this tells you is that stage1 of grub has been found in two
partitions, one of which is the Fedora partition (hd0, 3) or sda4, and
the other Ubuntu partition (hd0, 2) or hda3. Now since I want the
Fedora Grub, I type, ( note the > is the Grub prompt)
> root (hd0, 3)
> setup (hd0)
> quit
This tells Grub that my Fedora "/" directory is on (hd0, 3) and my MBR
is on hard drive hd0, that is sda or hda, put Grub found in the Fedora
/boot directory in the MBR replacing the one put there by Ubuntu or in
the case of a MSWindows, the one put there by Mr. Gates! Not that I
should put Ubuntu and Mr. Gates in the same category! My final task was
to cut and paste the boot text from the Ubuntu /boot/grub/menu.1st file
for booting Ubuntu into the Fedora /boot/grub/menu.1st file, save and
reboot. Eye candy heaven!
The package hwbrowser is quite a nice GUI listing what hard drives and
partitions are in addition lots of other hardware details.
John Blomfield
More information about the Discuss
mailing list