• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1161
  • Last Modified:

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
0
CodedChaos
Asked:
CodedChaos
  • 6
  • 5
  • 3
2 Solutions
 
Bradley HaynesCommented:
Boot to the install cd and choose reapair.
0
 
Bradley HaynesCommented:
pun intended.
0
 
CodedChaosAuthor Commented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Bradley HaynesCommented:
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!.
0
 
CodedChaosAuthor Commented:
No dice, that didn't do anymore than what I've already tried.

Any more ideas?
0
 
Bradley HaynesCommented:
When all else fails cut to the chase and re-install.
0
 
CodedChaosAuthor Commented:
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?
0
 
Bradley HaynesCommented:
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

0
 
WizRd-LinuxCommented:
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
0
 
CodedChaosAuthor Commented:
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?
0
 
WizRd-LinuxCommented:
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.
0
 
CodedChaosAuthor Commented:
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)
0
 
WizRd-LinuxCommented:
so sda1 is mounted as boot, which indicates you have much much bigger problems than just a corrupt grub.conf file.  Your missing basically all files required to boot the system.

Something has stuffed up in your boot directory is empty except your grub directory, and considering grub is the only directory, it appears a "rm *" was executed in the directory, this would have deleted everything except your grub dir.

Last thing to check before you go and rebuild, make sure that the files you need are not in your /boot/grub/ directory, initrd, vmlinuz files ect.  If they are you can modify the grub.conf file to reference them as being in there.

Otherwise now would be the time to use b_haynes suggestion about using the live CD to transfer everything off and then rebuild.
0
 
CodedChaosAuthor Commented:
I guess that's what I'll do, I've split the points to both of you, thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now