Recovery Procedure for a Dual-Boot Windows and Linux

Recovery Procedure for a Dual-Boot Windows and Linux
Page content

What is a Boot-Loader and Why Should I Care?

If your system will not boot after the installation of a operating system or will only boot one of the two installed operating systems, there is a problem with your boot-loader and/or master boot record (MBR). Most computer users will never encounter a situation where they need to know how a computer boots, what a boot-loader is or how to fix one. You (if you landed at this article) are not “most computer users” though. A boot-loader is a piece of software code that tells your computer what operating systems are installed on your PC and gives you the option of which to boot. Lets take a closer look at the problems you can encounter when setting up a dual-boot system and how to fix them so you can get back to work (or play?)…


I Installed Windows After Linux!

If you installed Windows after Linux then chances are that Windows has overwritten the grub2 boot-loader - located in the Master Boot Record (MBR) - and you can no longer boot into Linux. After the Windows install, your computer probably auto-loaded Windows, giving you no grub2 boot-loader and no option to boot into Linux. Don’t panic. This is an easy fix that involves booting a LiveCD and re-installing/updating grub2. To re-install the grub2 boot-loader and regain your ability to boot Linux, follow these steps:

  1. Boot your Linux LiveCD
  2. Mount your Linux partition. If you have multiple Linux partitions (/home, /tmp, /boot, /) you need to mount the /boot partition.
  3. Open terminal and verify you mounted the correct partition with the command: mount | tail -l. The output from this command should resemble the following: /dev/sda2 on /media/0d104aff-ec8c-44c8-b811-92b993823444 type ext4 (rw,nosuid,nodev,uhelper=devkit).
  4. Re-install grub2 with the following command but substitute the UUID in the example with your UUID: sudo grub-install –boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda

If you happen to be using a Linux distribution that is still using the original grub as it’s boot-loader, the steps differ slightly. To re-install the grub boot-loader and regain your ability to boot Linux, follow these steps.

  1. Boot your Linux LiveCD.
  2. Mount your Linux partition. If you have multiple Linux partitions (/home, /tmp, /boot, /) you need to mount the /boot partition.
  3. Using terminal open the grub command-line utility by executing: sudo grub.
  4. Execute: root (hd0, 1) - this is assuming you have Ubuntu installed on the second partition of the first hard drive.
  5. Execute: setup (hd0) - this is assuming that your first hard drive is your boot device. Ubuntu can be installed on any drive but in most cases your BIOS will look at your first hard drives MBR to find the boot-loader.
  6. Execute: quit - to leave the grub command-line utility.
  7. Reboot your system and grub should now function properly.

Using Boot-Repair

Boot-Repair is a small program that you can use to repair boot problems, including the inability to boot Linux after the installation of Windows. To make use of Boot-Repair, you will have to download and boot your computer using a special Ubuntu LiveCD that has been modified to include Boot-Repair. Depending on your system, you will have the choice of the 32-bit ISO or 64-bit ISO. You download, burn (to CD, DVD or USB stick) and boot this Ubuntu LiveCD the same as any other Linux LiveCD, so you shouldn’t have any trouble there. Once you are booted into this modified LiveCD, you will want to launch and execute Boot-Repair. If you are using Gnome you will find Boot-Repair under the System > Administration > Boot-Repair Menu and in Unity you will simply need to search for “Boot” from the dash. Once launched, you will find that Boot-Repair is a basic program with very few options. You will be asked to choose which operating system you want to boot by default and where to place Grub. That’s it. Boot-Repair will detect what operating systems are installed on your system and re-install Grub so that you can access each from the Grub boot menu.

To sum up, there are various scenarios where you may lose your ability to boot into Linux. The most common of these scenarios is when a user installs Windows after Linux, overwriting their boot-loader in the MBR. Your MBR and/or boot-loader may become corrupt for other reasons as well; basically if you are having problems with the Grub boot-loader, the above instructions will help you get it sorted out. By far the easiest way to correct these problems is to use the Boot-Repair LiveCD and I recommend keeping one on hand, but if you already have a stock Ubuntu LiveCD at your disposal, the terminal process of re-installing Grub will work equally as well.


  1. Author’s own experience with various Linux distributions and the use of grub/grub2.
  2. Ubuntu Documentation, RecoveringUbuntuAfterInstallingWindows
  3. Ubuntu Documentation, BootRepair