DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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?
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..
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:
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.
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.
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.
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:
#! /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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.