We all know that, in a machine which is a dual boot (one which has more than one Operating System) its important to have Grub Loader (especially when you have Linux based distro) as Grub is responsible for Switching between the OS. When you have Linux based distro already in your PC but for some reason you also install Windows or Update to Newer Version or Reinstall Windows, it happens that Windows REPLACES Grub Loader from your machine and puts Windows Boot Loader due to which you can’t switch to any of the other Linux based distros. Hence its important to know how to re-install Grub Loader rather than re-installing the distro itself.
In the earlier methods i.e. before Ubuntu 9.10 there was Grub 0.97, but after Ubuntu 9.10 they introduced Grub 1.96.
In the earlier versions it was quite easy to install Grub Loader as you have to type commands such as ‘sudo grub’ which used to take you to grub prompt. Where by giving ‘find /boot/grub/stage1’ you used to give location where exactly grub loader was located and then by ‘root (hd_,1)’ and ‘setup(hd_)’ you were able to get back Grub Loader.
But in Grub 1.97 the method is changed. I tried to find out ‘menu.lst’ and ‘stage1’ files in grub folder but I found that these files are removed and replaced by ‘grub.cfg’. In fact if you run ‘sudo grub’ in any live CD it gives error as ‘Command not Found’, then i tried it by installing via ‘sudo grub-install’ and tried replacing ‘stage1’ by ‘grub.cfg’ ie ‘find /boot/grub/grub.cfg’ but it was not working out. There is a little different way of installing Grub 1.97 in your machine.
- Boot from Live CD (Ubuntu 9.10 or above)
- Mount the partition which has ‘Ubuntu Installation’. (Note that it is ‘/’) And once mounted you should see ‘boot’ folder in it.
- Get the UUID of the partition. You can get the UUID from ‘/media’. In my case its shown in the image. (You better go to Properties of the partition by right clicking on the partition and then Copy it)
- And then open ‘Terminal’ from ‘Applications -> Accessories’.
- Then type
sudo grub-setup -d /media/UUID/boot/grub /dev/sda
- Replace UUID with your UUID.
- In the above case ‘sda’ and ‘sdb’ will be dependent on where MBR is installed in most of the cases its in ‘sda’.
- Reboot it.
- BANG!! You will get those OS options again.