Fixing Windows7 Bootmgr

32,129

Solution 1

Usually Windows 7 creates two partitions during setup: a partition with the boot manager and a partition to the operating system. It seems that your Windows selected the recovery partition and used it as the boot partition, probably overwriting it (it is the only partition with the "boot" flag (line 79 of the log)). So to boot Windows i think you must boot the recovery partition (/dev/sda3).

But if i'm not wrong, booting from your recovery partition may reset the MBR, and so replace GRUB with the Windows 7 MBR. So before doing this, you really should create a backup of your Ubuntu, or of the MBR atleast!

The best way to proceed is creating a new boot entry in /etc/grub.d/40_custom, editing it with root privileges:

sudo gedit /etc/grub.d/40_custom

This file should already have one entry. After it add the following:

menuentry 'My Windows entry' --class windows {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos3'
    chainloader +1
}

Save the file and run sudo update-grub in a terminal. This will recreate the Grub boot entries. After that, the next time you reboot you should have a new entry, which hopefully will let you boot on Windows 7.

Solution 2

If you installed Ubuntu with Wubi you will not be getting grub menu. So you didn't installed Ubuntu with Wubi.

To get windows boot loader back and add it to grub menu. First install Windows boot loader (grub will be gone) and after that re-install grub boot loader

for windows boot loader

=> Boot from your windows disc and go to repair but do not use start-up repair or instead repair using windows command prompt

enter image description here

type the following two commands in cmd

Bootrec/fixmbr 'press enter'

Bootrec/fixboot 'press enter'

now reboot u can see windows boot loader again

now back to Ubuntu for grub boot loader

=> Boot from Ubuntu live USB then install boot-repair and repair grub u can see it in this how it is done https://help.ubuntu.com/community/Boot-Repair

In advanced options => GRUB Options -- select the "Purge Grub before reinstalling it"

In advanced options => Other options -- Unselect the "Repair windows Bootfiles"(remove the tick) 
Share:
32,129

Related videos on Youtube

Ashfame
Author by

Ashfame

Decentralization Evangelist, Entrepreneur, Life hacker, Backend engineer. Building a Multi-accounts Multi-cryptocurrency trustless wallet using an air-gapped hardware vault - Woodpckr.com You can get in touch via Twitter

Updated on September 18, 2022

Comments

  • Ashfame
    Ashfame almost 2 years

    I made my laptop Dell XPS 15z dual boot with Ubuntu last year, and something went wrong & BOOTMGR of my windows got fried. I couldn't fix it that time. And I kept using Ubuntu. I don't even remember whether I installed directly via a live usb or used wubi, sorry.

    I installed 11.10 at that point of time, but right now I am on 12.10.

    Today, I got to know about the Boot repair tool, so I was wondering with this tool may be I can figure out what's exactly wrong with my setup.

    This is my Boot info - http://paste.ubuntu.com/1343575/

    If I select the Win7 entry on GRUB2, I get the error BOOTMGR is missing. Press Ctrl-Alt-Del.

    Now the thing is I have read numerous links on how this could be fixed, but I don't feel comfortable without knowing what I am doing. So unless I am sure what a certain tool would do, I would prefer fixing it by hand (manually editing files).

    So reading from my boot info file, can anyone explain it to me what's messed up wrong here and what could fix it? I certainly can't afford to have my ubuntu install unbootable right now, but looking into this issue is bothering me too much. Help appreciated!

    I have Win7 DVD & Ubuntu live USBs with me, I am just looking for a sure shot way of fixing Win7 without any harm to my existing Ubuntu install.

    • geethujoseph
      geethujoseph over 11 years
      From your log it seems you have two Windows 7 entries: Windows 7 (loader) (on /dev/sda3) and Windows 7. Which one gives you the error?
    • Ashfame
      Ashfame over 11 years
      @Salem sda4 is the one which has the install and gives error. sda3 is the recovery partition, it also throws an error but something different.
    • geethujoseph
      geethujoseph over 11 years
      Can you mount the sda3 partition and provide a directory listing of it (maybe using ls -la /media/(...))?
    • Admin
      Admin over 11 years
      If it was WUBI you wouldn't have access to Ubuntu. Tut, Ubuntu relying on Windows.
  • Ashfame
    Ashfame over 11 years
    Can't I set the bootflag back to sda4? I really can't afford to mess up my grub/Ubuntu install, that's why I am looking for a definite way of fixing this with least risk.
  • geethujoseph
    geethujoseph over 11 years
    Don't know, it may work.
  • Sumit Jain
    Sumit Jain over 9 years
    Does this preserve grub boot loader, or we have re-install it?
  • mchid
    mchid over 9 years
    @SumitJain this should not affect grub unless you run /FixMbr with Bootrec.exe see here support.microsoft.com/kb/927392 even if it does overwrite grub, grub is really easy to reinstall from a live disk or using bootrepair.