Reinstallation of GRUB
How to reinstall GRUB?
Note: before continuing read this post if you are not familiar with GNU/Linux
http://debian.sreenadh.in/mount-partitions-in-a-gnulinux-system/
Put the first DVD of Debian in DVD drive. After booting from DVD you will be asked to choose language, country, keyboard layout. you need to press 3 enter keys for that process.
Press Ctrl Alt F2 then
Press enter key
If you are reinstalling grub of latest Ubuntu versions the partition type may be ext4 so instead of using Debian DVD use Ubuntu live CD otherwise mounting will fail.
mkdir temp_dir
mount /dev/hda6 temp_dir
(where hda6 is your GNU/Linux partition. if you don’t know where you have installed GNU/Linux mount partitions one by one and run the following command to see the contents of that partition.
ls temp_dir
Eg:
mount /dev/hda5 temp_dir
ls temp_dir
if you can see bin boot usr opt directories then it is your GNU/Linux partition. else
umount temp_dir and try other partitions
)
then run the following commands in order.
mount -o bind /dev temp_dir/dev
mount -o bind /proc temp_dir/proc
chroot temp_dir
grub-install –root-directory=/ –no-floppy –recheck /dev/hda
where hda is your hard disk where you have installed GNU/Linux
exit
umount temp_dir/dev
umount temp_dir/proc
umount temp_dir
reboot
Related posts:
thank you for your great reply.
I was using my laptop by dual booting Ubuntu 10.04 and Windows XP. One day i had to format my Window partition and i was not able to boot into Ubuntu since the GRUB was overwritten by the windows bootloader. So i decided to use this method as said by Sreenadh.
But while mounting my Ubuntu drive, it shows like this
mount /dev/sda5 temp_dir
mount: mounting /dev/sda5 on temp_dir failed: Invalid argument
Any idea about what to do now?
The problem is fixed. Ubuntu 10.04 partition is ext4. Debian Lenny
installer does not support ext4. Used Ubuntu Live CD.
Something different from this
http://www.gnuise.co.cc/gnulinux-tips/grub-2-reinstallation
Since this how to make use of chroot any livecd can be used to reinstall grub regardless of the grub version in the livecd
I have successfully reinstalled grub in Ubuntu following this post.Thanks a lot.