How to Fix Windows MBR from Ubuntu

If you have tried to dual boot your Windows system with Linux, then you have probably encountered some changes that may not be welcome. When installing Linux in this environment, the GRUB bootloader will overwrite the Windows bootloader within the Master Boot Record (MBR).

This is also true in the reverse: If you installed Linux first and then decide to install Windows, the Windows bootloader will overwrite GRUB, and you will find there is no way to boot into your Linux Desktop. Or perhaps you have decided Linux is not for you and want to remove it entirely, leaving just Windows.

Any of these scenarios can be problematic for the new user, but thankfully with a little patience and care, there are ways to restore the bootloader, and in the process, repair the MBR.

Note: As an additional scenario that will affect a lot of users, it appears the Windows 10 Anniversary Update overwrites the bootloader as a matter of course.

Requirements

The first step will be to download and create your Linux live CD or USB. Ubuntu is by far the easiest and most accessible distribution to use, although most Linux distributions can be used for this. Using another computer, browse to the Ubuntu website and download the copy that is right for your architecture. If in doubt, grab the 32-bit version, as this will boot on any machine.

ubuntu-desktop-download

Follow this guide to create a Linux live USB on Windows.

RelatedHow to Install Minimal Ubuntu on Your Old PC

Booting into Ubuntu live USB

With your live media created, the next step is to boot your machine into Ubuntu via the BIOS and select, “Try Ubuntu without installing” from the menu. If this fails, ensure that secure boot is DISABLED in BIOS, or your system will never boot into the GRUB loader to allow a Linux selection.

Once the desktop has launched, you will need to open the Terminal which can be found within the Applications menu.

ubuntu-terminal-select

Note: at this point, be aware you are dealing with your hard disk directly, and read through the guide fully before making any changes, otherwise your entire system may become unstable or corrupted.

By far the easiest way to repair the MBR is by using a small utility called “boot-repair” as opposed to working directly in the Terminal.

Method One: Boot Repair Utility

First, you’ll need to add the repository. Type:

Once it has installed, find the application within your Applications menu and click to start.

ubuntu-boot-repair

Once the utility starts, select the repair type. For most people this will be the recommended repair.

ubuntu-boot-select

When the utility finishes, you should be able to boot your system and select either Windows or Linux from the GRUB menu. Running the utility will also let you change or investigate some of the other options above if you require a more complex boot repair. Clicking “Restore MBR” will enable you to use the MBR tab.

ubuntu-boot-repair-2

If you get stuck, Ubuntu has a guide on their website.

Method Two: Syslinux

This is slightly more advanced and requires you to work with the Terminal. If you are not confident, then please stick to the first method.

Open a terminal as before and type:

Once it has finished, type the following, remembering to change the drive name “sda” as appropriate:

Alternatively, you can restore the MBR by typing:

Method Three: LILO

Boot into the live CD or USB, and within the Terminal type:

where “/dev/sda” is your drive name. This should fix your MBR.

Conclusion

If you are dual-booting Windows and Linux, it is very easy to overwrite the MBR. The above steps should help you restore your MBR. Hopefully you now have a working bootable Windows system.