After Reinstalling Windows in The Computer Dual Boot With Both Windows and Ubuntu Linux
After Reinstalling Windows in The Computer Dual Boot With Both Windows and Ubuntu Linux
Linux,you need restore grub because mbr has been rewritten.This tutorial shows how to
restore grub 2.
Update:Today I ghost my XP system,but after restore grub,I cannot boot into XP by
clicking the old windows option in grub menu.So youd better to run this command to
renew the grub2 boot list after trying following method:
sudo update-grub
If you dont, directly download boot-repair.iso file and burn into liveCD or liveUSB
(UNetbootin) then boot from it.
Open boot-repair, click Recommended repair to repair grub2 with one click.
ClickAdvanced options for details.
1).Using grub4dos
First download grub4dos from here.
1. For XP user,copy the file grldr(without quotes) from grub4dos package
to C:\.Editboot.ini (hidden file in C:\) and add this line to the file:
c:\grldr="grub4dos"
For Vista/win7 user,copy the file grldr,grldr.mbr to C:\.Create boot.ini file in the root
directory of C:,copy and paste following into this file.
[boot loader]
timeout=0
default=c:\grldr.mbr
[operating systems]
C:\grldr.mbr="Grub4Dos"
Restart computer,and select boot from Grub4Dos.Then select boot up Ubuntu in grub
menu.
Once login,use this command to install grub into mbr:
sudo grub-install /dev/sda
partition
grub-install --root-directory=/mnt/ /dev/sda
grub>kernel /boot/grub/core.img
grub>boot
After the boot command,youll go into grub2 menu.Select to boot up ubuntu,and run this
command to restore grub:
sudo grub-install /dev/sda