PDA

View Full Version : [SOLVED] 12.04 / Windows 7 GRUB issue (Win7 on separate HDD)



adam_distefano
April 2nd, 2012, 03:28 PM
Hi, I'm having some issues getting grub to detect and configure my Windows 7 installation so I can have the option to boot either Ubuntu or Windows 7 at startup.

I have run update-grub with these results


Found linux image: /boot/vmlinuz-3.2.0-20-generic
Found initrd image: /boot/initrd.img-3.2.0-20-generic
Found memtest86+ image: /boot/memtest86+.bin
done

I have also run the bootinfoscript with these results


Boot Info Script 0.61 [1 April 2012]


============================= 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 (,msdos1)/boot/grub on this drive.
=> Windows is installed in the MBR of /dev/sdb.
=> No boot loader is installed in the MBR of /dev/sdc.
=> No boot loader is installed in the MBR of /dev/sde.

sda1: __________________________________________________ ________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu precise (development
branch)
Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda2: __________________________________________________ ________________________

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

sda5: __________________________________________________ ________________________

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

sdb1: __________________________________________________ ________________________

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

sdc1: __________________________________________________ ________________________

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

sde1: __________________________________________________ ________________________

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:

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

Drive: sda __________________________________________________ ___________________

Disk /dev/sda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders, total 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 * 2,048 113,281,023 113,278,976 83 Linux
/dev/sda2 113,283,070 117,229,567 3,946,498 5 Extended
/dev/sda5 113,283,072 117,229,567 3,946,496 82 Linux swap / Solaris


Drive: sdb __________________________________________________ ___________________

Disk /dev/sdb: 808.9 GB, 808888614912 bytes
255 heads, 63 sectors/track, 98341 cylinders, total 1579860576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdb1 2,048 1,579,857,919 1,579,855,872 7 NTFS / exFAT / HPFS


Drive: sdc __________________________________________________ ___________________

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdc1 2,048 1,953,523,711 1,953,521,664 83 Linux


Drive: sde __________________________________________________ ___________________

Disk /dev/sde: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sde1 2 976,773,167 976,773,166 7 NTFS / exFAT / HPFS


"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/sda1 c7bceb1c-4138-45d0-9980-5bc32d6f37f5 ext4
/dev/sda5 5a53dd07-4b65-4671-875f-fd804398a8a4 swap
/dev/sdb1 66580BAE580B7C55 ntfs
/dev/sdc1 2399afdc-e879-40dd-8f72-f325307c1cb3 ext4
/dev/sde1 4060D35260D34D72 ntfs External Backup

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

Device Mount_Point Type Options

/dev/sda1 / ext4 (rw,errors=remount-ro)
/dev/sdc1 /home ext4 (rw)
/dev/sde1 /media/External Backup fuseblk (rw,nosuid,nodev,allow_other,default_permissions,b lksize=4096)


=========================== sda1/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
set default="0"
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 {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
set locale_dir=($root)/boot/grub/locale
set lang=en_AU
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
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; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
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
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.2.0-20-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
linux /boot/vmlinuz-3.2.0-20-generic root=UUID=c7bceb1c-4138-45d0-9980-5bc32d6f37f5 ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.2.0-20-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-20-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
echo 'Loading Linux 3.2.0-20-generic ...'
linux /boot/vmlinuz-3.2.0-20-generic root=UUID=c7bceb1c-4138-45d0-9980-5bc32d6f37f5 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-20-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/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root c7bceb1c-4138-45d0-9980-5bc32d6f37f5
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### END /etc/grub.d/30_os-prober ###

### 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda1/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>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=c7bceb1c-4138-45d0-9980-5bc32d6f37f5 / ext4 errors=remount-ro 0 1
# /home was on /dev/sdc1 during installation
UUID=2399afdc-e879-40dd-8f72-f325307c1cb3 /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
UUID=5a53dd07-4b65-4671-875f-fd804398a8a4 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
--------------------------------------------------------------------------------

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

GiB - GB File Fragment(s)

= boot/grub/core.img 1
= boot/grub/grub.cfg 2
= boot/initrd.img-3.2.0-20-generic 2
= boot/vmlinuz-3.2.0-20-generic 1
= initrd.img 2
= vmlinuz 1

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sda2

00000000 bb de 86 6b c2 37 8c 83 95 8b 39 87 ca 16 fd ae |...k.7....9.....|
00000010 de 21 8d f9 c1 3d dc 90 7b e8 53 73 73 fe a1 03 |.!...=..{.Sss...|
00000020 77 75 07 d1 dc 80 92 b4 7c 55 69 82 77 8f d6 9e |wu......|Ui.w...|
00000030 33 e5 62 dd e7 54 8d 7c 0c 93 11 fa c8 40 c3 7d |3.b..T.|.....@.}|
00000040 7d 5c bb 4a e5 9c 9a 1b a1 6e 56 74 28 d5 ef ab |}\.J.....nVt(...|
00000050 ba 7e f4 78 af 2f a9 9f d8 9c 33 79 eb f6 ad 6e |.~.x./....3y...n|
00000060 37 d2 2e b4 39 ac e3 b9 95 1c bd fb 79 f8 95 fd |7...9.......y...|
00000070 c1 5b 09 87 90 ce 17 09 3c 53 b4 be 53 98 a4 de |.[......<S..S...|
00000080 ef e0 15 02 f6 13 cf 1f e4 56 77 a6 d5 02 02 b1 |.........Vw.....|
00000090 b7 f9 76 d6 b7 e9 f6 72 01 93 9a 34 9a da 55 cb |..v....r...4..U.|
000000a0 6b 9b 48 9b d8 3c 51 bf d7 b8 aa bb 68 7c 9c 1e |k.H..<Q.....h|..|
000000b0 af 71 75 77 51 43 eb f6 1a c5 aa fe a2 06 45 6b |.quwQC........Ek|
000000c0 9c 70 18 d7 f0 14 bd 39 3a 0e 23 81 96 d4 53 74 |.p.....9:.#...St|
000000d0 75 5f d1 7a 97 29 97 51 cb ff 2a ce a2 cf 5a d7 |u_.z.).Q..*...Z.|
000000e0 cb 67 d4 be ca 7f 96 d3 e8 58 b9 8b 95 e9 85 6d |.g.......X.....m|
000000f0 5d d6 ca 77 ac 97 e7 10 ae 76 d3 20 02 d7 ce 5e |]..w.....v. ...^|
00000100 b3 c5 6a 5b d7 25 f8 fa 49 6a 83 63 44 8e ee dc |..j[.%..Ij.cD...|
00000110 5b ea a6 47 40 9f 63 86 89 f7 e2 ae dc d2 e6 02 |[..G@.c.........|
00000120 b9 9e cb dc e0 64 96 d4 76 ab 51 8d cb d6 bb 3e |.....d..v.Q....>|
00000130 d5 34 77 09 9a d7 77 35 3c fb 7f d8 26 8d b6 b2 |.4w...w5<...&...|
00000140 24 d7 41 c4 17 0d e2 b6 26 dd 0c 98 b9 16 00 b7 |$.A.....&.......|
00000150 25 dd cd 1a 3e 90 6f 1b a0 72 cf a3 d6 f4 55 a5 |%...>.o..r....U.|
00000160 ed 8f 9a 6f 3f 30 3d 55 f9 b6 be c6 6d 94 8c 36 |...o?0=U....m..6|
00000170 a1 c8 26 8e 7b 46 9d dc 4c d9 07 ff c5 3b 37 54 |..&.{F..L....;7T|
00000180 a4 81 9b ae 24 62 87 35 5e 48 68 9d 42 dc 4a 16 |....$b.5^Hh.B.J.|
00000190 a7 19 6e b8 c4 a0 c0 1c e4 e8 52 b3 02 d1 d3 24 |..n.......R....$|
000001a0 9e 9c 4a 50 8d 20 e1 56 57 72 e7 56 7e e3 4c 75 |..JP. .VWr.V~.Lu|
000001b0 85 b4 94 00 f9 cb 4f 72 dc 6b 3e 44 33 51 00 fe |......Or.k>D3Q..|
000001c0 ff ff 82 fe ff ff 02 00 00 00 00 38 3c 00 00 00 |...........8<...|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200


========= Devices which don't seem to have a corresponding hard drive: =========

sdd

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

xz: (stdin): Compressed data is corrupt
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in


I was wondering if anyone could help me out. I've tried my best configuring this myself with no success.

Thanks!

2F4U
April 2nd, 2012, 05:12 PM
This tutorial could be helpful

https://help.ubuntu.com/community/How_to_dual-boot_Ubuntu_and_XP_after_installing_them_separatel y_on_two_HDs

Please note that it is for legacy grub, so you need to make some adjustments for grub2.

oldfred
April 2nd, 2012, 05:14 PM
Was your Windows 7 installed to sdb originally? Windows 7 normally installs to two partitions, one a small 100MB boot/repair partition that is first on the boot drive and the main partition. If you had set sda as boot but installed to sdb, then the 100MB boot windows boot partition was on sda. That partition is what is missing from your system.

If you have a Windows repairCD or full install or a friend with a full install that is the same 32 or 64bit then you can repair your install and add the boot files to your Windows in sdb. You are missing the two files in red. They can be just added to your c: drive and do not have to be a separate partition. Windows does that so you can encrypt your main c: drive or still boot the repair partition if the main partition needs repairs. Window 7 can install over Vista in one partition so it works in one partition.

Boot files:
WinXP
/boot.ini /ntldr /NTDETECT.COM
Vista/7 (with 7 the first two files are usually in a separate 100MB boot partition)
/bootmgr /Boot/BCD /Windows/System32/winload.exe

Did you do this or know someone with Windows 7.
Make your own Windows repairCD (not vendor recovery):
http://windows.microsoft.com/en-GB/windows7/Create-a-system-repair-disc
http://forums.techarena.in/guides-tutorials/1114725.htm

You will also need the boot flag (active partition in Windows) on sdb1 for Windows to find it and be able to make repairs. You can use disk utility, gparted (boot flag) or Windows(make active).

Set BIOS to boot from sdb so if you do run the Windows repairs and it reinstalls the boot loader to the MBR it installs to sdb. (I think that works, but it maybe like grub and just install to sda).

How to Boot to the System Recovery Options in Windows 7
http://www.sevenforums.com/tutorials/668-system-recovery-options.html
http://www.sevenforums.com/tutorials/20864-mbr-restore-windows-7-master-boot-record.html
http://windows7ultimate.windowsreinstall.com/repairwin7startup/indexthumbs.ht

Above links summarized, see links if more detail desired
You will need to boot with your Vista/Windows 7 installation disk or repair disk. Hit Enter at the language selection prompt then hit "R" to get to the repair section. You can then select the automatic boot repair tool, but it often will not do any good. Then select the command prompt (console) and type in the following commands:
# is comment do not copy or type comments
BootRec.exe /fixMBR #updates MBR master boot record do not run if you still want grub
chkdsk C: /r #(have to run /r or /f as separate entries) rerun until no errors
BootRec.exe /FixBoot #updates PBR partition boot sector or see bootsect.exe commands
chkdsk c: /r
BootRec.exe /ScanOs
BootRec.exe /RebuildBcd

adam_distefano
April 3rd, 2012, 09:52 AM
Thanks oldfred!

Your information really helped.

What I ended up doing was first setting the boot flag for sdb1 (Windows) using gparted.

I changed the boot priority to sdb in the BIOS, just in case.

Booted the Windows 7 DVD and entered the recovery.

First time Windows said it could fix my problem automatically, so I let it do its thing, rebooted. changed boot priority back and ran update-grub with no success :-(

Tried booting the Windows 7 recovery again after resetting the priority once again to boot sdb, this time selecting "Repair start-up" or something to that effect.

Reset boot priority once again (doing all that boot device changing was probably unnecessary in hindsight) and ran update-gparted once again, to which it found my Windows 7 boot.

Everything is working fine!

Once again thanks for your help. Setting thread to solved

oldfred
April 3rd, 2012, 02:33 PM
Glad you got it working.

The auto repair often has to be run three times for it to fix everything. I think that is why the suggestion is usually to to the manual repair. Or maybe we just like to punish users by making them use command line in Windows. (Just saw another user complaining about using command line, so it is a lame try at a joke.)