Tuesday, July 11, 2006

Reinstalling Grub without reinstalling the whole linux distribution.

Hi i tried to install Debian 3.1 in my friend's laptop. he had Windows XP,Suse and fedora core5. i installed Debian overriding Suse. there were problem with loading fedora through the debian boot loader. So i tried to reinstall only the grub of fedora. This is how i did it.

Use installation CD/DVD(Fedora core5) to boot the system. When the CD is booted it asks for boot option. most distributions provide the "linux rescue" option.
Type "linux rescue" (without the quotes) and press enter. this will usually provide you with a shell/command prompt.
This will also load the linux partition in the location /mnt/syslinux

This rescue mode is like booting into a live CD with only a console
Fedora was installed in /dev/hda5

now we need to install the grub.
grub-install /dev/hda5 --root-directory=/mnt/syslinux

if you face any problem like
"grub not found of grub:comand not found
then copy the executable grub from the following location
/usr/sbin/grub to
/sbin
And the command to do it is cp /usr/sbin/grub /sbin

The output would show that grub installation is successful

this will install your grub. type exit. this will reboot your system with the boot loader correctly configured.