Link to home
Start Free TrialLog in
Avatar of CodedChaos
CodedChaos

asked on

Rebuild the GRUB boot loader in FedoraCore 6

How do I rebuild the GRUB boot loader in FedoraCore 6?

 Right now when my box boots it just takes me to the GRUB mini-bash cli.

Any help would be great.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Bradley Haynes
Bradley Haynes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
pun intended.
Avatar of CodedChaos
CodedChaos

ASKER

Could you be abit more descriptive? I've tried rescue mode from the fedora cd and then install-grub /dev/sda1 but it hasn't fixed the problem, there's no grub.conf and it won't generate it with that command.
Recently, I installed RHEL first with 3 partitions(/, /boot and /home) and I also created one FAT partition for installing Windows XP. After installing RHEL, I installed MS Windows XP. This left grup being replaced by MS Windows boot loader in MBR. How to restore grub?

Restoring grub boot loader should be trivial if you have the installer CD. In case of RHEL (or Fedora or CentOS), what you have to do is by inserting disc 1 of RHEL disc sets and type linux rescue. After answering a few questions, you will be dropped to console. What next? Type grub-install /dev/hda. This command will install grub boot loader into MBR.

1. chroot /mnt/sysimage
2. /sbin/grub-install --recheck /dev/hda

 Step 1 means to change your root dir to installed partition which is mounted under /mnt/sysimage directory. If you have no luck, skip step 1 and go straight to step 2. Good luck!.
No dice, that didn't do anymore than what I've already tried.

Any more ideas?
When all else fails cut to the chase and re-install.
I've considered that, but I have data that isn't backed up anywhere else on this box, so I don't want to reinstall because then I'll loose it all.

Does anyone else have an idea?
Boot to a live cd version on linux and transfer the data to removable media.
Here is a list of live linux cds.
http://www.frozentech.com/content/livecd.php

First things first, boot into the rescue mode using the first CD of the distro you have.  As previously mentioned, chroot /mnt/sysimage/ then cd /boot/grub/.  You should find that you have your grub.conf in here.  If not you will need to recreate it from scratch.  Fire up your favourite editor and create the file grub.conf with the contents similar to this:

default=0
timeout=5
title My Linux Install (this can be replaced with what ever you want)
        root (hd0,0) *
        kernel /vmlinuz-2.6.9-55.0.6.EL ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.9-55.0.6.EL.img

* Make sure this is correct, fdisk -l will display all of your partitions.  If your boot device from your bios is say for example /dev/hdc it will still be root (0, and then the partition number minus one.

As far as the lines kernel and initrd go, if you are referencing the /boot partition (if you have one) then there is no need to explicitly reference the files like /boot/initrd-2.6.9-55.0.6.EL.img

However saying that if you /boot directory is part of the / partition you will need to reference it explicitly for it to work.

Once you have the grub file created and ready to go you can then do the suggestion above /sbin/grub-install --recheck /dev/hdx
Thanks for the comment! I'm alittle confused though..

Here's the output from fdisk -l

Device     Boot  Start  End    Blocks             Id  System
/dev/sda1   *        1      13      104391          83   Linux
/dev/sda2           14   48641   390604410   8e   Linux LVM

Can you possibly help anymore?

Also, the only thing in /boot is the grub folder, is this normal?
It is unusual for the /boot folder to be empty.  You would expect to find the initrd images, compiled kernels ect.  It could be as simple as /dev/sda1 isn't mounted.

After you have chrooted the environment type mount and let me know if /boot is actually mounted, and more to the point if /dev/sda1 is mounted anywhere.  If not do the following:

cd /mnt
mkdir temp
mount /dev/sda1 temp/
cd temp
ls

If you see files like initrd-<kernel version> and vmlinuz-<kernel version> then this is actually your boot paritition.  Then do the following
cd /mnt
umount temp/
mount /dev/sda1 /boot

You should then be able to modify / update your correct grub.conf file and reinstall it using the command above.
mount returns

/dev/VolGroup00/LogVol00 on / type ext3 (rw,defaults)
/dev/sda1 on /boot type ext3 (rw,defaults)
proc on /proc type proc (rw,defaults)
sysfs on /sys type sysfs (rw,defaults)
/dev/sysfs on /sys type sysfs (rw,defaults)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I guess that's what I'll do, I've split the points to both of you, thanks for your help.