Monday, March 2, 2009

Installing Windows after UBUNTU

OS: Ubuntu 8.04 (Hardy Heron)
Kernel: 2.6.24
Date: March 2nd, 2009
Hi everyone I have dual boot system. I've kept Windows (I don't know why). Anyway the point is most of the time it happens that my Windows get some problem and needed to be reinstalled (as usual). So every time I do that I lose my grub on primary drive, Reinstalling properly working Ubuntu for such a small reason is too much pain.
Hence I used to prefer installing only GRUB after installing Windows. Here are few steps those will help you recover your lost GRUB:
I suppose you have live CD along with you (if no order one - its free or just download - its completely Legal).
To recover your GRUB:
  • Boot with Live CD (I've tested with UBUNTU 8.04 and 8.10)
  • Open Terminal (Applications -> Accessories -> Terminal)
  • Open grub prompt with:
sudo grub
  • You will see a grub prompt as below, we are suppose to use it to find and recover grub
grub>
  • Type following commands to find your grub: (Here TAB doesn't work)
grub>find /boot/grub/stage1 (If this one doesn't work for you then use the other one - gives ERROR)
grub>find /grub/stage1
You will get (hdX, Y) as output (in my case (hd3, 0))
  • Set the root device
grub>root (hdX, Y) (substitute X, Y with ones you got in above step)
  • Install grub
grub>setup (hd0)
  • Exit grub prompt
grub>quit

Now reboot and you will have working grub (with all the OSes detected automatically)
This always works for me so i haven't ever tried following steps but for some reason you don't get Windows option in your grub menu. Here are the steps (explained at source page of this post):
  • Log in to your Ubuntu and then open terminal and enter:
sudo gedit /boot/grub/menu.lst (use gedit/vi/kate whatever you like)
  • If there is no Windows paragraph as shown below put one as it is
(IMP: Put your Windows paragraph before or after AUTOMAGIC KERNEL LIST in the menu.lst )
title Windows XP/Vista # You can use any title you wish, this will appear on your grub boot menu
rootnoverify (hd0,0) #(hd0,0) will be most common, you may need to adjust accordingly
makeactive
chainloader +1

P.S. sentences followed by # are comments

Thats all and you have everything working smoothly :)
This solution was posted at:
https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows (last checked March2nd, 2009)

No comments:

Post a Comment