PDA

View Full Version : [SOLVED] Grub Does Not Include Windows XP



abpriest
February 25th, 2012, 08:09 PM
Hello,

I installed windows XP on a Dell Inpiron 530. It is on partition 5 of the only hard drive (I do not recall why it is on partition 5).

Then I installed Ubuntu 11.10 from USB. Grub did not immediately add Windows XP to the list of OSs. I looked up the documentation and I understand some of the basics behind how Grub works, but I have not really understood how to add a script to include windows in the boot menu.

Who can help me with this?

darkod
February 25th, 2012, 08:22 PM
Are you sure it is on partition #5? In linux, the primary partitions are numbered 1-4 because the max limit is 4. The logical partitions are numbered 5 and higher.

XP wouldn't work on logical partition, it needs to be on a primary. In fact, I wonder how it allowed you to install onto a logical partition. Unless it put it's boot files on a different partition.

You can run the boot info script from the link in my signature to see what is where. Post the results as explained there.

abpriest
February 25th, 2012, 09:21 PM
Okay, I am confused. Here is the output of the script:


Boot Info Script 0.60 from 17 May 2011


============================= Boot Info Summary: ===============================

=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for on this drive.

sda1: __________________________________________________ ________________________

File system: vfat
Boot sector type: Dell Utility: FAT16
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /DELLBIO.BIN /DELLRMK.BIN /COMMAND.COM

sda2: __________________________________________________ ________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 11.10
Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda3: __________________________________________________ ________________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sda5: __________________________________________________ ________________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda5 starts
at sector 63.
Operating System: Windows XP
Boot files:

sda4: __________________________________________________ ________________________

File system: swap
Boot sector type: -
Boot sector info:

============================ Drive/Partition Info: =============================

Drive: sda __________________________________________________ ___________________

Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 63 80,324 80,262 de Dell Utility
/dev/sda2 * 81,920 39,143,423 39,061,504 83 Linux
/dev/sda3 430,172,566 446,558,804 16,386,239 f W95 Extended (LBA)
/dev/sda5 430,172,568 446,558,804 16,386,237 7 NTFS / exFAT / HPFS
/dev/sda4 39,143,424 54,767,615 15,624,192 82 Linux swap / Solaris


"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/sda1 07D7-0615 vfat DellUtility
/dev/sda2 decd6497-7f52-4686-a1a7-a759b54577fd ext4
/dev/sda4 68ebea21-5b60-4bdc-8282-ed03250223eb swap
/dev/sda5 82E47108E4710029 ntfs

================================ Mount points: =================================

Device Mount_Point Type Options

/dev/sda2 / ext4 (rw,errors=remount-ro,commit=0)
/dev/sda5 /media/82E47108E4710029 fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_ permissions)


=========================== sda2/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
if [ ${recordfail} != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.0.0-16-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
linux /boot/vmlinuz-3.0.0-16-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.0.0-16-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-16-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
echo 'Loading Linux 3.0.0-16-generic ...'
linux /boot/vmlinuz-3.0.0-16-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.0.0-16-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 3.0.0-15-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
linux /boot/vmlinuz-3.0.0-15-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.0.0-15-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-15-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
echo 'Loading Linux 3.0.0-15-generic ...'
linux /boot/vmlinuz-3.0.0-15-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.0.0-15-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-12-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
linux /boot/vmlinuz-3.0.0-12-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.0.0-12-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-12-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
echo 'Loading Linux 3.0.0-12-generic ...'
linux /boot/vmlinuz-3.0.0-12-generic root=UUID=decd6497-7f52-4686-a1a7-a759b54577fd ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.0.0-12-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root decd6497-7f52-4686-a1a7-a759b54577fd
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_Custom ###
Adding Windows XP
menuentry "Windows XP" {
set root=(hd0,1)
chainloader (hd0,5)+5
}
### END /etc/grub.d/40_Custom ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda2/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=decd6497-7f52-4686-a1a7-a759b54577fd / ext4 errors=remount-ro 0 1
# swap was on /dev/sda4 during installation
UUID=68ebea21-5b60-4bdc-8282-ed03250223eb none swap sw 0 0
--------------------------------------------------------------------------------

=================== sda2: Location of files loaded by Grub: ====================

GiB - GB File Fragment(s)

= boot/grub/core.img 1
= boot/grub/grub.cfg 1
= boot/initrd.img-3.0.0-12-generic 3
= boot/initrd.img-3.0.0-15-generic 1
= boot/initrd.img-3.0.0-16-generic 2
= boot/vmlinuz-3.0.0-12-generic 1
= boot/vmlinuz-3.0.0-15-generic 1
= boot/vmlinuz-3.0.0-16-generic 1
= initrd.img 2
= initrd.img.old 2
= vmlinuz 1
= vmlinuz.old 1

=============================== StdErr Messages: ===============================

unlzma: Decoder error
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in

darkod
February 25th, 2012, 09:31 PM
You are right, it is logical. How did it let you install there? I guess one of those things that windows does.

You have few options:
1. If there is no important data inside XP, boot ubuntu, open Gparted and delete /dev/sda5 then /dev/sda3. That will leave the space as unallocated.
Then boot with the XP cd and install again into the same space, but this time creating a primary ntfs partition from that unallocated space with the XP installer.
After that restore your grub2 on the MBR with:
http://ubuntuforums.org/showthread.php?t=1014708

2. If you don't want to reinstall XP, you can change the partition into primary with fixparts:
http://www.rodsbooks.com/fixparts/
But note that XP didn't save the boot files, I guess because the partition was logical, so after changing it to primary you still need to repair the boot. You should be able to use the above link about bootloaders, it has instructions for XP too. Also you might need to set the boot flag on /dev/sda3 (the new converted primary partition) with Gparted.
After you fix the XP boot again you need to restore grub2 with the bootloaders link.

oldfred
February 25th, 2012, 09:34 PM
Added code tags to make it a bit easier to review boot scripts results.

We also are confused. As Darko said Windows will not install to sda5. Did you have another copy of Windows before you install Ubuntu and deleted that Windows. Windows will only boot/install/repair the active partition or the one with the boot flag. Windows also does not see Linux partitions and grub does not use a boot flag. So boot flag on sda2 was from an old Windows??

Your swap also looks to be about the same size as your NTFS partition. Is that correct? And the NTFS partition in sda5 does not show any boot files. If it was/is an install then the boot files were in the active NTFS partition that you deleted.

abpriest
February 26th, 2012, 01:52 AM
Oh my goodness. I completely forgot that I originally was dual booting Vista and XP because I wasn't sure which one would work best on this machine. I'm sorry I forgot about that detail. I deleted the Vista partition and installed Ubuntu to that partition.

I might just delete the windows partition and install Win XP again. Or forget the XP install altogether.

Thanks for all your help!

abpriest
February 26th, 2012, 03:59 PM
One more thing. I do have a swap partition of 7.45GB. Should I resize that? I am not sure why I choose that size?

darkod
February 26th, 2012, 04:15 PM
You can. Usually 2GB is enough for swap, unless you want to hibernate in which case you need minimum 1.5 x RAM size.

If you decide to shrink it, boot with the cd in live mode, open Gparted, right-click the sda4 and select Swapoff. That should remove the keys symbol from sda4 (locked).
After that you can resize it, and make sure you move the end border so that the new unallocated space will merge with sda5/sda3 when you deleted it. In this space you can install XP.

You also have the option to change sda5 to primary partition with fixparts as I suggested earlier.

PS. I just noticed that you are not using a big part of your hdd in fact. Look in the results in the fdisk results. Between the end of sda4 (sector 54,767,615) until the start of sda3 (sector 430,172,566) that is almost 185GB of space unallocated and unused. You really need to sit down and plan your hdd to use it better. With a new installation of XP you can give all that space to XP but the question is do you want to use that much for XP.

oldfred
February 26th, 2012, 04:23 PM
As Darko suggests planning hard drive allocation in advance is worthwhile.

But there are some workarounds if you want. I have seen instructions on how to repair & make XP boot from a logical. There is a program to convert logical to primary within the rule of only 4 primary partitions. You should then also convert the swap to logical. Either of these alternatives does not leave drive well organized. But if interested post back.

abpriest
February 26th, 2012, 05:04 PM
Yes. There is a large amount of unallocated space because I was trying to decide how to use it. Let's say I delete the windows partition and resize the swap space. I've decided that, though I wanted to fix this issue (it was just bothering me that it was not working), I really have no use for windows on this computer. My wife and kids were used to windows, but since it has not been working they've become accustomed to ubuntu. Any suggestions on how to allocate this space? Should it be one large ext4 partition or does it help to divide it in some way. I have just begun to use ubuntu on this machine. There are no important files or settings here. I could still re-install the whole thing from scratch.

darkod
February 26th, 2012, 05:10 PM
Well, if you are willing to ditch XP that gives a different angle. You could install ubuntu on the whole disk, using the manual method for better control. You would need to create / and swap partition, and separate /home is optional but recommended.
So it would be something like:
primary ext4 partition, size 15GB, mount point /
primary ext4 partition, size X GB, mount point /home
logical swap partition, size 2GB or 1.5 x RAM if you use hibernate, doesn't use mount point

Take note that 15GB + X + 2GB (or 1.5 x RAM) should give you the total of your disk.

That's it.

You can also fit XP in there on a primary ntfs partition with the size you feel appropriate for your XP use. We can't make the decision for you really. :)

abpriest
February 26th, 2012, 05:25 PM
What is the advantage of putting /home on its own partition. I've seen that in different places, but I wasn't sure what the purpose is.

darkod
February 26th, 2012, 05:33 PM
As you are probably aware, eevry user has its home folder inside /home.
But there are two different approaches.
1. If you only have the standard / + swap install, Home is a folder inside / and the total path is /home.
2. If you have a separate partition mounted at /home, the total path is again /home but this partition is separate from /.

In future, you can do a clean install of new ubuntu version (not upgrade), format the / partition and tell it to use the /home partition again with mount point /home but without formatting and all the data for all the users inside their Home folder is there.

Plus many settings that you don't see because they are in hidden folders, like your firefox profile for example. Your favorites and browsing history will be there without even making a backup and restore during your clean install of new ubuntu.

You only have to be careful NOT TO FORMAT IT when doing the new install. Ask first if you are not sure how to use an existing partition in linux and without formatting it.

The equivalent in windows would be when you have your system C: partition, and another D: partition for guarding data. In clean install you can format C: as much as you want, but unless you format D: also your data is always there.

But the auto methods of ubuntu only create the / + swap setup. For anything different (like having a separate /home) you have to use the manual way, called Something Else in the latest version installer.

oldfred
February 26th, 2012, 05:34 PM
The main advantage is when you upgrade to a new system, you can do a clean install and still preserve all your user settings & files by also mounting the old /home as part of the install but not reformating it.

Many of us have had issues with upgrades in place, although many have done it and it usually works. It is just a clean new install starts fresh and is an automatic houseclean of old system files.

You can still upgrade in place with the separate /home, but cannot do a new clean install with /home inside the / (root) system. Of course either way you should be backing up /home so you could restore it if necessary.

abpriest
February 26th, 2012, 06:50 PM
Well, oldfred and darkod, this has been an enlightening discussion. Thank you both for your time. (http://ubuntuforums.org/member.php?u=852711)