Adding Windows XP to Grub [SOLVED]

Archived topics about LMDE 1 and LMDE 2
Locked
racefan20
Level 1
Level 1
Posts: 17
Joined: Mon Apr 30, 2012 2:15 am

Adding Windows XP to Grub [SOLVED]

Post by racefan20 »

I recently installed LMDE 201204 on my main hard drive along side WXP, thinking that I was going to be able to dual boot, but for some reason WXP does not show up in the menu as a boot option. I did some searching but not sure which solution is right to fix this issue and I don't want to take the chance of screwing it up without seeking advice first.

I ended up installing Mint on an extended partition because I didn't see any other way of doing it at the time so I am not sure If this is part of the problem. I did manage to partition it so that I have root, home and swap, but I eventually would like to get rid of WXP and use this as a Linux only box :)

Here is the results from the Boot Info Script for the boot drive. Any help/suggestions on how to get WXP added to the grub menu is appreciated.

Code: Select all

Boot Info Script 0.61      [1 April 2012]

============================= 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 (,msdos6)/boot/grub on this drive.
 => Windows is installed in the MBR of /dev/sdb.
 => Windows is installed in the MBR of /dev/sdc.
 => Windows is installed in the MBR of /dev/sdd.

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows XP: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows XP
    Boot files:        /boot.ini /ntldr /NTDETECT.COM

sda2: __________________________________________________________________________

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

sda5: __________________________________________________________________________

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

sda6: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Mounting failed:   mount: /dev/sda6 already mounted or sda6 busy

sda7: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  
    Boot files:        

sda8: __________________________________________________________________________

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

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

Drive: sda _____________________________________________________________________

Disk /dev/sda: 150.0 GB, 150039945216 bytes
255 heads, 63 sectors/track, 18241 cylinders, total 293046768 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    41,945,714    41,945,652   7 NTFS / exFAT / HPFS
/dev/sda2          41,945,715   293,025,599   251,079,885   f W95 Extended (LBA)
/dev/sda5          41,945,778    50,331,644     8,385,867   7 NTFS / exFAT / HPFS
/dev/sda6          50,331,708   113,242,184    62,910,477  83 Linux
/dev/sda7         113,242,248   285,201,944   171,959,697  83 Linux
/dev/sda8         285,202,008   293,025,599     7,823,592  82 Linux swap / Solaris

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

Device           Mount_Point              Type       Options

/dev/disk/by-uuid/a986207a-b093-4716-81cb-1b7bf83740a2 /                        ext4       (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
/dev/sda5        /media/Temp              fuseblk    (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/sda7        /home                    ext4       (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)


================================ sda1/boot.ini: ================================

--------------------------------------------------------------------------------
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
--------------------------------------------------------------------------------

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

xz: (stdin): Compressed data is corrupt
Not sure what this error message is all about?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
mintybits

Re: Adding Windows XP to Grub

Post by mintybits »

Hi there. Thanks for posting bootinfoscript output.
What tool did you use to repartition your disk? The problem is that your XP boot partition is in the wrong place. I think sda5 is meant to be sda1 and sda1 is meant to be sda2 and sda2 ought to be sda4 and your linux partitions ought to be sda5, 6, 7. This is a serious screw-up and non-trivial to fix.

I would use linux to back up any critical Windows files.
If you have an XP installation CD use it to try to repair the boot loader (put partition boot sector in sda1), then use Mint CD to reinstall grub.
Failing that, wipe the disk and reinstall XP and Mint.
racefan20
Level 1
Level 1
Posts: 17
Joined: Mon Apr 30, 2012 2:15 am

Re: Adding Windows XP to Grub

Post by racefan20 »

When I originally set up this hard drive it was done during a XP install. So XP was installed on a primary partition and the rest was made into an extended partition with two logical drives, one for temp files and the rest for games. I don't use this computer for games anymore so I deleted that logical drive in windows and created three new partitions for Linux with GParted during install.

Below is a screenshot from GParted to make more sense of it. My original plan was to use this install as a test run to make sure I can set it up do everything that I need and figure out/try some things etc. before I ditched XP and did a final install of Mint using the whole hard drive. But before I did that, I just wanted to load up XP to make sure there wasn't anything I needed before I gave it the heeve ho. There is nothing mission critical on there... but I just want make sure I didn't miss anything. Thanks for your help :)
HughT

Re: Adding Windows XP to Grub

Post by HughT »

try this to install the bootloader to the mbr and use grub to choose your OS at start up. From a live CD

Code: Select all

sudo mount /dev/sda6 /mnt

Code: Select all

sudo grub-install --root-directory=/mnt /dev/sda
note - there's a gap between =/mnt and /dev, and no partition number after sda
re-boot into Mint then

Code: Select all

sudo update-grub
This includes the 'os-prober' so your grub menu should include Windows.
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Adding Windows XP to Grub

Post by AlbertP »

If you installed a new OS, and your Grub is still working after that, you can just use sudo update-grub to add it there (note that it doesn't detect Windows 8 yet).
You probably have multiple distros installed? Then you might use the grub of some other distro, and need to do sudo update-grub there (or another command)
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
mintybits

Re: Adding Windows XP to Grub

Post by mintybits »

racefan20 wrote:When I originally set up this hard drive it was done during a XP install. So XP was installed on a primary partition and the rest was made into an extended partition with two logical drives, one for temp files and the rest for games. I don't use this computer for games anymore so I deleted that logical drive in windows and created three new partitions for Linux with GParted during install.
I see now. sda5 confused me because it says it's boot sector expects to be at sector 63 which is where sda1 starts. Let's assume sda1 is bootable without sda5, fine. The question is why did Grub not already add sda1 to its boot list? It should have done this when you installed Mint.
AlbertP's suggestion repeats what Mint should have done at install and is worth repeating. Another thing to try in Mint is "sudo dpkg-reconfigure grub-pc" which will allow you to check which MBR you install it to and will also run update-grub.
zerozero

Re: Adding Windows XP to Grub

Post by zerozero »

[moved here]
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Adding Windows XP to Grub

Post by AlbertP »

mintybits wrote:I see now. sda5 confused me because it says it's boot sector expects to be at sector 63 which is where sda1 starts.
Normally Windows XP has a bootsector in both MBR and its own partiion. The one in MBR (called the bootstrapper by Microsoft) should be replaced by Grub in a dual-boot environment, which is automatically done when installing Mint next to Windows. The one at the start of the Windows partition is preserved. With that one, Grub can load Windows "on /dev/sda5".
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
mintybits

Re: Adding Windows XP to Grub

Post by mintybits »

AlbertP wrote:
mintybits wrote:I see now. sda5 confused me because it says it's boot sector expects to be at sector 63 which is where sda1 starts.
Normally Windows XP has a bootsector in both MBR and its own partiion. The one in MBR (called the bootstrapper by Microsoft) should be replaced by Grub in a dual-boot environment, which is automatically done when installing Mint next to Windows. The one at the start of the Windows partition is preserved. With that one, Grub can load Windows "on /dev/sda5".
Yes. In this case the partition boot record on sda5 appears to be unusable because it thinks it is located at sector 63 and it uses absolute addressing to find Window's bootloader. So, in this case, grub will probably not be able to chainload Windows in sda5.

It's unfortunate that linux is installed without a PBR and without keeping all of Grub inside the linux partition. I presume this is because the ext format does not provide enough space for fixed-location grub boot code.
racefan20
Level 1
Level 1
Posts: 17
Joined: Mon Apr 30, 2012 2:15 am

Re: Adding Windows XP to Grub

Post by racefan20 »

A simple 'sudo update-grub' seemed to do the job. XP was recognized and added to the boot menu and now I can load it up. Thanks for the help fellas :)

Now I just need to figure out one more issue. A few months back, I replaced a hard drive in XP and made it a Dynamic Disk. Since then, I installed Mint on this computer and I now realize that Linux doesn't seem to like dynamic drives. Well, since this drive doesn't have much on it anyways, I decided that I would prefer to reformat it to ext4. My plan now that I can get into windows, is to delete the simple volumes on the dynamic drive and convert it to a basic disk as per MS's instructions, then reboot into mint and use GParted to partition the drive into 4 partitions, 1 NTFS for sharing files with W7 and 3 ext4 data partitions. As far as primary/extended drives go, what is the best way to partition this data only drive?
HughT

Re: Adding Windows XP to Grub

Post by HughT »

If you only want 4 partitions they can all be primary.
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Adding Windows XP to Grub

Post by AlbertP »

mintybits wrote:Yes. In this case the partition boot record on sda5 appears to be unusable because it thinks it is located at sector 63 and it uses absolute addressing to find Window's bootloader. So, in this case, grub will probably not be able to chainload Windows in sda5.
I don't understand what you mean. You still have a Windows bootstrapper in your MBR? If Windows is on a logical partition, you need Grub in MBR, as Windows normally can't boot from a logical partition. You can reinstall Grub in the correct location with http://community.linuxmint.com/tutorial/view/245
Or you can fix the bootsector of sda5 with the fixboot command on the Windows Recovery Prompt (fixboot C: or whatever sda5 is called like in Windows).
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
racefan20
Level 1
Level 1
Posts: 17
Joined: Mon Apr 30, 2012 2:15 am

Re: Adding Windows XP to Grub

Post by racefan20 »

Thanks HughT. I booted up XP, deleted the volumes and converted it to a basic disk. Then I booted up Mint and created four primary partitions with GParted and am in the middle of moving files over now. Wow, LMDE is so much faster than my old tired XP install, especially when it comes to browsing file folders where XP on that system was always kinda slow. No going back now.. lol.
Locked

Return to “LMDE Archive”