configure grub to dual boot xp

Asked by Hanns Wetzel

Have recently installed Ubuntu 7.10 over XP Home sp2 runninbg NTFS file system. Expected grub to find XP and correctly modify menu.lst to show xp as "other operating system", but htis did not happen. The ubuntu kernels are there but no reference to XP. I've tried various ways to enter the xp info into menu.lst, but had no success. Ubuntu boots and runs fine, but am unable to access Windows XP. Here is my drives info as per fdisk -l

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

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 9728 78140128+ 44 Unknown

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x206642a9

   Device Boot Start End Blocks Id System
/dev/hda1 * 1 4660 37431418+ 83 Linux
/dev/hda2 4661 4865 1646662+ 5 Extended
/dev/hda5 4661 4865 1646631 82 Linux swap / Solaris

Disk /dev/hdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe636e636

   Device Boot Start End Blocks Id System
/dev/hdb1 * 1 2433 19543041 44 Unknown
hbw@pentium:~$

Here is my menu.lst file. The last entry is one of the many unsuccessful ones I tried to get it to boot XP.

## 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 use 'savedefault' 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 15

## 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=ff772842-1a41-4725-ac36-76981971ff1e ro

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

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

## 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

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=ff772842-1a41-4725-ac36-76981971ff1e ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=ff772842-1a41-4725-ac36-76981971ff1e ro single
initrd /boot/initrd.img-2.6.22-14-generic

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

### END DEBIAN AUTOMAGIC KERNELS LIST

title Other operating systems:
root

# This entry was not automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Home
root (sda0,0)
##savedefault 1 #only boot once; next boot kernel 0 is default again
makeactive
chainloader +1

I would greatly appreciate if someone could show me the correct entry that should be put into the menu.lst file.

Many thanks in advance,

Hanns Wetzel

Revision history for this message
Best Alan Pope 🍺🐧🐱 🦄 (popey) said :
#1

Two things stand out.
You have a mix of SATA and IDE disks?
The partition types look a bit screwy.
/dev/sda1 * 1 9728 78140128+ 44 Unknown

Should that "Unknown" not be something friendly like NTFS?

My dualboot laptop below:-

/dev/sda1 * 1 7725 62051031 7 HPFS/NTFS

I understand there can be issues where grub misidentifies which disk is which during boot up if you have a mixed SATA/IDE environment. This seems to be confirmed with a quick google:-

http://www.google.co.uk/search?q=grub+mixed+sata+ide

Revision history for this message
Hanns Wetzel (hwe76146) said :
#2

Thank you Alan Pope for your response. It got me thinking and delving further.
Initially I had 2 IDE hard drives; Master 40GB, Slave 20GB, I installed XP on the IDE Master. This was about 3.5 years ago. In time Widows became very slow and had many accumulated errors. I then installed an 80GB SATA drive and completely reinstalled windows on what I assumed to be that drive. Re-fomatted the original IDE Master and used it for data storage, same for IDE Slave. Kept the SATA drive almost entirely for programs. At that time I also installed Symantec anti virus, firewall and Go-Back. All worked fine for about a year, then errors started creeping in again. Many times windows would not shut down properly etc. So having used FreeBSD many years ago, decided to try Ubuntu Linux. Installed it according to available documentation, Google, forums etc. and opted for the automatic install as recommended. That there would be an issue with IDE - SATA mixed, never occurred to me.. Expected to see a slider which would allow me to adjust the partition size if desired and again expected it to install on the largest drive - i.e. SATA. However it just went ahead and installed itself without any slider or feed back of any kind. I did not realise at the time but if you look at my menu.lst, if seems linux is installed on the IDE Master - (hd0). Also I knew nothing about mapping, however the grub folder contains a file called device.map in which is the following:
(hd0) /dev/hda
(hd1) /dev/hdb
(hd2) /dev/sda

If the windows entry in menu.lst is as follows:

title Microsoft Windows XP Home
root (hd2,0)
makeactive
chainloader +1

invoking that entry from the interactive grub menu, results in the message "starting up" appearing and nothing else, the computer just hangs. Any other entry for root results in an error message. The boot order that exists in BIOS is as follows:

IDE Master - /dev/hda
IDE Slave - /dev/hdb
SATA - /dev/sda

Making sda first and then booting results in the Symantec "Go Back" menu appearing (as it always did when previously booting Windows XP), but nothing else thereafter. Putting hdb first results in the message "NTLDR missing" and nothing else thereafter. Leaving them as above gives the "staring up" message.

I suspect that during the Linux install, either the MBR got changed or the Windows boot string was actually on IDE Master (/dev/hda), because that is where it used to be before installing the SATA drive and it got obliterated during the Linux install - because all my Windows data files that used to be there are now gone and the whole 40MB is taken up with Linux. Looking at the output from fdisk -l seems to make that clear. Don't want to restore MBR with DOS as this would probably prevent grub from booting Linux

I have force mounted /dev/sda and /dev/hdb in deparate directories under Linux and all the original NTFS files appear to be still there. So the question remains, what has to be
a) written into menu.lst so that grub points in the right direction and boots XP and/or
b) what might be missing/obliterated elsewhere during the Linux install, that has to be restored/fixed.

Any pearls of wisdom from those more knowledgeable than yours truly would be gratefully appreciated.

Hanns Wetzel

Revision history for this message
Hanns Wetzel (hwe76146) said :
#3

:
FAQ #52: “Can't install new software and updates”.

Revision history for this message
Hanns Wetzel (hwe76146) said :
#4

Thanks Alan Pope, that solved my question.