First, grab a copy of the latest Ubuntu LiveCD and boot it.
$ sudo fdisk -l
$ sudo mount /dev/sda1 /mnt
$ sudo mount /dev/sda2 /mnt/boot Make sure you don't mix these up, pay attention to the output of FDISK
$ sudo mount --bind /dev /mnt/dev
$ sudo chroot /mnt
You should be chroot'd into your system as root, you can now run commands as root, without the need for sudo.
Now you need to edit the /etc/default/grub file to fit your system
$ nano /etc/default/grub
When that is done you need to run update-grub to create the configuration file.
$ update-grub
To install GRUB 2 to the MBR, next you need to run grub-install /dev/sda
$ grub-install /dev/sda
If you encounter any errors, try grub-install --recheck /dev/sda
$ grub-install --recheck /dev/sda
$ sudo umount /mnt/dev
$ sudo umount /mnt
If you had alternate OS entries, update-grub might say "Cannot find list of partitions!". Ignore it and continue - on
for more:https://wiki.ubuntu.com/Grub2#Recover%20Grub%202%20via%20LiveCD
评论