Reinstall-or-Repair-GRUB


Using Ubuntu 9.10 livecd or higher
---------------------------------------------------------------

Here assuming the Ubuntu partition is sda7,and /boot partition is sda6 (if you have a separate /boot partition).
Boot up ubuntu from the livecd,open terminal and run:

# sudo -i
# mount /dev/sda7 /mnt
# mount /dev/sda6 /mnt/boot  #skip this one if not have a separate /boot partition
# grub-install --root-directory=/mnt/ /dev/sda


If you miss “grub.cfg” file,use following to recreate:

# mount --bind /proc /mnt/proc
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
# chroot /mnt update-grub
# umount /mnt/sys
# umount /mnt/dev
# umount /mnt/proc
# exit


Using the cd/usb boot up with grub
----------------------------------------------------------
Boot up the cd/usb,press c in grub menu.Type:

grub>find /boot/grub/core.img
grub>root (hdx,y)   (previous command will output the x,y)
grub>kernel /boot/grub/core.img
grub>boot


After the boot command,you’ll go into grub2 menu.Select to boot up ubuntu,and run this command to restore grub:

# grub-install /dev/sda

Install Boot-Repair in Ubuntu
------------------------------------------------------


- either from an Ubuntu live-session (boot your computer on a Ubuntu live-CD or live-USB then choose "Try Ubuntu") or from your installed Ubuntu session (if you can access it)

- connect to the Internet

- open a new Terminal, then type the following commands (press Enter after each line):

$ sudo add-apt-repository ppa:yannubuntu/boot-repair
$ sudo apt-get update
$ sudo apt-get install -y boot-repair
$ boot-repair


    Then click the "Recommended repair" button.