LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Recover grub bootloader after win install! (http://www.linuxquestions.org/questions/linux-newbie-8/recover-grub-bootloader-after-win-install-315424/)

teronslair 04-20-2005 03:13 PM

Recover grub bootloader after win install!
 
I am using Fedora Core 3 and recently i had to reinstall Winxp on my system. Problem is I no longer have access to the Grub and I cannot boot Linux anymore. Please help me with some advice on how to avoid this on future Windows installations. Because, trust me, they are needed. Is there a software that saves my boot config and rewrites it after a new install? I really cannot afford to install 3Gb worth of Linux every time!!! Help!

david_ross 04-20-2005 03:16 PM

You should be able to boot with fedora cd1 and at the boot prompt enter "linux rescue".

Once booted run:
chroot /mnt/sysimage
/sbin/grub-install /dev/hda

This should put grub back on the mbr.

jsutton 04-20-2005 03:21 PM

If you still have the Fedora Install CD:

1. Boot off the cd.
2. At the boot prompt, type 'linux resucue' (no quotes) and hit enter.
3. continue with the default options through the prompts.
4. when you get to a bash prompt, type 'chroot /mnt/sysimage' (I think that's the path).
5. then, type '/sbin/grub-install /dev/hda' (assuming, hda is your system drive).
6. reboot your computer off the drive.

If that doesn't work, I have a different procedure, but I don't remember all of the steps right off the top of my head. ;)

*edit: Aw junk, someone beat me to the answer.....

cDn_NeMeSiS 06-29-2006 12:18 PM

Quote:

Originally Posted by jsutton
If you still have the Fedora Install CD:

1. Boot off the cd.
2. At the boot prompt, type 'linux resucue' (no quotes) and hit enter.
3. continue with the default options through the prompts.
4. when you get to a bash prompt, type 'chroot /mnt/sysimage' (I think that's the path).
5. then, type '/sbin/grub-install /dev/hda' (assuming, hda is your system drive).
6. reboot your computer off the drive.

If that doesn't work, I have a different procedure, but I don't remember all of the steps right off the top of my head. ;)

*edit: Aw junk, someone beat me to the answer.....

another way to do this is the same but instead 'grub-install /dev/hda' because sometimes show a error of bios no foud or something, it is because the devices are mapped and /dev/hda does not work and you can try if the otrhr solution don work type
'/dev/mapper/pdc_ebajbgad' and its the same device hda mapped to pdc_ebajbgad and should be work

sorry for my english

teronslair 07-02-2006 01:24 AM

Thanks guys
 
Ok, thanks a lot for the advice. As i'll use Linux more and more i'll get the hang of this.

towsonu2003 02-15-2007 08:51 AM

there is a nice guide at http://wiki.ubuntu.com/RecoverGrub in case anyone needs :)

pixellany 02-15-2007 09:01 AM

As for avoiding this in the future:
Put GRUB on a floppy

towsonu2003 02-15-2007 09:09 AM

Quote:

Originally Posted by pixellany
As for avoiding this in the future:
Put GRUB on a floppy

not to troll, but many computers don't come with a floppy drive nowadays, especially laptops.

saikee 02-15-2007 11:54 AM

Grub put on a floppy----->Chapter 3.1 of Grub Manual refers

Grub put on a CD--------->Chapter 3.4 of Grub Manual refers

A bootable Grub floppy or CD is the most lethal weapon in the booting business.

There is no PC system such weapon cannot boot.

If a PC system is bootable then a Grub floppy or CD can fire it up and you don't even need to tell Grub what that system is.

For a Linux you can remove every trace of its boot loader and Grub can still fire it up.

If you know how to use a bootable Grub floppy or Grub CD then you can kiss all your booting problems good bye.

---------------------------------------------------

As an example how I would use Grub to solve the OP problem as follow.

(1) I boot up a Grub CD (or a floppy) to get a Grub prompt.

(2) I type
Code:

geometry (hd0)
to see the hard disk partitions layout. Since this is a Fedora C3 it must has a Type 83 partition for /boot, a Type 8e for LVM and a Type 7 for the XP. FC3 may have several Type 83 partitions if LVM is not used but the /boot is always at the front. Say the first type 83 partition is number 2 then I can fire up Fedora by
Code:

root (hd0,2)
configfile /grub/grub.conf

--------------------------
If I want to be lazy I can ask Grub to find out which partition has grub.conf by command
Code:

find grub.conf
and use that partition reference for the above "root" command.

I can also restore the Grub without booting up Fedora by
Code:

root (hd0,2)
setup (hd0)

the above is exactly what would be achieved by Fedora's installation CD except it is done with a Linux and Grub can do it without a boot-up Linux.

Also if the Fedora still doesn't boot I can ask Grub to diaplay its cconfiguration file by
Code:

cat (hd0,2)/grub/grub.conf
I can then follow line by line to type the same command at the terminal boot Fedora "manually" and vary the parameters at the same time if needed.

A Grub floppy or CD can fire up the XP, say if it is in the 1st partition, by
Code:

root (hd0,0)
chainloader +1
boot

Grub counts from 0 so hda3 is (hd0,2) and so on.

You see one humble Grub floppy (with only 2 files inside) or Grub CD (with only one file inside) can solve your booting problems for good!

towsonu2003 02-15-2007 11:58 AM

link to manual for convenience http://www.gnu.org/software/grub/man...l#Installation

PS. "If you know how to use a bootable Grub floppy or Grub CD" doesn't look so easy to grasp

saikee 02-15-2007 12:35 PM

I got nothing to do with Grub and just like you I am no more than an end user.

My Grub Manual is exactly the same one you can read from the Internet and does not contain one extra word in it.

I would say it is fair to say Grub Manual isn't easy to understand for a beginner because Grub's ambition lies beyond Linux and so the notations, the methods, the explanations are generic. However once you start to refer to it when you have a problem you can see a solution there.

Grub never told us it can boot every system manually, nor it ever makes the claim that there is no PS system it can't boot. The folks who wrote Grub were only interested to provide the functionalities. It is up to the users to apply the tool.

In a nutshell a user should look upon Grub as a mini operating system loaded before the Linux kernel. There is a lot he/she can do with this mini operating system which is lightening fast, seldom hangs and is remarkably flexible.

My whole point is you can talk to Grub, interact with it and let this bugger teaches you all the tricks it can do. Grub always responds error or warning if it cannot accept a command so one can learn from Grub very quickly by booting systems manually. The commands on how to boot systems are already written in grub.conf (or menu.lst). The whole thing is a lot easier than many people think.

Hitboxx 02-15-2007 01:02 PM

Yes definitely, Grub is so easy and yet powerful, reading and applying the read is the only way to go, i read a lot about grub, learning along the way and now i find myself absolutely at ease with it.

Edit: And saikee, all your links have become my bookmarks long back, thanks for that, and that 100+ systems blew away many of my Windows friends,lol :)

saikee 02-15-2007 04:16 PM

shrikant.odugoudar,

Glad you found Grub easy. So I haven't been telling lies after all.

robertri 08-12-2008 10:23 AM

Super grub problem
 
Hey
Hope it's not of topic. I tried Super Grub Disk, Auto Super Grub Disk that is, and it installed fine. But when i booted with it, it found the partition with boot files (grub.conf), but it hanged when trying to boot.. Is there something wron with my system?

Booting with a cd. Seems pretty unpractical to have a cd every time you start the computer...

sirajuddin 12-16-2008 12:33 AM

Thanks very much.
 
Quote:

Originally Posted by david_ross (Post 1601683)
You should be able to boot with fedora cd1 and at the boot prompt enter "linux rescue".

Once booted run:
chroot /mnt/sysimage
/sbin/grub-install /dev/hda

This should put grub back on the mbr.



Thanks very much David Ross. Its very useful for me. Thanks once again.


All times are GMT -5. The time now is 07:01 PM.