Monday, March 1, 2010

Modify GRUB

If your install of Linux is a dual boot setup with windows() you have run into this problem before. You reinstall windows and suddenly you can no longer access your Linux partition or the Grub bootloader. You can always go thrugh the entire install of Ubuntu again, or you can try to repair the bootload, but how do you repair the bootloader?


Well friends if you have the live CD for which ever distro you are using (that installed Grub) it is quite easy and can save you hours of reconfiguration as well as install time.

1. Find your Live CD and boot it up (set your BIOS to boot from CD first, or if your BIOS allows it you can select the boot device.

2. After the Live CD does its thing you will need to open a terminal screen and type in the command: sudo grub. This command will bring you into the grub prompt


3. Type the following commands assuming sda0 is which ever partition you are using (hd0,0 would be first hard drive and first prompt, hd1,1 would be the second hard drive and second partition).


> root (hd0,0)

> setup (hd0)

> exit


4. Reboot the system and remember to remove your Live CD before your system reboots


5. At reboot you should now see the Grub boot loader along with all your previous setting.


If with the new setup you now see Ubuntu but no longer see a windows menu item follwo the following steps.


If Ubuntu was installed before your Windows version there will be no information in the Grub confiruation for your windows setup. To get windows setup in Grub you will need to do a bit more tweeking.


Boot into Ubuntu and run the following command:

sudo gedit /boot/grub/menu.lst


Inside this file you will see an example for a windows choice for when Grub runs. *COPY* the exmple and remove the “#” from the beginning of each line


# title Windows 95/98/NT/2000

# root (hd0,0)

# makeactive

# chainloader +1

Remember you will need to change the hd0,0 to which ever if your windows partition, it may take a few trys, but if you were able to select the correct partition for Linux when resetting up Grub you should be able to figure out the correct partition for Windows.

Courtesy:Linux Tricks

No comments: