Wednesday, December 2, 2009

How to restore Grub from a live Ubuntu cd.

This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.


Put a ubuntu live cd on your cd rom and restart and boot from cd so that you could become a live session user.........When u get into the desktop open terminal and type.....The code to be typed is highlighted so that you could easily find the codes........


sudo grub


This will get you a "grub>" prompt.It is the grub shell...At grub>. enter these commands


find /boot/grub/stage1


This will give you a location..whatever was returned for the find command use it in the next line


root(hd?,?)


Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr



setup (hd0)


Finally exit the grub shell


quit


That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.








2 comments:

  1. Hi Ganesh,
    I always gets troubled with grub problem.
    Next time i will check this. But on my installed UBUNTU "sudo: grub: command not found" error message is shown when i typed sudo grub.
    Does it only works on Live cd's?

    ReplyDelete