LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ubuntu/Windows dual boot Grub problems (https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-windows-dual-boot-grub-problems-592738/)

ryanxav 10-18-2007 08:59 AM

Ubuntu/Windows dual boot Grub problems
 
Hi,
I wanted to move from Windows XP to Linux for something new to learn and explore, but keep Windows so that I could still play games without the hassle.
I installed windows and then Ubuntu 7.04 on the same 80GB disk: 50GB for Windows, 15GB for Ubuntu, 3GB swap and 12GB FAT32. It's my second hard disk (of 3).
When I start my computer the Grub menu comes up offering Ubuntu and Windows, and I can load Ubuntu - I had to change /boot/grub/menu.lst

Title Ubuntu, kernel 2.6.20-16-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault

I changed root (hd0,0) to (hd0,1)

But, when I try to load Windows Grub tells me that it is loading Stage 2, but nothing happens. I can restart with ctrl, alt, delete, but that's it. Windows XP's entry in menu.lst is:

title Microsoft Windows XP Professional
root (hd0,1)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

Any help anyone can give me would be greatly appreciated. Thanks

ahale1987 10-18-2007 09:06 AM

I noticed that root is the same on both GRUB entries? Does that make any difference (sorry I'm no GRUB expert; Just trying to help)

indienick 10-18-2007 09:07 AM

I'm not 100% clear on the menu.lst syntax, but shouldn't there only be one map(hdx,n) entry for the Windows partition?

I have a dual-boot setup at home, except Linux and Windows are installed on different drives, but I remember there being a map() entry for the Windows image - I edit it enough times resetting my console resolution everytime Debian updates my kernel.

I'll post my Windows boot entry when I get home from work (~ T minus 7 hours). I hope you can wait that long; that is, unless, someone else knows for sure the proper syntax for a Windows boot entry.

indienick 10-18-2007 09:09 AM

Quote:

Originally Posted by ahale1987
I noticed that root is the same on both GRUB entries? Does that make any difference (sorry I'm no GRUB expert; Just trying to help)

I jumped a little the first time I saw that in my /boot/grub/menu.lst, but because there's that map() entry, it should be fine; it's like a last-minute modification to the root() value.

emoore 10-18-2007 11:02 AM

I'm dual booting Ubuntu 7.10 and XP Pro using a single SATA disk. The first and last entries are:

title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=070e6206-513f-45b4-a3f2-d8083c1118ee ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

ryanxav 10-18-2007 11:30 AM

I tried adding "makeactive" but it didn't do anything. Getting rid of either of the two "map" entries just returns me to the GRUB o/s selection menu when I try to boot.

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title Microsoft Windows XP Professional
root (hd0,1)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

menu.lst tells me that XP is on sdb1, which I thought translated into (hd1,0) because the counting starts at zero, but if I change the line to anything but (hd0,1) it doesn't work.

indienick 10-18-2007 12:12 PM

Try taking out the second "map" - "map (hd0) (hd1)". It looks a little redundant.

Add the "makeactive" after the "map".

BB_DaKraxor 10-18-2007 12:29 PM

I'm sure the root entry for Windows is incorrect. It should point to the partition where you have your Windows installation.

If Ubuntu boots OK, then your hard disk is hd0, so you don't need to change that I belive.

Quote:

I installed windows and then Ubuntu 7.04 on the same 80GB disk: 50GB for Windows, 15GB for Ubuntu, 3GB swap and 12GB FAT32.
Is this the actual order of the partitions? If it is, then Windows is (hd0,0), Ubuntu is (hd0,1), the swap is (hd0,2) and the FAT one is (hd0,3). So you might want to try changing to "root (hd0,0)". And yes, you should use the makeactive command before chainloader.

Hope this helps.

makuyl 10-18-2007 02:00 PM

How about this one then:

title Microsoft Windows XP Professional
rootnoverify (hd0,0)
makeactive
chainloader +1

Also post your /boot/grub/device.map and the output of: fdisk -l /dev/[hs]d[ab]

ryanxav 10-21-2007 10:33 AM

I changed menu.lst to:

title Microsoft Windows XP Professional
rootnoverify (hd0,0)
makeactive
chainloader +1

and Windows now boots, thanks!
However... when I restart my computer it boots Windows without showing the GRUB menu and if I want to see it I have to use systemcd to use GParted to change the "boot" drive to Linux. Any ideas?

makuyl 10-21-2007 11:30 AM

Possibly a too short timeout. Post your entire menu.lst

ryanxav 10-21-2007 12:02 PM

Menu.lst is:

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd1,1)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-16-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro single
initrd /boot/initrd.img-2.6.20-16-generic

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=6e3224e5-7a5b-47b0-83ee-30e8d157ede0 ro single
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title Microsoft Windows XP Professional
rootnoverify (hd0,0)
makeactive
chainloader +1



/boot/grub/device.map is:

(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc

and fdisk -l /dev/[hs]d[ab]brings up:

Cannot open /dev/sda
Cannot open /dev/sdb

makuyl 10-21-2007 12:13 PM

I think you life would be easier with windows on sda and linux on sdb.
About the "Cannot open /dev/sda" try running fdisk as root, and throw in the c for sdc as well if you like:
fdisk -l /dev/sd[abc]

ryanxav 10-21-2007 12:27 PM

Ran that using sudo and got:

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 30401 244196001 83 Linux

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 6285 50484231 7 HPFS/NTFS
/dev/sdb2 * 6286 8234 15655342+ 83 Linux
/dev/sdb3 8235 8670 3502170 82 Linux swap / Solaris
/dev/sdb4 8671 9729 8506417+ b W95 FAT32

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

Device Boot Start End Blocks Id System
/dev/sdc1 1 60801 488384001 83 Linux


So you reckon I should just re-install with both O/S's on sda?

makuyl 10-21-2007 01:00 PM

Hardly a reason to reinstall everything. This is how my boot flags (*) are set with windows on hda1 and linux / on hdb1:
Code:

fdisk -l /dev/hd[ab]

Disk /dev/hda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf9fbf9fb

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1        4865    39078081    7  HPFS/NTFS
/dev/hda2            4866        9728    39062047+  b  W95 FAT32
/dev/hda3            9729      24321  117218272+  5  Extended
/dev/hda5            9729      24321  117218241  83  Linux

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x474c6a31

  Device Boot      Start        End      Blocks  Id  System
/dev/hdb1  *          1        1459    11719386  83  Linux
/dev/hdb2            1460      14593  105498855    5  Extended
/dev/hdb5            1460        1581      979933+  82  Linux swap / Solaris
/dev/hdb6            1582        7052    43945776  83  Linux
/dev/hdb7            7053      14593    60573051  83  Linux

You can easily toggle the boot flag in cfdisk if you have it:
Code:

sudo cfdisk /dev/sda
and the same for sdb.
If your BIOS allows it, you could just change the boot order in the BIOS to boot sdb first, and install grub to sdb's MBR, but I would just swap cables sda<->sdb and change drive letters in menu.lst and /etc/fstab.


All times are GMT -5. The time now is 04:27 AM.