[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Rebuild the GRUB boot loader in FedoraCore 6

Posted on 2007-10-08
14
Medium Priority
?
1,139 Views
Last Modified: 2013-12-15
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
Comment
Question by:CodedChaos
  • 6
  • 5
  • 3
14 Comments
 
LVL 8

Accepted Solution

by:
Bradley Haynes earned 750 total points
ID: 20037343
Boot to the install cd and choose reapair.
0
 
LVL 8

Expert Comment

by:Bradley Haynes
ID: 20037345
pun intended.
0
 

Author Comment

by:CodedChaos
ID: 20037366
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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 8

Expert Comment

by:Bradley Haynes
ID: 20037411
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
 

Author Comment

by:CodedChaos
ID: 20037471
No dice, that didn't do anymore than what I've already tried.

Any more ideas?
0
 
LVL 8

Expert Comment

by:Bradley Haynes
ID: 20037501
When all else fails cut to the chase and re-install.
0
 

Author Comment

by:CodedChaos
ID: 20037509
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
 
LVL 8

Expert Comment

by:Bradley Haynes
ID: 20037599
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
 
LVL 13

Expert Comment

by:WizRd-Linux
ID: 20037792
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
 

Author Comment

by:CodedChaos
ID: 20037864
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
 
LVL 13

Expert Comment

by:WizRd-Linux
ID: 20037974
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
 

Author Comment

by:CodedChaos
ID: 20038010
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
 
LVL 13

Assisted Solution

by:WizRd-Linux
WizRd-Linux earned 750 total points
ID: 20038080
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
 

Author Comment

by:CodedChaos
ID: 20038165
I guess that's what I'll do, I've split the points to both of you, thanks for your help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question