Sunday, October 7, 2012

How to fix Dual booting issues! (Windows 7 + Linux/Ubuntu)

In this blog, I am going to demonstrate you the most complex scenario that can happen. Not everyone may fall in this category, but if you learn how to come out of this, then you can easily come out of every other scenario ;)

One of my friends have Dell XPS 13 Ultrabook, a good looking white computer ;) but only with 120 GB hard disk :(  and no CD drive as well !  Out of which nearly 20 GB was eaten by Windows Recovery partition! Damn Windows, Isn't it ? :P And One day she decided to install Ubuntu on it. So me being genius ;) have suggested to delete the recovery partition and install Ubuntu on it (Why the hell does one want to waste 20% on recovery which never works when needed the most :P) And then boom! The worse thing happened!

(Impatient folks can directly jump to summary to get the fix)

Installed Ubuntu successfully. Good! But ...... After restarting, its booting directly into Ubuntu without presenting any options. Since I know a little bit about Ubuntu, I knew that one has to restore grub after installing Ubuntu on a windows machine. So I copied Ubuntu on a USB flash drive and followed this guide, using recommended option, restored grub. The Commands I used to restore grub are

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair

(And selected recommended repair)

Now grub appeared ! I can see some options. But ...... sadly windows option didnot appear in the grub. On Quick Googling, I found out that windows might be corrupted.It might not be your case though! Check with boot-repair forums or Ubuntu forums given below.   And learn't that, I have to first fix windows to appear in grub menu. What happened here is, recently, Windows started placing some of its important boot files(bootmgr) which are necessary for booting up of windows on recovery partition instead of Standard C partition. Weird! But yeah, thats how windows is :P Since I deleted it, Windows is not booting. So I googled and found out various links for repairing bootmgr files. One good link I found is - this

But I neither have windows Image nor CD drive. So, using windows 7 OS image from internet installed on a pendrive, I tried to repair the windows with above guide. But ......  unfortunately it didnt work! So Googling began again ! Later I found out that before applying the fix, I first have to make C partition active . Done. Then I followed the previous procedure again to restore windows boot loader . And finally windows is booting! yayyyyyyyy! And now, I am booting directly into windows and Linux is not appearing :( Then using Ubuntu on pendrive, I followed the above guide to restore the grub. And finally everything works now. Grub - Dual boot - Both Linux and Windows showing in menu .  Wowwwwww awesome! Finally :) Thank god! Problem is solved :)

Few more details for interested ppl

When a system starts, control first goes to BIOS - The first screen you see (showing Dell/HP logo). Then the control goes to MBR (master boot record 0-512bytes of the harddisk). In MBR, partition table as well as boot loader code (necessary for booting up of OS - also called as bootstrap code) is present. Windows have its own bootloader and Ubuntu have its own (GRUB).A hard disk can have max 4 primary partitions or 3 primary + 1 extended partition. Extended partition can be further divided into multiple extended partitions. In case of GRUB, after control goes to MBR, it loads GRUB stage1 which inturn loads stage 2. And from GRUB, depending on users selection, it either loads Linux Kernel (first loads VBR of the linux partition which inturn loads Linux Kernel) or control goes to Windows bootloader.VBR is first sector of a partition.It contains code to load an operating System present in that partition

Note: Everyone might not need to follow all the below mentioned steps.
  • After installing ubuntu on a windows box, fix grub using boot-repair using Ubuntu image on pendrive. If everything works fine,and both windows and ubuntu are appearing,  then you are lucky. Go and sleep. If you are not that lucky read on.You cannot sleep now :P
  • In case windows is not appearing, it might be corrupted (neednot be true in all cases though)
    • Then First fix windows . Till then it wont appear in grub
      • Try repair using  this.  If it didnt work (as in my case) then
        • First Make C partition active using - this
        • Then repair windows using the repair guide in above step. If it says success, then you will be able to boot into windows!
    • Now windows is fixed.
  • But you will notice, sadly grub is gone . You cannot boot into ubuntu now. No worries.Its very simple. Just use Live ubuntu CD and using boot repair, restore grub using this
  • Now Everything should work fine! If not , hmmm, you are still not lucky. Apart from googling ,try to post in forums given below.

Valuable Resources

  • In case you have some issues with windows 7 - You can ask here
  • In case you have some issues with boot repair of Ubuntu - you can ask here
  • You can also get some help from here
  • And last but not least, you can find awesome help from here

Happy Dual booting :)

PS: Oops forgot to add an important disclaimer: I just shared my experiences so that it can help others. I am not responsible if you followed this and anything wrong happens and bla bla bla. Just kidding :) Check with someone else too before applying the above fixes :) Special thanks to Seven forums, askubuntu, boot-repair devs for helping me in fixing my issue :)


  1. This comment has been removed by the author.

  2. This comment has been removed by a blog administrator.

  3. This comment will be removed by the author

  4. Awesome blog if need any type of problem of windows 7 so go through this site and fix your problem of any type of your problem
    Fix Windows 7 Error 1068
    Thank you
    Aalia lyon

  5. THANK YOU. I did exactly the same thing you did, and I would never have figured out the right combination of steps to get it working. Your instructions worked perfectly.