Grub can't load windows 7

Asked by Carlos Munoz

I just installed ubuntu 16.04 on a computer that had windows7 already installed. Grub can boot Linux, but not windows7. However, I can boot windows7 by selecting its partition from the pc firmware and bypassing grub.

grub gives the error: file /bootmgr not found

Any ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Carlos Munoz
Solved:
Last query:
Last reply:
Revision history for this message
Carlos Munoz (oldude) said :
#1

This is the output of bootinfoscript:

                  Boot Info Script 0.61 [1 April 2012]

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

 => Windows is installed in the MBR of /dev/sda.
 => Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    in partition 97 for .

sda1: __________________________________________________________________________

    File system: ntfs
    Boot sector type: Windows Vista/7: NTFS
    Boot sector info: No errors found in the Boot Parameter Block.
    Operating System:
    Boot files: /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

    File system: ntfs
    Boot sector type: Windows Vista/7: NTFS
    Boot sector info: No errors found in the Boot Parameter Block.
    Operating System:
    Boot files: /bootmgr /Boot/BCD /Windows/System32/winload.exe

sda3: __________________________________________________________________________

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

sda4: __________________________________________________________________________

    File system: ext4
    Boot sector type: -
    Boot sector info:
    Operating System:
    Boot files:

sdb1: __________________________________________________________________________

    File system: ext4
    Boot sector type: -
    Boot sector info:
    Operating System:
    Boot files:

sdb2: __________________________________________________________________________

    File system: Extended Partition
    Boot sector type: -
    Boot sector info:

sdb5: __________________________________________________________________________

    File system: ext4
    Boot sector type: -
    Boot sector info:
    Operating System:
    Boot files:

sdb6: __________________________________________________________________________

    File system: swap
    Boot sector type: -
    Boot sector info:

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________
Disk /dev/sda: 894.3 GiB, 960197124096 bytes, 1875385008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/sda2 206,848 923,064,319 922,857,472 7 NTFS / exFAT / HPFS
/dev/sda3 923,066,368 1,020,720,664 97,654,297 83 Linux
/dev/sda4 1,020,723,200 1,875,384,319 854,661,120 83 Linux

Drive: sdb _____________________________________________________________________
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdb1 2,048 1,757,812,735 1,757,810,688 83 Linux
/dev/sdb2 1,757,814,782 1,953,523,711 195,708,930 5 Extended
/dev/sdb5 * 1,757,814,784 1,855,469,567 97,654,784 83 Linux
/dev/sdb6 1,855,471,616 1,953,523,711 98,052,096 82 Linux swap / Solaris

"blkid" output: ________________________________________________________________

Device UUID TYPE LABEL

/dev/sda1 C280B54580B540A9 ntfs
/dev/sda2 E82AC1132AC0DFA4 ntfs
/dev/sda3 e0d717ce-3923-4460-867f-43831702e2be ext4
/dev/sda4 109edeba-27db-4821-b572-f4322cc34851 ext4
/dev/sdb1 0d327864-4111-404f-ade7-dd4922c92c8b ext4
/dev/sdb5 2952a0f9-a939-4b4e-818d-74e3a6179610 ext4
/dev/sdb6 d224c765-4449-4b89-a09c-46a6c1a5ef6e swap

================================ Mount points: =================================

Device Mount_Point Type Options

/dev/sda3 / ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda4 /usr ext4 (rw,relatime,data=ordered)
/dev/sdb1 /home ext4 (rw,relatime,data=ordered)
/dev/sdb5 /tmp ext4 (rw,relatime,data=ordered)

=========================== sda3/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 --hint='hd0,msdos4' 109edeba-27db-4821-b572-f4322cc34851
else
  search --no-floppy --fs-uuid --set=root 109edeba-27db-4821-b572-f4322cc34851
fi
    font="/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=10
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=10
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
 set gfxpayload="${1}"
 if [ "${1}" = "keep" ]; then
  set vt_handoff=vt.handoff=7
 else
  set vt_handoff=
 fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e0d717ce-3923-4460-867f-43831702e2be' {
 recordfail
 load_video
 gfxmode $linux_gfx_mode
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_msdos
 insmod ext2
 set root='hd0,msdos3'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
 else
   search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
 fi
        linux /boot/vmlinuz-4.4.0-79-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro quiet splash $vt_handoff
 initrd /boot/initrd.img-4.4.0-79-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-e0d717ce-3923-4460-867f-43831702e2be' {
 menuentry 'Ubuntu, with Linux 4.4.0-79-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-79-generic-advanced-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-79-generic ...'
         linux /boot/vmlinuz-4.4.0-79-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro quiet splash $vt_handoff
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-79-generic
 }
 menuentry 'Ubuntu, with Linux 4.4.0-79-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-79-generic-init-upstart-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-79-generic ...'
         linux /boot/vmlinuz-4.4.0-79-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro quiet splash $vt_handoff init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-79-generic
 }
 menuentry 'Ubuntu, with Linux 4.4.0-79-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-79-generic-recovery-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-79-generic ...'
         linux /boot/vmlinuz-4.4.0-79-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-79-generic
 }
 menuentry 'Ubuntu, with Linux 4.4.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-advanced-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-31-generic ...'
         linux /boot/vmlinuz-4.4.0-31-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro quiet splash $vt_handoff
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-31-generic
 }
 menuentry 'Ubuntu, with Linux 4.4.0-31-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-init-upstart-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-31-generic ...'
         linux /boot/vmlinuz-4.4.0-31-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro quiet splash $vt_handoff init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-31-generic
 }
 menuentry 'Ubuntu, with Linux 4.4.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-recovery-e0d717ce-3923-4460-867f-43831702e2be' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd0,msdos3'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3' e0d717ce-3923-4460-867f-43831702e2be
  else
    search --no-floppy --fs-uuid --set=root e0d717ce-3923-4460-867f-43831702e2be
  fi
  echo 'Loading Linux 4.4.0-31-generic ...'
         linux /boot/vmlinuz-4.4.0-31-generic root=UUID=e0d717ce-3923-4460-867f-43831702e2be ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /boot/initrd.img-4.4.0-31-generic
 }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows 7" {
 #insmod part_msdos
 insmod ntfs
 #insmod ntldr
 set root='hd0,msdos1'
 #search --no-floppy --fs-uuid --set=root C280B54580B540A9
 #search --set=root --hint hd0,msdos1
 #parttool ${root} hidden-
 #ntldr ${root}/bootmgr
 ntldr /bootmgr
 # chainloader +1
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda3/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=e0d717ce-3923-4460-867f-43831702e2be / ext4 errors=remount-ro 0 1
# /home was on /dev/sdb1 during installation
UUID=0d327864-4111-404f-ade7-dd4922c92c8b /home ext4 defaults 0 2
# /tmp was on /dev/sdb5 during installation
UUID=2952a0f9-a939-4b4e-818d-74e3a6179610 /tmp ext4 defaults 0 2
# /usr was on /dev/sda4 during installation
#UUID=109edeba-27db-4821-b572-f4322cc34851 /usr ext4 defaults 0 2
# swap was on /dev/sdb6 during installation
UUID=d224c765-4449-4b89-a09c-46a6c1a5ef6e none swap sw 0 0
UUID=109edeba-27db-4821-b572-f4322cc34851 /usr ext4 defaults 0 2
--------------------------------------------------------------------------------

=================== sda3: Location of files loaded by Grub: ====================

           GiB - GB File Fragment(s)

=============================== StdErr Messages: ===============================

cat: /tmp/BootInfo-w0MIIOLx/Tmp_Log: No such file or directory

Revision history for this message
Jordi Miralles (jmiralles) said :
#2

Have you tried with boot-repair already? I found it works for most usual cases:

https://help.ubuntu.com/community/Boot-Repair

Revision history for this message
Carlos Munoz (oldude) said :
#3

Yes, I had tried that but it didn't work for me. However, the following steps fixed the problem. I can now boot into Windows 7 and Ubuntu from grub.

1. Removed grub from the second hard drive:
sudo dd if=/dev/zero of=/dev/sdb bs=446 count=1

2. Used Boot-repair to remove and reinstall grub only on the first hard drive (/dev/sda)

3. Added the line "GRUB_DISABLE_OS_PROBER=true" to "/etc/default/grub". This was necessary as the menuentry generated by os-prober for Windows 7 didn't work.

4. Added the Windows 7 menuentry to "/etc/grub.d/40_custom"
menuentry 'Windows 7' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos1'
    search --no-floppy --fs-uuid --set=root C280B54580B540A9
    parttool ${root} hidden-
    ntldr /bootmgr
}

5. Added the following lines to "/etc/default/grub" to see the grub menu:
GRUB_HIDDEN_TIMEOUT=5
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT_STYLE=menu

6. Ran update-grub

Revision history for this message
Carlos Munoz (oldude) said :
#4

Problem solved