Grub, by default, resides in the Master Boot Record(MBR). When you try to install some other boot loader or try to install/reinstall Windows, the grub information in the MBR will be overwritten. So, Grub might have to be reinstalled.
When some/any part of partition information is changed, the grub configuration won’t be automatically notified of it and so, the grub configuration will remain as it is. There maybe many cases in which the partition information maybe changed like when you create an extra partition, which is something trivial and may or may not affect the grub boot loader. However, most of the times, changes in the partition information will result in errors when the grub boot loader is loaded. So, the grub configuration has to be updated and the easiest way is to reinstall Grub.
There are many such cases and in these cases, people tend to treat the effect, more than the cause. By this, I mean people tend to usually reinstall Ubuntu or Fedora or whichever GNU/Linux operating system they are using, through which Grub will be automatically reinstalled. But is it necessary? No, Grub can be reinstalled without reinstalling the entire operating system! In fact, Fedora CD/DVD does offer to reinstall Grub if you choose to upgrade your system. However, I have tried to use that option in many of my friends’ computers and it has never worked! I have no idea why it doesn’t work. So I resort to the easiest fool-proof method I know - COMMANDS @ TERMINAL
COMMANDS TO REINSTALL GRUB:
All you need to do is access the terminal using the installation CD/DVD of your GNU/Linux operating system. Ubuntu installation CD is a live CD and so, when it loads, you can run the terminal from there. Fedora installation CD/DVD offers options through which you will have to choose to upgrade the system using commands(rescue mode).
Once you are at the terminal, you will have to access the ‘grub’ shell to change the grub configuration. So, give this command at the terminal:
If it says that you don’t have the permission, in which case you will not have logged in as root(as in Ubuntu), give this command at the terminal:
$ sudo grub
You will get the grub-shell prompt:
Now, you will have to find out in which partition Grub had been installed before, so that you reinstall in that partition only. Give this command at the terminal:
grub> find /boot/grub/stage1
It returns the number of the partition in which Grub i.e your GNU/Linux had been installed.
grub> find /boot/grub/stage1
Before reinstalling Grub, you will have to notify the partition that your Grub i.e. GNU/Linux is resided in. So, give this command at the terminal:
grub> root (returned value)
grub> root (hd0,2)
Now, reinstall grub in the MBR i.e. the returned value without number part.
So, give this command at the terminal:
grub> setup (returned value without number part)
grub> setup (hd0)
Exit the grub-shell prompt using “Ctrl+c”.
Exit the shell prompt using “Ctrl+d”.