Discussion of this wiki can be found here
- This wiki is for Windows dual booters who reinstall an operating system only to find that it has taken away access to their other operating system.
Whether you want to restore the XP, Vista, 7 or Ubuntu (Grub) bootloader, this guide will walk you through it.
All four parts of this tutorial require that you boot from a CD or DVD. If you don't know how to do this, check here.
If you have made a mistake and want to revert the changes, simply follow the instructions for reinstalling the previous bootloader. For example, if you have installed vista over ubuntu, try to get the ubuntu bootloader back, but want to get the vista bootloader back, simply follow the instructions for installing the vista bootloader.
How to fix the Ubuntu GRUB bootloader
See this paragraph.
How to fully fix the Windows bootloader using a Windows disk
Boot on your Windows XP installation CD or XP Recovery console. You will get to a part where it asks if you want to repair or recover. To do so, press "r". If prompted, enter your Windows XP administrator password. This will leave you at at a command line, so type in the following two commands:
- Then type
- Then remove your XP cd. If everything has gone well, you should come to your XP bootloader.
Windows Vista or 7 or 8
- First boot on your Windows Vista/7/8 installation DVD.
If you have one of the many OEM computers that didn't come with a Windows installation disk, you can get the same effect with a Windows repair disk, which you can download (eg Win7-32bit, Win7 64bit) or create from another Windows Vista/7/8 computer (see this page for Win7 and Make your own Windows repairCD, and Windows 8 UEFI repair USB must be FAT32, other Win8 guide). When you get to the Regional settings, select your Location/Keyboard setting then click next. On the next page, click on "Repair your computer." On the next page, if it finds your Windows installation, make sure it is UNSELECTED before clicking next. Then click on "Command prompt". From there, type in the following 2 commands:
- Now close the two windows and click "Restart." Take out your Windows DVD and hopefully, you will be left with your Windows bootloader.
How to partially fix the Windows bootloader using an Ubuntu CD
Note: these methods will work on Legacy firmwares (not UEFI), if Windows boot files are not broken, and if the boot sector of the Windows boot partition is healthy. In other cases, you will need a Windows installation or repair disc as described above.
Via the Boot-Repair graphical tool
Run Boot-Repair from a liveCD, click "Advanced options", tick "Restore MBR", click "Apply".
This will automatically restore a generic syslinux MBR, and set the boot flag on the Windows boot partition. This will also tell you if the Windows bootsector needs repair (see this tutorial).
Via command lines
1. Boot from the live CD (or live USB) of any recent version of Ubuntu and choose “Try Ubuntu” to get to the live desktop
2. Check that the partition from which Windows boots has the 'boot' flag. For XP and Vista, this is normally the main C: partition. Windows 7 usually (but not always) has a separate boot partition of 100-200 MB in size with the partition label “SYSTEM”. There are also more exotic configurations where two versions of Windows have been installed to the same hard drive, or where the main Windows partition is a logical one. In these cases there will be a single primary partition with the Windows boot files which needs to be marked as active, and you will need to identify which this is. Once you have done so, open Gparted and see if “boot” is listed under the flags column for that partition. If not, highlight the partition and go to Partition menu → Manage Flags, tick the tick-box for “boot” and then close that window and close Gparted.
3. Both methods below assume that the boot drive is designated /dev/sda in Ubuntu. This is almost always so, but with some unusual BIOS configurations where there is more than one hard drive, the boot drive may be other than /dev/sda. In such cases you will need to adjust the command appropriately.
If internet connectivity available, open a terminal and run these commands:
sudo apt-get install lilo
sudo lilo -M /dev/sda mbr
If no Internet connection: recent versions of Ubuntu include the file /usr/lib/syslinux/mbr.bin which is 440 bytes in length and simply needs to be written to the beginning of the mbr with this terminal command. WARNING! Be very careful with this command and check for typos before running it.
sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda
4. Now reboot, remove the Ubuntu CD and you should reboot straight into Windows.