Solution 1 Disable the Window Program Writing to the MBR
See what happens if you disable or uninstall programs in Windows which might be writing to extended MBR. You also might be able to determine the program by looking at a hexdump of the extended MBR. Open a terminal in your Linux OS and type
Code:
sudo dd if=/dev/sda of=/good_mbr count=63
(this assume that you are booting from /dev/sda, otherwise you might have to use /dev/sdb, /dev/sdc, ...)
Next time grub fails to boot, boot into a Linux Live CD, type
Code:
sudo dd if=/dev/sda of=/bad_mbr count=63
and compare the two files:
Code:
sudo mount /dev/sda3 /mnt
sudo hexdump -C /mnt/good_mbr
sudo hexdump -C /bad_mbr
(here /dev/sda3 needs replace by the device name of the Ubuntu partition)
Solution 2 Revert to Legacy Grub
Code:
sudo apt-get purge grub-pc
sudo apt-get install grub
sudo rm /boot/grub/*
sudo grub-install --recheck /dev/sda
sudo update-grub
This assume that /dev/sda is your boot drive. Otherwise you need replace /dev/sda by one of /dev/sdb, /dev/sdc,...
You also need to add Windows to your Grub menu:
Code:
gksudo gedit /boot/grub/menu.lst
and add an entry for Windows at the very end of the file:
Code:
title [Your Version of Windows]
rootnoverify (hdY,Z)
chainloader +1
if Windows is not on the boot drive, that is if Y is not zero,you also need the map line:
Code:
title [Your Version of Windows]
rootnoverify (hdY,Z)
map (hd0) (hdY)
map (hdY) (hd0)
chainloader +1
Solution 3 Install Grub2 to a partition and use a different boot loader in the MBR
Code:
sudo grub-install --recheck --force /dev/sda2
sudo apt-get install lilo
sudo lilo -M /dev/sda ext
echo "SET grub-pc/install_devices /dev/sda2" | sudo debconf-communicate
here /dev/sda2 needs to be your Ubuntu partition. If you use the Windows partition by accident, you won't be able to boot Window anymore.
Solution 4 Install Grub to the MBR of a different hard drive
Code:
sudo grub-install --recheck /dev/sdZ
echo "SET grub-pc/install_devices /dev/sdZ" | sudo debconf-communicate
and set your Bios to boot from /dev/sdZ