How to boot into Windows 7 when grub is installed in the Windows partition?

Could you create a Bootinfo Summary report using the boot-repair tool as described below and then post the link to the report?

I know you have already provided some details about your boot configuration. However, the report I am asking for contains more detailed information and might give us a better understanding of why you are unable to boot Windows using GRUB.

How to use boot-repair to provide a "Bootinfo Summary"


Since you can still boot Ubuntu, you can install and run the Boot-Repair tool using the apt-get command and then use it to Create a Bootinfo summary.

Run the commands below in a terminal window to install the boot-repair tool.

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
  1. After that completes, enter the command boot-repair to start the tool.
  2. After a slight delay, boot-repair will ask if you want to download its newest version. Since you just installed the newest version, answer No.
  3. If boot-repair asks to install the pastebinit package, respond with Yes.
  4. The tool will now scan your system and (eventually) display the window shown in the image below. Click on the Create a Bootinfo summary box/button. This will collect information about your system's boot configuration, but will not make any changes.


    Initial Boot-Repair Window

  5. When the bootinfo summary has been created, boot-repair will display a message containing a URL which should look like this: http://paste.ubuntu.com/123456/.

    Please update/edit your question and add this URL. The information in the pastebin this link points to will (I hope) help us diagnose the problem.

I think over-writing the Windows partition's VBR caused this problem.

My understanding is that there are several steps to starting an operating system. In your case, I think something like the steps below happens.

  1. The BIOS on your computer attempts to run the code in the first sector of the hard drive. This first sector is usually referred to as the MBR (Master Boot Record).
  2. In addition to the MBR, every partition can also have a boot record. It is often referred to as the Volume Boot Record or VBR. The MBR on your hard drive transfers controls to the VBR of partition 1, your Windows partition.
  3. Windows expect a partition's VBR to take the next step towards booting an operating system such as Windows 7. So Windows would have originally installed a VBR which would transfer control to the Windows bootmgr program in your Windows partition.

    However, when you instructed the Ubuntu install a program to install GRUB into the Windows partition, GRUB appears to have replaced the Windows VBR with its own. This GRUB VBR displays the GRUB boot menu.
  4. The instructions GRUB currently uses to boot Windows are essentially to locate the VBR in the Windows partition and transfer control to it. The VBR in the Windows partition is GRUB's VBR. Transferring control to it just (re)displays the GRUB boot menu.

Unfortunately, I am not sure yet what would be the best way to fix this. We want to be careful that we do not break GRUB and make it impossible to boot anything on your computer when we attempt to fix the problem booting Windows.

Below is a copy of some of the information from your Bootinfo Summary for reference. My comments above are based on this information.

============================= Boot Info Summary: ===========================

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 
    of the same hard drive for core.img. core.img is at this location and 
    looks for (,msdos2)/boot/grub on this drive.

sda1: ______________________________________________________________________

    File system:       ntfs
    Boot sector type:  Grub2 (v1.99)
    Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda1
                       and looks at sector 44090872 of the same hard drive 
                       for core.img. core.img is at this location and looks
                       for (,msdos2)/boot/grub on this drive. No errors 
                       found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sda2: ______________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 12.04 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

A possible workaround to boot Windows 7

Below is a suggestion for editing your GRUB boot commands which may allow you to boot Windows 7. I am not sure this will work, but it seems worth trying.

Currently, your grub.cfg uses the GRUB boot commands below to boot Windows 7.

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
    insmod part_msdos
    insmod ntfs
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 1EA0019AA0017A13
    chainloader +1
}

I am suggesting you try changing this and use these commands instead.

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
    insmod part_msdos
    insmod ntfs
    insmod ntldr
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 1EA0019AA0017A13
    ntldr ($root)/bootmgr
}

Here are the steps to do this.

  1. Boot your system to the GRUB menu.
  2. Select (highlight) the GRUB boot menu entry Windows 7 (loader) (on /dev/sda1).
  3. Press e to edit the GRUB boot commands for Windows 7.
  4. Make two changes to this list of commands as illustrated in the menuentry above.
    • Add the command insmod ntldr
    • Change the command
      chainloader +1
      to
      ntldr ($root)/bootmgr
  5. Press either Ctrl+X or F10 to boot using these edited commands.

Note 1:

If the above workaround succeeds in loading the Windows 7 boot menu, then you could make it semi-persistent by

  1. Using sudo to edit the file /etc/grub.d/40_custom and add the second, modified menuentry shown above. (If you do this, I'd also suggest you change the title of this "custom" entry.)
  2. Run the command sudo update-grub to update /boot/grub/grub.cfg to include your customized entry. (It will be on the bottom of the GRUB menu when you boot.)

I would view the suggestion above as only a partly-baked solution. A better solution is to restore the Windows VBR to the Windows partition without also destroying the ability of GRUB to boot.

I think ... but am not 100% sure ... that the Windows recovery command bootsect can be used to do this. If you want to risk it, one possible way to do this is outlined below.

  • When booting Windows, press F8 to bring up the Advanced Boot Options menu.
  • Select the Repair Your Computer entry.
  • Walk through the next windows until you reach System Recovery Options.
  • Select Command Prompt
  • Run the command bootsect /nt60 C:

But you might also want to wait a bit and see what other answers you get to your the question before you take the risk of trying the above.

Note 2:

While searching for other things, I ran across two other questions on AskUbuntu which are related to your problem.

  1. Windows 7 won't boot after installing Ubuntu 11
  2. Windows 7 doesn't boot after Ubuntu install

I'm not sure how much help these questions provide. The answer to the second question was to use the command bootrec /fixboot to restore the VBR for the Windows partition. My understanding from that question was that using the bootrec /fixboot command solved the problem.

But the second question insists that bootrec /fixboot did not solve the problem.

(Beats the heck out of me as to what might be going on there.)


menuentry "Windows 7" {
    insmod ntfs
    set root=(hd0,1)
    drivemap -s (hd0) ($root)
    ntldr /bootmgr
    #or chainloader +1
}

If you installed Windows on partition other than (hd0,1) you need to use drivemap command to boot to Windows. Chainloader +1 or ntldr /bootmgr both can be used to boot Windows 7.

What you did is you modified the VBR of the 1st partition; you may restore that by executing these commands in windows recovery mode in cmd when you boot from installation CD :

bootrec.exe /FixMbr  

bootrec.exe /FixBoot  

bootrec.exe /RebuildBcd