Windows installed on second partition, how to add it to boot menu?

3

1

I'm using Debian 6.0.6 Squeeze at the moment, I installed it over Windows XP.

It's just one hard drive where I first installed Windows XP and than used some Windows tool to make partition where I later installed Debian

Now, I can easily boot in Debian but there is no sign of Windows. I tried few things recommended on line, but still I couldn't get it working

I tried os-prober, tried to edit grub.cfg (I managed to add Windows XP to menu but this is just empty link, when I enter nothing happens (blank screen), where should it link to?)


also this, after fdisk -l:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c0014

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               2        4663    37447484+   f  W95 Ext'd (LBA)
/dev/sda2            4664        4864     1614532+  82  Linux swap / Solaris
/dev/sda5               2        2032    16313976    7  HPFS/NTFS
/dev/sda6            2033        4663    21133476   83  Linux

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
done

zarkoz

Posted 2013-01-13T00:12:21.680

Reputation: 31

Looking for Bootloader isn't quite what you're looking for, eh? – Ariane – 2013-01-13T00:14:28.797

i'm not sure, do you mean tweaking bios? maybe I need to link to some file which windows uses to boot, don't know – zarkoz – 2013-01-13T00:16:19.127

1You need to create a chainloader entry. – Tamara Wijsman – 2013-01-13T00:23:44.720

@TomWijsman, update-grub should take care of that. – terdon – 2013-01-13T01:05:43.070

Answers

1

From the previous answer I gathered, that you are probably using grub2. The correct way to manually add a menu entry is through the /etc/grub.d/ directory.

Create a file 01_windows_xp (change the number according to the ordering you want, linux got the 10_) and add the following to it:

echo "Adding Windows XP to the Menu..."
cat << EOF
menuentry "Windows XP"
        set root=(hd0,5)
        chainloader +1
}
EOF

Then rerun update-grub. You can look at the generated /boot/grub/grub.cfg afterwards. This way the new menu entry will survive a kernel update, where update-grub will be run automatically.

BubuIIC

Posted 2013-01-13T00:12:21.680

Reputation: 546

0

Assuming you did not overwrite your windows installation (you said you installed "over" windows XP?), the following commands should be enough. If not, please update your question with their output:

sudo update-grub
Sudo grub-install /dev/sda

terdon

Posted 2013-01-13T00:12:21.680

Reputation: 45 216

xp is alive on partition for sure, thanks for reply, I will try this – zarkoz – 2013-01-13T00:40:35.993

still not showing up, I updated question with more infos, any help appreciated :) – zarkoz – 2013-01-13T00:53:14.230

@zarkoz, could you post the output of the update-grub command? Does it detect windows? – terdon – 2013-01-13T01:05:00.043

tried that few times before, doesn't help – zarkoz – 2013-01-13T01:08:56.307

/dev/sda5 2 2032 16313976 7 HPFS/NTFS -- this is your Windows installation. change your grub manually adding sda5 with a chainloader, then, sudo update-grub and Sudo grub-install /dev/sda – Lorenzo Von Matterhorn – 2013-01-13T01:14:08.070

how to manually change grub, which file would this be? – zarkoz – 2013-01-13T01:20:18.083

/boot/grub/menu.lst . you need to edit this using your preferred text editor with sudo. – Lorenzo Von Matterhorn – 2013-01-13T01:22:24.527

0

edit your /boot/grub/menu.lst using your preferred text editor with sudo. add the lines:

title Microsoft Windows XP
root (hd0,5)
chainloader +1

run:

sudo update-grub
sudo grub-install /dev/sda

reboot & done

if using grub2:

the configuration file is located here:

/boot/grub/grub.cfg

and the lines added should be:

menuentry "Microsoft Windows XP" {
set root=(hd0,5)
chainloader +1
}

run:

sudo update-grub
sudo grub-install /dev/sda

Lorenzo Von Matterhorn

Posted 2013-01-13T00:12:21.680

Reputation: 2 137

menu.lst doesn't exist, I created it, paste the code, update and install, reboot, still nothing :( – zarkoz – 2013-01-13T01:29:48.090

@zarkoz you are probably using grub2. i updated my answer. – Lorenzo Von Matterhorn – 2013-01-13T01:31:20.687

still no dice. I noticed that whenever I run update-grub, grub.cfg restores changes, like i didn't write anything in this file – zarkoz – 2013-01-13T01:36:02.430

try not doing update-grub then. add it using sudo grub-install /dev/sda and reboot. – Lorenzo Von Matterhorn – 2013-01-13T01:37:33.933

Microsoft Windows xp shows up, but when I enter it's just blank screen with cursor blinking – zarkoz – 2013-01-13T01:47:39.623

thats weird. try changing set root=(hd0,5) to set root=(hd0,1) . sda1 seems to be an extended partition but well, at least we try all possibilities. im running out of juice here. – Lorenzo Von Matterhorn – 2013-01-13T01:49:40.560

still nothing, I will keep trying, thanks for your help anyway :) – zarkoz – 2013-01-13T01:59:34.933

you got some serious strange things going on there mate. well, either that or my eyes are drunk (yes my eyes not me). hope you get it sorted out. – Lorenzo Von Matterhorn – 2013-01-13T02:00:32.213