Search My Blog

Tuesday, May 24, 2011

My brand new Debian 6 grub menu had no mention of WinXP:O

I just installed Debian 6 on a machine with Windows XP already installed on the First Partition (hda0, 0 or sda0,0). I installed Debian 6 in the Free Space that I had left after my WinXP installation. During the grub installation, it saw my WinXP and said that it "should be ok" to install grub on the MBR (master boot record). I did this, trusting the info... But my brand new Debian 6 grub menu had no mention of WinXP!:O After a couple of hours of searching and reading and trying my had at editing the new grub2 (/etc/default/grub) file and doing it wrong. I was trying to follow these instructions... 

Configuring grub v2

The configuration file is /boot/grub/grub.cfg, but you shouldn't edit it directly. This file is generated by grub v2's update-grub(8), based on:
  1. The script snippets in /etc/grub.d/
  2. The configuration file /etc/default/grub
To configure grub "v2", you should edit /etc/default/grub, then run update-grub. Advanced configuration are achieved by modifying the snippets in /etc/grub.d/.

I was trying to add a WinXP Configuration to the file, something like in grub1. Thinking that I had to make it took like the Debian menu in the auto generated grub.cfg file at, /boot/grub/grub.cfg Only with the WinXP info, like in grub1...

(Don't edit this file directly!)... 

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-686' --class debian --class gnu-linux --class gnu --class os {
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set e6f72ea6-5b13-4511-aae4-8d839b2d59f3
    echo    'Loading Linux 2.6.32-5-686 ...'
    linux    /boot/vmlinuz-2.6.32-5-686 root=UUID=e6f72ea6-5b13-4511-aae4-8d839b2d59f3 ro  quiet
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-2.6.32-5-686

The /etc/grub.d/README file confused me even more...
All executable files in this directory are processed in shell expansion order.

  00_*: Reserved for 00_header.
  10_*: Native boot entries.
  20_*: Third party apps (e.g. memtest86+).

The number namespace in-between is configurable by system installer and/or
administrator.  For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.

Then, finally... I found this and realized. That's not how you do it...
When I upgraded from grub to grub2 I lost an entry to XP/WP7 , how can I recover the menu entry to boot there?
You have to install os-prober, make sure its enabled in grub2 configuration and sync grub2.
apt-get install os-prober  (os-prober was already installed when I rean this command on my Debian 6 System)
  • Then edit /etc/default/grub and make sure you have a line like
GRUB_DISABLE_OS_PROBER=false  (this one little line did the trick!)
Finally run update-grub2
(after a reboot, my WinXP was in the grub2 menu!:)


Here's the Terminal Output from doing this in Debian 6...

root@Debian-BlueFIC:/home/don# apt-get install os-prober
Reading package lists... Done
Building dependency tree      
Reading state information... Done
os-prober is already the newest version.
os-prober set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@Debian-BlueFIC:/home/don# update-grub
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
Found Microsoft Windows XP Professional on /dev/sda1

This is what my /etc/default/grub file looks like now...

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

# Uncomment to disable graphical terminal (grub-pc only)

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

#(this is all I had to do in the end, add this line)

Good Luck!:)

grub 2 boot debian and windows xp
grub 2 boot debian and windows xp - Google Search
Grub - Debian Wiki
#498439 - Grub2 1.96 can't boot Windows xp - Debian Bug report logs

No comments: