LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 02-20-2009, 02:23 PM   #1
scottybwoy
LQ Newbie
 
Registered: Nov 2005
Location: Birmingham, UK
Distribution: Kubuntu 10.04 x64
Posts: 25

Rep: Reputation: 15
loading winXP from Grub2


Hi peeps,

Been outta the Linux world for a while, just comming back. I've just installed Debian Lenny with the Grub2 loader. My Windows XP is on another partition. It's all meesed up at the mo, but just want to use some files in XP.

Here's my fdisk -l :
Code:
Disk /dev/sda: 320.0 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005c55a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        4863    39062016   83  Linux
/dev/sda2            4864       12158    58597087+   5  Extended
/dev/sda5            4864        6079     9767488+  82  Linux swap / Solaris
/dev/sda6            6080       12158    48829536   83  Linux

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf9170488

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        4863    39062016    7  HPFS/NTFS
/dev/sdb2            4864        8754    31254457+   5  Extended
/dev/sdb3            8755       24792   128825235    7  HPFS/NTFS
/dev/sdb5            6323        8754    19535008+  83  Linux

Disk /dev/hdb: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000001

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        3187    25599546    c  W95 FAT32 (LBA)
/dev/hdb2            3188        6374    25599577+   7  HPFS/NTFS
/dev/hdb3            6375       17767    91514272+   7  HPFS/NTFS
/dev/hdb4           17768       30515   102398310    7  HPFS/NTFS
My Windows XP is on /dev/hdb3, (don't ask). How do I tell grub 2 where it is?

I did this :
Code:
# nano /etc/grub.d/11_Windows

#! /bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows XP" {
set root=(hd3,3)
chainloader +1
}
EOF

# update-grub2
But think I need to incorporate this :
Code:
title Microsoft Windows XP
rootnoverify (hd3)
map (hd0) (hd3)
map (hd3) (hd0)
chainloader +1
But don't know how, thanks
 
Old 02-20-2009, 02:31 PM   #2
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,137

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
If xp is on hdb3, the entry you need is:

title Windows XP
rootnoverify (hd1,2)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

Grub counts from zero. Your hdb3 is not marked active (bootable) but hdb1 is so you may need to add "makeactive" on the line above "chainloader +1". Try without first.
 
Old 02-20-2009, 02:58 PM   #3
scottybwoy
LQ Newbie
 
Registered: Nov 2005
Location: Birmingham, UK
Distribution: Kubuntu 10.04 x64
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks Yansec,

But I am using Grub2 which counts from 1 not zero. Also it does not use a menu.lst so I need to know how to get it to write to the grub.cnf file dynamically. Anyone else know? I'm also not sure about the activity state, how do I find out more about that?
 
Old 02-23-2009, 10:20 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
grub2 configuration is also giving me headaches..
One thing might help:
aptitude install os-prober
Then try to update-grub2
I didn't try it since I have no other os..
 
Old 11-08-2009, 06:35 PM   #5
jdulrich
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 1
For those who come from google, if you run

Code:
# update-grub2
you may get an error similar to this:

Code:
Generating grub.cfg ...
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
Found Microsoft Windows XP Professional on /dev/sdb1
grub-probe: error: Cannot find a GRUB drive for /dev/sdb1.  Check your device.map.

done
To correct this, run the following first and update-grub2 will correctly find windows xp on a second harddrive:

Code:
# grub-mkdevicemap
 
1 members found this post helpful.
Old 11-12-2009, 02:43 PM   #6
milomak
Member
 
Registered: May 2009
Posts: 90

Rep: Reputation: 17
if you "just want to use some files in XP", what type of files are they? you could in the meanwhile just mount the XP partition.

With respect to /etc/grub.d/11_Windows, did you run a chmod +x on it before update-grub?
 
Old 09-21-2010, 12:54 AM   #7
agalgo
LQ Newbie
 
Registered: Jan 2006
Location: Mexico City
Distribution: debian lenny
Posts: 18

Rep: Reputation: 0
/etc/default/grub

Try editing your /etc/default/grub file. For that effect, follow the pointers here: https://wiki.ubuntu.com/Grub2

Once you have edited your /etc/default/grub file, run (sudo) update-grub... The important key is:

GRUB_DISABLE_OS_PROBER=false - this will find your os...

You will need the os-probe package.

Hope it works...
 
Old 01-14-2011, 12:48 PM   #8
tmountney
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Tried re-installing Grub2 and still could not dual boot WinXP.

I had to create/modify /etc/grub.d/11_Windows to boot WinXP...

#! /bin/sh -e
echo "Adding Windows XP" >&2
cat << EOF
menuentry "Windows XP" {
insmod ntfs
set root=(hd1,1)
drivemap -s (hd0) \${root}
chainloader +1
}
EOF

Then of course run update-grub and reboot...

Dell Optiplex GX520
2GB Ram
500GB Sata - Ubuntu 9.10 (/dev/sda)
250GB Sata - WinXP Professional (/dev/sdb)

Found that os-prober and thus 30_os-prober were NOT working so WinXP was not detected. Still researching why os-prober isn't detecting WinXP - os-prober runs but returns no information. I have three other systems, Debian 5 (64bit)/Win7 Ultimate (ASUS P6T), Ubuntu 10.04/WinXP (EPOX EP-4PLMI) and Ubuntu 9.10/WinXP (HP Pavilion dv8000 laptop) and on these os-prober/30_os-prober work fine. On the systems where os-prober works, running os-prober from command line returns Windows OS information but not on system where problem occurs.

Hope this helps some...
 
Old 01-14-2011, 01:12 PM   #9
EDDY1
Senior Member
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: DebianSqueeze, winsxp, wins7, Debian wheezy, LFS 7.2
Posts: 4,658

Rep: Reputation: 408Reputation: 408Reputation: 408Reputation: 408Reputation: 408
Maybe you need to reinstall grub-pc.
I think term grub2 is transitional so install grub-pc

Last edited by EDDY1; 01-14-2011 at 01:17 PM.
 
Old 01-15-2011, 12:11 AM   #10
tmountney
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Unhappy

I re-installed grub-pc and grub-common, in fact I also did a complete uninstall/reinstall of grub2 as well - didn't resolve the problem. The solution I gave above came from looking at grub.cfg on a working system - the section for 30_os-prober. In the failing system the 30_os-prober had no content which led me to command line execution of os-prober. On working systems command line execution of os-prober detects the WinXP os. On the failing system it doesn't

I also did fixmbr and fixboot on the WinXP drive - also didn't fix the prob with os-prober. The WinXP drive boots just fine standalone but as noted is not detected by os-prober when setup in dual boot configuration.

I'm continuing with research of why os-prober fails to detect WinXP. Though I've got dual boot to work I'd still like to know why os-prober doesn't work. While I'd like to avoid Windows totally, there are applications I use that are sadly not available with Linux.

Thanks for the recommendation - any ideas are appreciated.
 
Old 01-15-2011, 02:01 AM   #11
EDDY1
Senior Member
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: DebianSqueeze, winsxp, wins7, Debian wheezy, LFS 7.2
Posts: 4,658

Rep: Reputation: 408Reputation: 408Reputation: 408Reputation: 408Reputation: 408
Maybe you don't have module loaded in ubuntu to read xp file system.
 
Old 01-15-2011, 05:26 AM   #12
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
If os-prober does not work then grub does not detect the hd on boot which I would think that you need a bios update or are using a controller that grub does not recognize. It might be worth sending all the specs and what you have done to grub.
 
Old 01-16-2011, 02:31 PM   #13
agalgo
LQ Newbie
 
Registered: Jan 2006
Location: Mexico City
Distribution: debian lenny
Posts: 18

Rep: Reputation: 0
gub2 configuration - other os's

Hi guys,

I remember having this problem some time ago. I'm running lenny on a Dell Inspiron Laptop. I suscribed to this post back then, though, in the way, I got the problem solved. I hope I can still be of some help since I don't recall and didn't save the posts that helped me solve grub2 recognizing my windows partition. However, I remember I assembled the solution out of bits and pieces googling here and there. Let me post my configuration files (the ones I consider relevant) and hopefully you'll find them useful:

To begin with, /boot/grub.cfg

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

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,3)
search --fs-uuid --set abd6b444-a965-4239-9263-4707d0a4ae31
if font /usr/share/grub/ascii.pff ; then
set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set root=(hd0,3)
search --fs-uuid --set abd6b444-a965-4239-9263-4707d0a4ae31
insmod png
if background_image /boot/grub/moreblue-orbit-grub.png ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.26-2-686" {
	set root=(hd0,3)
	search --fs-uuid --set abd6b444-a965-4239-9263-4707d0a4ae31
	linux	/boot/vmlinuz-2.6.26-2-686 root=UUID=abd6b444-a965-4239-9263-4707d0a4ae31 ro splash vga=791 splash
	initrd	/boot/initrd.img-2.6.26-2-686
}
menuentry "Debian GNU/Linux, linux 2.6.26-2-686 (single-user mode)" {
	set root=(hd0,3)
	search --fs-uuid --set abd6b444-a965-4239-9263-4707d0a4ae31
	linux	/boot/vmlinuz-2.6.26-2-686 root=UUID=abd6b444-a965-4239-9263-4707d0a4ae31 ro single splash vga=791
	initrd	/boot/initrd.img-2.6.26-2-686
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86 ###
menuentry "Memory test (memtest86)" {
	linux	/memtest86.bin
}
### END /etc/grub.d/20_memtest86 ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	linux	/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows XP Media Center Edition (on /dev/sda1)" {
	set root=(hd0,1)
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###
The files I've got listed under /etc/grub.d/ are the following:

-rwxr-xr-x 1 root root 1895 2010-09-13 08:12 00_header
-rwxr-xr-x 1 root root 1143 2008-11-10 09:19 05_debian_theme
-rwxr-xr-x 1 root root 2369 2009-02-10 19:20 10_hurd
-rwxr-xr-x 1 root root 4050 2010-09-13 00:38 10_linux
-rwxr-xr-x 1 root root 214 2008-03-24 14:08 20_memtest86
-rwxr-xr-x 1 root root 219 2008-10-02 20:27 20_memtest86+
-rwxr-xr-x 1 root root 2567 2009-02-10 19:20 30_os-prober
-rwxr-xr-x 1 root root 84 2009-02-10 19:20 40_custom
-rw-r--r-- 1 root root 483 2009-02-10 19:20 README

The contents of /etc/grub.d/30_os-prober are:

Code:
#! /bin/sh -e

# update-grub helper script.
# Copyright (C) 2006,2007,2008  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
  # missing os-prober and/or linux-boot-prober
  exit 0
fi

OSPROBED="`os-prober 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
if [ -z "${OSPROBED}" ] ; then
  # empty os-prober output, nothing doing
  exit 0
fi

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  echo "Found ${LONGNAME} on ${DEVICE}" >&2

  case ${BOOT} in
    chain)
      CHAINROOT="`grub-probe --target=drive --device ${DEVICE} 2> /dev/null`"

      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
	set root=${CHAINROOT}
	chainloader +1
}
EOF
    ;;
    linux)
      LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
 
      for LINUX in ${LINUXPROBED} ; do
        LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
        LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
        LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
        LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
        LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
        LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

        LINUXROOT="`grub-probe --target=drive --device ${LBOOT} 2> /dev/null`"

        if [ -z "${LLABEL}" ] ; then
          LLABEL="${LONGNAME}"
        fi

        cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" {
	set root=${LINUXROOT}
	linux ${LKERNEL} ${LPARAMS}
EOF
        if [ -n "${LINITRD}" ] ; then
          cat << EOF
	initrd ${LINITRD}
EOF
        fi
        cat << EOF
}
EOF
      done
    ;;
    hurd|*)
      echo "  ${LONGNAME} is not yet supported by update-grub." >&2
    ;;
  esac
done
And finally, for some reason I remember this file was crucial, /etc/default/grub:

Code:
# This file is sourced by update-grub, and its variables are propagated
# to its children in /etc/grub.d/
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT=0 (only available for single user mode)
#GRUB_HIDDEN_TIMEOUT:QUIET=true (only available for single user mode)
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX="splash vga=791"
GRUB_CMDLINE_LINUX_DEFAULT="splash"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
#Uncomment to change resolution of your boot loader (4:3 rate 640x480, 800x600, 1024x768, 1600x1200); (16:10 rate 640x400, 800x500, 1024x640, 1280x800, 1680x1050)
#GRUB_GFXMODE=
#To set the framebuffer resolution
#GRUB_GFXPAYLOAD_INUX=640x480x8 [grub2>=1.98-1 (Lucid)]
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
#Add or uncomment tis line to prevent "recovery" mode kernel options from appearing in the menu
#GRUB_DISABLE_LINUX_RECOVERY=true
#Enables/disables the os-prober check of other partitions for operating systems, including Windows, Linux, OSX and Hurd
GRUB_DISABLE_OS_PROBER=false
I hope the information becomes useful for you. If you should need me to post anything else, please let me know and I will be glad to be of assistance.

Regards and luck!
 
Old 01-18-2011, 02:08 AM   #14
EDDY1
Senior Member
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: DebianSqueeze, winsxp, wins7, Debian wheezy, LFS 7.2
Posts: 4,658

Rep: Reputation: 408Reputation: 408Reputation: 408Reputation: 408Reputation: 408
FOR GRUB2 NEWBIES LIKE MYSELF
WITH DEBIAN BASED SYSTEMS
I took out my slave drive recently to put another hdd in to work on, so I finished what I was doing, and today I put it back in.

During the time the drive was out, I had a grub update, so my hdd wasn't in grub splash.
I finally saw a time that os-prober didn't work.
I am going to have to spend more time learning linux commands.
I did
"sudo os-prober"
It only saw the os that was on the drive that never was removed.

Long story short, because I didnt know the mount commands,
I went to my disk utility and mounted / of both os'es that were on second hdd, 1 os being in logical partition
and ran
'sudo os-prober"
and
"sudo update-grub"
and detected both os'es.

I had to put it out there for some us newbies.
 
Old 04-20-2011, 10:33 AM   #15
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 875

Rep: Reputation: 179Reputation: 179
Thumbs up

Quote:
Originally Posted by jdulrich View Post
For those who come from google, if you run

Code:
# update-grub2
you may get an error similar to this:

Code:
Generating grub.cfg ...
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
Found Microsoft Windows XP Professional on /dev/sdb1
grub-probe: error: Cannot find a GRUB drive for /dev/sdb1.  Check your device.map.

done
To correct this, run the following first and update-grub2 will correctly find windows xp on a second harddrive:

Code:
# grub-mkdevicemap


You, sir, are a goddamn, genuine genius. Guru points for you. Thanks for fixing my problem.

Pete
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB: Loading WinXP on a different hard drive ZxPwn Linux - General 3 06-12-2008 01:04 PM
problem with suse 10.1 grub bootloader when loading winXP flanker12k Linux - Newbie 4 09-17-2007 10:05 PM
Loading Winxp on redhat enterprise linux cdoutlet Linux - Software 3 11-17-2005 10:23 AM
Editing GRUB2 ssinustwo Fedora - Installation 1 07-20-2004 09:16 PM
error 13 winxp not loading terry.trent Linux - Software 1 11-23-2003 03:18 AM


All times are GMT -5. The time now is 08:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration