PDA

View Full Version : [ubuntu] Dual booting windows and ubuntu GRUB problem.



K0nserv
March 13th, 2010, 05:31 PM
Hey guys.
I recently installed ubuntu, for various reasons, but I am a gamer and sometimes playing a game is more alluring then other activities.
The thing is I have windows 7 installed but i am unsuccessful in configuring GRUB to dual boot.

My harddrives are:
1000 GB storage ( /dev/sdc1)
290 GB ubuntu 9.10-amd,64 (/dev/sda1)
2 GB swap (/dev/sda2)
104 GB Windows 7 (/dev/sdb1)
350 GB unallocated.

Dump from fdisk -l


Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xdf73df73

Device Boot Start End Blocks Id System
/dev/sda1 * 1 38661 310544451 83 Linux
/dev/sda2 38662 38913 2024190 5 Extended
/dev/sda5 38662 38913 2024158+ 82 Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000db5b0

Device Boot Start End Blocks Id System
/dev/sdb1 1 12749 102400000 7 HPFS/NTFS

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xbf69ecb2

Device Boot Start End Blocks Id System
/dev/sdc1 1 121602 976759808 7 HPFS/NTFS
Now adding an entry to GRUB.
This is my 40_CUSTOM, located in etc/grub.d/.



#!/bin/sh
exec tail -n +3 $0
# 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" {
set root=(hd1,1)
chainloader (hd1,1)+1
}
Now when i run:


sudo update grub
It seems to work but i get one line of output I am bit worried about.


ls: cannot access /media/-: No such file or directory
Anyway I restart my computer and try to boot windows 7.
With chainloader +1 the result is.


bootmgr is missing.
With chainloader(hd1,1)+1 I get an error message about an invalid name..

Seems to me that i have pointed to the wrong disc, but sdb1 = hd(1,1) right ?

**UPDATE**
Solved the current problem, but when running


sudo update-grub
It doesn't locate my windows boot files located in /media/Windows/windows/boot.
Anyone have an idea ?

** UPDATE **
Current CFG


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

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7b44444b-a88b-4900-a03c-a29fd42c185f
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
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/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-20-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7b44444b-a88b-4900-a03c-a29fd42c185f
linux /boot/vmlinuz-2.6.31-20-generic root=UUID=7b44444b-a88b-4900-a03c-a29fd42c185f ro quiet splash
initrd /boot/initrd.img-2.6.31-20-generic
}
menuentry "Ubuntu, Linux 2.6.31-20-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7b44444b-a88b-4900-a03c-a29fd42c185f
linux /boot/vmlinuz-2.6.31-20-generic root=UUID=7b44444b-a88b-4900-a03c-a29fd42c185f ro single
initrd /boot/initrd.img-2.6.31-20-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7b44444b-a88b-4900-a03c-a29fd42c185f
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=7b44444b-a88b-4900-a03c-a29fd42c185f ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7b44444b-a88b-4900-a03c-a29fd42c185f
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=7b44444b-a88b-4900-a03c-a29fd42c185f ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ ${timeout} != -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.
menuentry "Windows 7"{
set root=(hd2,1)
chainloader (hd2,1)+1
}

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_WIN ###
menuentry "Windows 7"{
set root=(hd2,1)
chainloader (hd2,1)+1
### END /etc/grub.d/41_WIN ###
What strikes me is that in all cfgs i've seen it says something like


menuentry "xxxxx" (on /dev/xxx ) //Which i am missing for some reason.
output from update-grub


Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-20-generic
Found initrd image: /boot/initrd.img-2.6.31-20-generic
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
done
blkid -c /dev/null



/dev/sda1: UUID="7b44444b-a88b-4900-a03c-a29fd42c185f" TYPE="ext4"
/dev/sda5: UUID="09fa9aa4-57a7-4868-bf49-c921643213f1" TYPE="swap"
/dev/sdb1: UUID="60A029D7A029B506" TYPE="ntfs"
/dev/sdc1: UUID="88B2630AB262FBD6" LABEL="- Download -" TYPE="ntfs"

Thanks in a advance

//K0nserv

K0nserv
March 14th, 2010, 11:59 AM
Problem solved after getting some help from the kind people on #ubuntu irc channel, seems like i somehow had managed to write grub mbr to my sdb disk xD Reinstalled windows today and everything is up and running now.