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.


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: 0x2e61c242

Device 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

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

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.

Be Sociable, Share!