LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   reinstalling the GRUB (https://www.linuxquestions.org/questions/linux-newbie-8/reinstalling-the-grub-527040/)

offbeat 02-09-2007 10:49 AM

reinstalling the GRUB
 
Previously i had a dual boot system with Fedora Core 5 and windows xp. When i reinstalled windows xp, when i switch on my PC, the GRUB doesnt show up as before and it boots directly into Windows. I do not have the installation DVD of Fedora but i do have the installation CD of Red Hat. I tried using the rescue feature on the Red Hat CD but it fails to detect the Linux partition. Can anyone please help me with it? I need to access the Linux partition. ( I have couple of Live CD's too.. like ubuntu, mandriva and knoppix.. incase they can do the work...) Thank you in advance

pixellany 02-09-2007 01:00 PM

Any of the live CDs can be used to re-install GRUB. You need to know the partition numbers where Linux is installed. The live CD can help you determine this also.

Specifically, you need to know the partition which contains the /boot directory. In a typical installation on an IDE/PATA drive, it might be like this:
/dev/hda1 Windows
/dev/hda2 Linux / (including /boot)
/dev/hda3 Linux swap

If yours is different, you will need to adjust the following:
To install GRUB:
boot from live CD
open a terminal
enter:
Code:

grub    starts the grub shell
root  (hd0,1)    tells grub that /boot is on the 2nd partion of drive 1)
setup  (hd0)    puts grub on the mbr of drive 1
reboot

Since you had grub working previously, it should find the config file and everything should work

You'll note that GRUB counts from zero and always uses numbers and "hd"
hda = hd0
sda = hd0
hda1 = hd0,0
hdb2 = hd1,1
etc

offbeat 02-10-2007 11:54 AM

Hi, first of all thanks for the post. I tried that using the live CD of Knoppix. After starting konsole (thats the terminal app.) and typing in grub, the grub prompt showed up.
Typing

grub>root (hd0,1) showed the error message
Error 21: selected disk does not exist

when you type
grub>setup (hd0) it says
Error 12: Invalid Device request

I tried the rescue option of the Red Hat Install CD but it fails to detect the partition where i have installed Linux.

Any suggestions?

Duck2006 02-10-2007 01:22 PM

From the live cd in the terminal type

sudo fdisk -l

this will show you where the linux partition is and then just ajust the partitions in the post as pixellany posted


All times are GMT -5. The time now is 01:32 AM.