Tip: Windows XP/Vista does not boot from GRUB2 or GRUB-PC
Purpose: Wondering why Windows XP or (Windows Vista) on your dual-boot computer, i.e. having Windows XP and Linux installed, is not able to boot? The answer is that either there is a bug in the GRUB2 package or IDE disk naming convention has changed in GRUB2 from legacy GRUB.
Are you getting following error messages from GRUB2 when you try to boot Windows XP?
- chainloader: no such command.
- no such partition
- you need to load kernel first
If you are then follow the steps below to try to solve your problem.
Set-up:
A laptop having dual-boot – Windows XP and Debian (Lenny) on separate partitions on a single hard drive. Here is my partition structure:
# fdisk -l /dev/sda
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2e61c242Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 7 HPFS/NTFS
/dev/sda2 3316 7296 31977382+ 5 Extended
/dev/sda5 * 3316 5139 14651248+ 83 Linux
/dev/sda6 5140 5200 489951 82 Linux swap / Solaris
/dev/sda7 5201 7296 16836088+ b W95 FAT32
Step 1: Install GRUB2
Suppose you upgraded to GRUB2 doing following:
#apt-get update
#apt-get install grub2
Step 2: Reboot system
Now upon installing the GRUB2 package successfully and reboot your machine you will see a changed GRUB menu. Now select “Chainload into GRUB2″ and chances are that you won’t even find your XP partition listed in there (I didn’t find mine).
Step 3: Create a boot file for Windows XP/Vista/7
Boot into your Linux system by selecting your kernel (if there are multiple) from your GRUB2 menu and see if it boots fine. Upon booting into Linux do the following:
# nano /etc/grub.d/11_Windows (this will essentially create a new file)
and add the following lines:
#! /bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows XP" {
set root=(hd0,1)
chainloader +1
}
EOF
Note: In earlier version of GRUB, if your Windows was installed on First partition then you need to give root=(hd0,0), since that’s how GRUB use to number the partitions. However from this new version onwards, you need to give root=(hd0,1) if your Windows is installed on first partition of the hard drive.
Update: One of the commenter (Thanks Jorge), suggested that he had to give the following additional command:
chmod a+x /etc/grub.d/11_Windows
So under new GRUB2:
Windows on:
First partition (/dev/sda1): root=(hd0,1)
Extended First partition (/dev/sda5): root=(hd0,5)
Extended Second partition (/dev/sda6): root=(hd0,6)
and so on…
Now save the file (11_Windows) and give the following command:
# update-grub2
You should be able to see something like this:
# update-grub2
Updating /boot/grub/grub.cfg ...
Found Debian background: moreblue-orbit-grub.png
Found linux image: /boot/vmlinuz-2.6.26-rt1-rt
Found initrd image: /boot/initrd.img-2.6.26-rt1-rt
Found linux image: /boot/vmlinuz-2.6.26-1-686
Found initrd image: /boot/initrd.img-2.6.26-1-686
Found linux image: /boot/vmlinuz-2.6.25-2-686
Found initrd image: /boot/initrd.img-2.6.25-2-686
Adding Windows
done
Step 4: Reboot again
Now reboot your system and again go to “Chainload into GRUB2″ option and you should see an entry for Windows XP and it should be able to boot into Windows XP.
Step 5: Upgrade to GRUB2 “really”
Once you are convinced that the new GRUB2 is letting you boot into Linux and Windows properly, you can install the GRUB2 into your MBR (Master Boot Record) by either selecting the option “upgrade-from-grub-legacy” from the GRUB menu or by giving the command “upgrade-from-grub-legacy” when you are into your Linux system.
Additional Notes:
- GRUB2 boot menu configuration file: The file /boot/grub/grub.cfg is equivalent of /boot/grub/menu.lst of the old GRUB. This file is self-generated by the command “update-grub” and upgrade-grub2?. Both these command do the same thing.
- Do NOT select the option “upgrade-from-grub-legacy” unless and until you have verified that the GRUB2 loads your OS properly.
- GRUB2 configuration files: All the GRUB2 configuration files are stored at the location /etc/grub.d. Read the file README under that location to get an idea as to how those configuration file works.
- Lastly you can edit the GRUB2 boot config file (/boot/grub/grub.cfg) on-the-fly from the GRUB2 menu. Just press “e” and you will be in a editor mode and you can change the lines and experiment with it until you are able to boot successfully into Windows and/or Linux. You don’t have to boot the system into Linux every time you need to make changes to the GRUB2 config files.
As usual, please leave a comment/feedback if you have any. Comments encourages bloggers to post more and keep their spirits high.
Also don’t forget to rate this post below.
Pass your certification exam with testkings online prep course and improve your score in real test using testking VCP-410 practice questions and testking 350-001 mock test.

Email Subscription









January 7th, 2009 at 7:40 am
Instead of step 3, try installing the os-prober package. It should detect your Windows installation automatically:
# apt-get install os-prober
# update-grub2
Reply to this comment
Kushal Reply:
January 7th, 2009 at 6:20 pm
Hi Ryan,
I do remember seeing something about os-prober entry in the GRUB config files but never got a chance to dig deeper into it. I will give that a shot and see how it goes.. Thank you very much for bringing this up…
Reply to this comment
Oceanwatcher Reply:
October 9th, 2009 at 4:09 am
Ryan,
Thank you for your comment. It saved me for a lot of more searching.
After upgrading to Kubuntu 9.10beta, I decided to install grub2. Everything went fine except I did not use the spacebar to mark the harddisk. As a result, I got and error 15 before grub2 even displayed a boot menu :-(
After a lot of searching, I ended up downloading the SuperGrub rescue CD. It got me booted into Kubuntu, and I could then fix things there.
But my Windows installation (I am dual booting) still did not work. So I tried our suggestion. Turned out that os-prober was already installed and only had to issue the update command. Things are now working fine :-)
Reply to this comment
February 18th, 2009 at 7:37 pm
Kushal:
Thanks for the post. It has been quite useful for me. One comment: in step 3, after saving 11_Windows I had to give it execution permission:
chmod a+x /etc/grub.d/11_Windows
Reply to this comment
Kushal Reply:
February 18th, 2009 at 7:46 pm
Thanks for the Info. I have updated the post by your suggestion.
Glad that you found this post useful.
Reply to this comment
March 1st, 2009 at 11:44 am
Thanks, this post solved my problem, I needed Jorge’s line too.
Reply to this comment
Kushal Reply:
March 2nd, 2009 at 6:31 pm
Hi Oriol,
Thank you for your valuable feedback! Glad to know that it worked for you.
Reply to this comment
March 6th, 2009 at 1:39 pm
found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later ..
Reply to this comment
Admin Reply:
March 8th, 2009 at 3:30 pm
Hi Jason,
Can you tell me what did you like in specific? This is just so that it can help us to improve our site in future.
Reply to this comment
March 7th, 2009 at 2:05 am
Hi,
I found a valuable help in this post.
I’d like to know something more on how to edit grub2 configuration files but I can’t find any documentation…
Anyone knows where to look for?
(http://grub.enbug.org and http://www.gnu.org/software/grub/grub.html aren’t very helpful actually)
About /etc/grub.d/12_windows, are the lines:
set root=(hd0,1)
chainloader +1
and
chainloader (hd0,1)+1
equivalent?
And what’s exactly the meaning of the line:
chainloader +1
Thank you in advance for your help.
Reply to this comment
Admin Reply:
March 9th, 2009 at 9:46 am
Hi Riccardo,
Thank you for your comment!
Yes those two lines are equivalent. Even I noticed that when I was writing this post.
Also I completely agree with you that there is a lack of documentation on GRUB2. And that’s why I decided write some articles on GRUB2.
Reply to this comment
April 27th, 2009 at 2:17 pm
Please, can you PM me and tell me few more thinks about this, I am really fan of your blog…
Reply to this comment
May 10th, 2009 at 1:26 am
Thank you so much!
This one is the best Grub 2 guide I can find through days of googling.
Reply to this comment
June 1st, 2009 at 10:49 am
Please let me know if you would like to exchange link with a pr 3 blog, thanks!
Reply to this comment
Admin Reply:
June 2nd, 2009 at 12:30 am
I already have a PR of 3 so I guess it would not do any good to me if I link with a PR3 blog. I am not an expert in SEO and page ranking but I read this somewhere.
Reply to this comment
June 7th, 2009 at 6:48 am
thanks a lot for this howto,
but, when i update-grub2, an error is printed:
/bin/sh: Illegal option -
oem@oem-desktop:~$ sudo update-grub2
Updating /boot/grub/grub.cfg …
Found linux image: /boot/vmlinuz-2.6.30-7-generic
Found initrd image: /boot/initrd.img-2.6.30-7-generic
Found linux image: /boot/vmlinuz-2.6.28-12-generic
Found initrd image: /boot/initrd.img-2.6.28-12-generic
/bin/sh: Illegal option -
Windows is not found, as i’ve copy/paste your lines, i don’t see where is the problem.
Reply to this comment
Admin Reply:
June 7th, 2009 at 11:24 am
Does your file (11_windows) contain the words EOF?
Reply to this comment
dino99 Reply:
June 8th, 2009 at 10:00 am
like this:
#! /bin/sh -e
echo “Adding Windows” >&2
cat << EOF
menuentry “XPsp3″ {
set root=(hd1,1)
chainloader +1
}
EOF
… that give me the above error.
So, i’ve found an other version (from debian) and there is no error, but os-prober seems to provide wrong information( and duplicated)
(os-prober is a dependancie of grub-pc on ubuntu)
here is the other one:
#!/bin/sh
#Windows sur /dev/sdb1
insmod ntfs
insmod chain
menuentry “XPsp3″ {
set root=(hd1,1)
chainloader +1
boot
}
Reply to this comment
Admin Reply:
June 8th, 2009 at 10:07 am
Not sure what method did you use to create the first file, but your file should NOT have the words EOF. Remove both the EOF. Better just use any plain text editor and paste these lines:
#! /bin/sh -e
echo “Adding Windows” >&2
menuentry “XPsp3? {
set root=(hd1,1)
chainloader +1
}
That should do the trick.
Reply to this comment
July 17th, 2009 at 1:49 pm
Thanks a lot for the post, helped me to regain access to my Windows 7 RC installation. Now I can finally get back to testing both, Ubuntu Karmic and Windows, on the same computer.
Reply to this comment
August 15th, 2009 at 8:06 am
Thanks for this! I was getting tired of editting the grub.cfg file everytime I had added or removed a new kernel. This is definitely a better more long lasting solution!
Reply to this comment
September 29th, 2009 at 9:55 am
Hello, works perfectly:-) thanks
Reply to this comment
October 5th, 2009 at 1:22 pm
Many thanks, was trying to figure this one out for some time (without success). Great! :)
Reply to this comment
October 23rd, 2009 at 8:02 pm
Ryan,
you made my day! :-)
Koolwal,
you provided it by the article! :-)
Thanks,
R
Reply to this comment
Admin Reply:
October 26th, 2009 at 10:11 pm
Glad to be of any help!
Reply to this comment
October 30th, 2009 at 11:26 am
I had a hard time figuring out the problem on my computer! I have windows on a separate harddisks (not partitions).
There for the boot to work it should be:
menuentry “Microsoft Windows” {
insmod ntfs
insmod chain
insmod drivemap
set root=(hd1,1)
drivemap -s (hd1) (hd0)
chainloader +1
}
hd1 (in this exmaple) <- the harddisk where windows is
hd0 (in this example) is where grub is installed (the drivemap) is really important
Reply to this comment
YEisHere Reply:
December 21st, 2009 at 9:48 am
Hi,
I’ve been looking for info to install a dual boot with Debian on my XP laptop (toshiba satellite) with an external harddrive. Do you have any, simple howto’s that I can use?
Thanx much!
Reply to this comment
November 3rd, 2009 at 12:52 am
Hi,
Thanks for the article! Just a note, on a fresh install of karmic koala, update-grub2 is not installed, however you can acquire it by typing:
$sudo apt-get install grub-pc
The notes say update-grub is the same, but when I ran it, it wanted to create menu.lst and not grub.conf:
Testing for an existing GRUB menu.lst file …
Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) n
Not creating /boot/grub/menu.lst as you wish
After installing the above package and running update-grub it seems identical to update-grub2.
Hope this helps a bit…
Ciao
Reply to this comment
January 23rd, 2010 at 2:24 am
My GRUB 1.97beta4 (from LinuxMint8) inserted the menu entry Windows XP by itsself but after selecting it, the only “NTLDR is missing” is displayed and reboot recomended. The search for ntldr on my Linux-partition gave no result.
I’m having Linux and Windows on seperate partitions on the same drive.
Reply to this comment
February 7th, 2010 at 6:12 pm
After following all of your instructions I got a windows option to appear in my GRUB menu… however, when selected the Windows option takes me to a blank screen with a flashing cursor and becomes unresponsive…. help!!! I was so close.
Reply to this comment
March 3rd, 2010 at 1:13 am
Hello! from Berkley. I enjoy your blog
Reply to this comment
March 31st, 2010 at 5:52 pm
[...] Fonte: Windows XP/Vista does not boot from GRUB2 or GRUB-PC Posted by linuxmachado Filed in Linux Leave a Comment » [...]
April 13th, 2010 at 2:37 pm
Hi!
I followed you instructions, but I go the following problem:
I have installed Xp on one partition and Ububtu 9.10 on one other.
fdisk -l says that sda1 is for ubuntu and sda2 for win. I set root=(hd0,2) then update-grub2. But when I try to start Xp an error message appears no such partition.
Got any idea?
Thx in advance,
Robaato
Reply to this comment
April 24th, 2010 at 8:06 pm
Thank you for this site. I have spend hours and hours to figure out how to dual boot under this new Grub2. Your explanation function out of the box! Thank you
Reply to this comment
August 1st, 2010 at 1:29 pm
Hi.. Cool guide!
I have one problem though.. How do I find out which root(hdx,x) my XP is?
I should be on the first partition, but have tried with 0,1 and 1,1.. Is there a command to liste the name and numbers of the partitions?
I have 3 partitions.. One with Windows XP, One with Linux, and one NTFS.
Reply to this comment
August 23rd, 2010 at 9:05 pm
Thanks for this!
Reply to this comment
October 20th, 2010 at 11:37 pm
[...] Windows XP/Vista (dual-boot) חοt booting аftеr upgrading tο GRUB2 οr GRUB… [...]
October 30th, 2010 at 6:07 am
You you could edit the page name Windows XP/Vista (dual-boot) not booting after upgrading to GRUB2 or GRUB-PC | Organizing Linux Information! to more generic for your subject you make. I loved the the writing however.
Reply to this comment
February 2nd, 2011 at 6:04 pm
i ran into this problem by installing windows xp, then ubuntu 10.10 (which iso comes with grub2, i believe), then doing a couple of ubuntu boots after trying once windows. When i tried again to get into windows i couldn’t anymore, as no windows option showed on the grub boot menu.
anyway, i only had to perform step 3 above, to make the windows option show in /boot/grub/grub.cfg and it worked afterwards (the windows option showed at boot time and i could boot into it as well).
thanks for this posting!
Reply to this comment
June 28th, 2011 at 5:08 am
Thanx man! that works. will translate into Russian and repost in my blog. with a link at u.
Reply to this comment
June 29th, 2011 at 6:06 pm
Thanks this solved my problem .
Reply to this comment
July 10th, 2011 at 5:58 am
[...] Accessed July 8th 2011 – http://linux.koolsolutions.com/2008/12/28/windows-xpvista-dual-boot-does-not-boot-from-grub2-or-grub... [...]
October 16th, 2011 at 9:30 am
just finish rebuilding after a HD failure.
worked like a charm.
Thanks
Reply to this comment
January 29th, 2012 at 7:30 am
thank you very much!!
i had the same problem with mint12 and windows xp….. and i was thinking in format everything again… XD…
Reply to this comment