# Vista/XP/Ubuntu Triple-boot problems



## deuce (May 26, 2001)

Hi, I'm having trouble triple-booting Vista, XP and Ubuntu.

Usually there is a ton of information available to solve most linux problems on the internet, but I haven't found anything that helps me here. I have been working on this issue all day...so here goes...

First off, these are the OS details:
Vista Home Premium 32-bit
XP Pro 32-bit
Ubuntu Fiesty Fawn 64-bit (using low latency kernel)

They were installed in this order:
1.) Ubuntu
2.) Vista
3.) restored grub

4.) let lots of time elapse

5.) XP
6.) restored grub


(it is possible that Vista was installed before Ubuntu, but I'm 99% sure I installed Ubuntu, then Vista--and obviously, XP last)

****

On my notebook, I was dual-booting Vista and Ubuntu with grub since Vista was released and had no issues with that.

However, no version of Pro/E works with Vista (it needs openGL) and the copy I have only works with 32-bit windows--so without access to Pro/E on my notebook I finally broke down and tried to install XP last Sunday.

****

XP installed fine and until I restored grub, XP would load directly on boot.

I restored grub today, but I can not boot Vista. Ubuntu will boot and XP will boot.

****

This is my setup: (the periods are for readability)

Gateway notebook
160 GB SATA HD:

/dev/hda1 ...... ext3 ............ 80.00 GB (Ubuntu--Fiesty, Primary part.)
/dev/hda2 ...... linux-swap ..... 2.00 GB (Primary)
/dev/hda3 ...... ntfs ............. 20.00 GB (Vista, Primary)
/dev/hda4 ...... extended ..... 47.03 GB
. /dev/hda5 .... ntfs ............. 40.00 GB (XP, Logical)
. /dev/hda6 .... fat32 ............. 7.03 GB (data, Logical)

****

Before installing XP, I had the same setup except the 40 GB ntfs partition was for data.

So as I mentioned, I have restored grub.

This is the relevant grub info:


#### 
title .............. Ubuntu - lowlatency
root ............. (hd0,0)
kernel .......... /boot/vmlinuz-2.6.20-15-lowlatency root=UUID=42114503-d7d9-4d03-b751-142a325003ce ro quite splash
initrd ............ /boot/initrd.img-2.6.20-15-lowlatency
quiet
savedefault

title .............. Vista
root ............. (hd0,2)
makeactive
chainloader ... +1

title .............. XP
root .............. (hd0,4)
makeactive
chainloader ... +1
####

In grub, when trying to boot an OS, all of the above OSes are listed, plus the utility os stuff. 

When I choose XP I get an error:

error 12: invalid device requested

When I choose Vista, it boots XP. This is pretty weird, as if you will notice the Vista option is set to (hd0,2) and Vista is physically hd0,2 and XP is physically hd0,4


****

Sorry for the complexity of this post. To recap:

Vista/Ubuntu dual boot was fine

XP was installed on a logical partition

grub has been restored

Ubuntu boots

XP boots, but only when you choose the Vista option in grub

Vista DOES NOT boot


I need to get grub fixed or whatever the issue is so that I can boot Vista, Ubuntu and XP. (The XP install is only for Pro/E, so all there is on it is XP install files and Pro/E files, and that is all that will ever be installed)

I thought that installing XP on a logical partition (instead of a primary partition) would be a problem, but it doesn't seem to be an issue. (unless that fact is screwing with Vista) Since you can only have 4 primary partitions and since I never anticipated having to install XP, I didn't have much of a choice on the configuration of the partitions. I would prefer not to change it, as that will be a major hassle and I will not have access to disks such as partition magic until Sunday or Monday. I do have a desktop running XP 64-bit and I also have a USB 2.5" HD enclosure, so I can if it were really necessary, access the gateway HD on my desktop for ease of reconfiguring partitions.


I have no idea what to do now, so any help is greatly appreciated. Please ask if anything needs to be added or clarified.

Thanks!




****
EDIT
****

I forgot to mention: I do have a full disk backup of my notebook, last backed up a few days before installing XP, on my desktop. Best case scenario though is not using it, as I won't have access to it for a few days and the 80 GB ext3 partition is a pain to backup/restore (takes all day)

****
EDIT
****

If I try and hide the XP partition in order to try and boot the Vista partition, the XP partition still boots but then restarts just after the splash screen

grub> unhide (hd0,2)

grub> hide (hd0,4)

grub> rootnoverify (hd0,2) 

grub> chainloader +1

grub> makeactive

grub> boot


----------



## Het Irv (Sep 30, 2007)

Vista has problems if you install it after another OS. Go Figure. If you can backup your data and reinstall in this order
1. Vista
2. Xp
3. Ubuntu


----------



## saikee (Jun 11, 2004)

I have been playing with the same three systems plug a few more in a15-partition Sata.

In my case I installed XP and Ubuntu before Vista. Vista, in sda2, therefore dumped it bootmgr on the XP sda1 partition. I didn't like it so I broke the link and separated the two M$ boot loaders.

Here is the method that got me through

(1) I used Grub to hide XP in sda1. Its partition type 7 becomes 17. Vista obviously didn't boot. So I booted up Vista installation DVD and opted for "repair". Vista installation DVD found bootmgr missing and copied the program across. It rebooted twice and I got Vista working again. The repair did not overwrote Grub which is in the MBR.

(2) I then used Grub to hide Vista sda2 partition and unhide XP partition sda1. Same thing again by booting XP installation CD, which recognised only the XP partition, I repaired it in recovery console with command "fixboot" and "fixmbr".

(3) I found XP didn't boot successfully and seemed to get stuck at somewhere. So I booted up Slax, which let me log to the desktop as root, had ntfs-3g pre-loaded and every ntfs partition automatically mounted. I used Slax to delete the bootmgr and renamed \boot to another name inside the XP partition. On a reboot XP work again.

I now have all systems firing in every cylinder. Here is the Grub menu.lst hosted in sda6 by Ubuntu (therefore I cannot chainload Ubuntu)

```
title                   [B][COLOR="Red"]xp pro @ sda1[/COLOR][/B]
root                    (hd0,0)
unhide                  (hd0,0)
hide                    (hd0,1)
makeactive
chainloader     +1

title                   [COLOR="Blue"][B]Vista  @ sda2[/B][/COLOR]
root                    (hd0,1)
unhide                  (hd0,1)
hide                    (hd0,0)
makeactive
chainloader     +1

#sda3 is an extended partition

#sda5 is the swap common to all Linux

title          Ubuntu, kernel 2.6.20-16-generic @ sda6
root           (hd0,5)
kernel         /boot/vmlinuz-2.6.20-16-generic root=UUID=80db91a1-b3f2-42b2-b3a2-9cb6e5f71b8b ro quiet splash
initrd         /boot/initrd.img-2.6.20-16-generic

title                   Puppy 2.1.4 @ sda7
root                    (hd0,6)
kernel                  /boot/vmlinuz


title           Mepis 6.0.4 @ sda8
root            (hd0,7)
chainloader     +1

title           Slax 6.0.0 @ sda9
root            (hd0,8)
chainloader     +1

title           FC6.93 @ sda10
root            (hd0,9)
chainloader     +1

title           Debian 4r0 @ sda11
root            (hd0,10)
chainloader     +1

title           Yoper 3.0rc1 @ sda12
root            (hd0,11)
chainloader     +1

title           DSL 3.4 RC1 @ sda13
root            (hd0,12)
chainloader     +1

title           Empty @ sda14
root            (hd0,13)
chainloader     +1

title           Puppy 3.0 @ sda15 
root            (hd0,14)
chainloader     +1
```
Please take note how I hide one MS system when booting another MS system. The "makeactive" command is mandatory because a booting MS system must be active (or bootable in Linux term).

I prefer the above way of having NTLDR inside XP and bootmgr inside Vista. That way it is easier to maintain. Just by hiding one MS system I can access the other.


----------



## deuce (May 26, 2001)

Thanks for the responses.

I did eventually figure out yesterday that installing XP after Vista wiped out the Vista boot loader and that it needs to be restored.

I don't have my Vista DVD with me, but tomorrow I will. However, is there any way to restore the Vista boot loader without the Vista insall DVD? Any third party apps? I guess I really just need to be patient and use the DVD...

Saikee: After you restored the Vista boot loader, was restoring the XP boot loader with the CD really necessary? Wouldn't that undo the restore work you did on Vista? It seems like that would be just like installing XP which wiped out the Vista boot loader in the beginning...

By hiding and unhiding the corresponding Windows installs in grub are you able to boot each OS "directly" by chainloading from Grub? Did you need to work around chainloading into the Vista boot manager and choosing XP or Vista?

Anyway, the first plan is to restore Vista. I'll let you know how that goes.

****

Does anyone know why, on my setup, pointing to the Vista partition boots XP and pointing to the XP partition gives an invalid device error? Shouldn't pointing to the Vista partition fail to boot Vista and pointing to the XP partition boot into XP?

As I mentioned, if I make root (hd0,2), which _is_ the Vista partition, it boots XP. This makes a little sense since the Vista boot loader has been wiped and the old ntldr can't see Vista, and I guess ntldr takes over and boots XP from (hd0,4), which _should_ be the XP partition.

BUT--if I hide (hd0,4) and make root (hd0,2), it _still_ boots XP. If the XP partition is hidden is it not the case that XP should never boot? It's partition is hidden...this doesn't make sense. If a partition is hidden, should it not be accessible ever, until it is unhidden?

If I go to a command line, and:

hide (hd0,2)
unhide (hd0,4)
root (hd0,4)

>everything is good so far<

As soon as I makeactive it gives the error 12: invalid device requested error. If fact, whenever I root (hd0,4) I'll eventually get that error.

####

Alternatively, if I go to a command line and:

hide (hd0,*2*)
root (hd0,*2*)
makeactive
chainloader +1
boot

>it successfully boots into XP, and explorer can't see the Vista partition. How can it boot anything if you hide the partition that you make root, even if it really isn't booting from there? (Because XP is physically hda5)

####

if I:

hide (hd0,*2*)
hide (hd0,*4*)
root (hd0,*2*)
makeactive
chainloader +1
boot

>it loads the XP splash screen, then tries to run autochk, says it isn't found, then says that it is skipping autocheck and reboots. If I hide only (hd0,4)--and not both (hd0,4) and (hd0,2) it boots into XP.

I should have just ran XP off of a virtual machine in Ubuntu...would have been less of a hassel.


----------



## saikee (Jun 11, 2004)

Vista broke the tradition of having its own MBR (prior to that Dos to XP has a common MBR) and need the installation DVD to repair its boot loader.

In my case my Vista's boot loader was in XP partition so its boot loader bootmgr was inhibitating XP's NTLDR from working. The only way I disable bootmgr was to delete it and rename the \boot directory, so that NTLDR can work on its own to fir up XP. Your case is opposite to mine so may be a different tactic is needed. The way I did it was to isolate each system by hiding the other system so that I dealt with one MS system at a time.

Both XP and Vista can be booted by Grub (or Lilo) in the exactly the same way a Linux boots a Windows, i.e by chainloading.

MS systems must be booted by one of its boot loaders. The first system takes up the "C" drive and will be detected by the second system. It is therefore necessary to offload the boot loader of the 2nd system into the first MS system partition. In your case therefore Vista has the boot loader that boots both systems. The XP is dependent on Vista and can't boot itself, until you "fixboot" and "fixmbr" it. Hope it makes sense to you. However placing XP in a logical partition may have complication.

(hd0,4) is a logical partition and making it active has no effect as a MS system does not boot directly from a logical partition, indirectly may be.

It looks like the M$ boot loader is in (hd0,2). This partition is bootable by Grub because Grub does this by chainloading. It simply drops away everything from the 2nd sector onward and pastes itself with the boot loader (in the boot sector) of (hd0,2), staring from the +1 position or the 2nd sector. That apparently fired up the XP indirectly in (hd0,4).

Unlike a M$ system, which does not mount a partition it does not supports, Linux can see any hidden partition and can work with it. It detects its filing system by its structure. That is why we can mount a partition without specifying the filing type in a modern kernel. 

I predict you may have a problem of getting XP to boot off itself from a logical partition. XP in (hd0,4) needs a MS boot loader installed in a primary partition to achieve this.

---------------------------------------------------

If you have to reinstall XP it is better to hide the Vista partition first and install XP in a primary partition. The MBR of XP (and Vista too) boots any of the 4 primary partitions with the booting flag switched on and does not care what is inside. I have used this property to make a Windows MBR to boot up Grub by installing Grub in a active primary partition.


----------



## deuce (May 26, 2001)

Ok, so repairing the Vista install fixing the vista booting option. (obviously)

I'm still getting the invalid device error when trying to boot XP.

I understand what you are saying about not being able to boot from a logical partition--I thought that would be a problem, but as I saw when Vista's boot manager was over-written XP booted off the logical partition just fine.

If I were to reinstall XP I don't think I could get it onto a primary partition. I need at least 5 partitions, and ext3, swap and vista all need primary partitions, and I need the 4th primary partition for the extended partition.

Could you explain in a little more detail your possible fix for booting XP off the (hd0,2) partition?



> It is therefore necessary to offload the boot loader of the 2nd system into the first MS system partition. In your case therefore Vista has the boot loader that boots both systems. The XP is dependent on Vista and can't boot itself, until you "fixboot" and "fixmbr" it. Hope it makes sense to you. However placing XP in a logical partition may have complication.


----------



## saikee (Jun 11, 2004)

I have come across Internet information that users can hack the M$ MBR code to make a stand-alone M$ system boot from a logical partition. I prefer everything standard and value the knowledge of using a system within its limit and capacity. Thus I can't help you on that front. You have to Google if you decide to try this type of solution.

Personally I never put a Linux or its swap in a primary partition as these two can be anywhere in the hard disk and there are far more OSes needing the primary partitions.

Thus my approach to your current problem would be


Disable Vista security check tempoarily
Move Ubuntu temporarily into another disk
Delete hda1 and hda2
Re-create hda1 and hda2 in ntfs type. Hide hda2 and hda3 (making their partition type 7 to type 17)
Reboot and install XP in hda1 and have it working as a stand alone system.
Reboot with Ubuntu Live CD, delete hda5, recreate hda5 (type 82 for swap) and hda6 (type 83 for Linux), thereby pushing old fat32 hda6 to become hda7.
Reboot and format hda6. Move Ubunu back to hda6
Edit Ubuntu in hda6 to become bootable
Edit Ubuntu Grub to boot all other systems
Plan future use for hda2
Steps in details

(1)	Boot up Vista in hda3 and disable its security check. That should silence it seeing changes in the partition table.
(2)	Get hold of an external hard disk with size big enough to store Ubuntu information. A recently installed Ubuntu in hda1 should be about 3Gb. I would check its size first by a boot-up Ubuntu in the Live CD, create external disk partition say sdb1, format it in Ext3, mount hda1 and sdb1 on /mnt and move the content of hda1 into sdb1 by command in root console

```
cd /mnt/hda1
tar cf - . | (cd /mnt/sdb1; tar xf -)
```
(3) Use cfdisk program in Ubuntu Live CD to delete hda1 and hda2. Recreate hda1 and hda2 say equal size of 40Gb each, which will be automatically Type 83 so use "Type" to change them to Type 7 for ntfs for hda1, type 17 for hda2, hda3 and hda5. Vista and XP are temporarily unbootable in hda3 and hda5. Write the partition table and quit cfdisk.
(4)	Reboot and install XP into hda1. Have it in working order. MBR temporarily occupied by XP's NTLDR.
(5)	Reboot Ubuntu Live CD, use cfdisk now to delete hda5 (previous with a XP) and recreate in its space hda5 (1Gb) and hda6 (balance of remainder about 39Gb). Change hda5 to type 82 for swap. Any partition created in cfdisk is type 83 already suitable for Linux installation.
(6)	Reboot and format hda6 in Ext3. Hook up external hard disk and move the original Ubuntu back to hda6 by command

```
cd /mnt/sdb1
tar cf - . | (cd /mnt/hda6; tar xf -)
```
(7) Edit /mnt/hda6/boot/grub/menu.lst and /mnt/hda6/etc/fstab to change the partition reference from hda1 to hda6. The original swap partition hda2 should be changed to hda5 too in fstab. Then invoke a Grub shell in Ubuntu Live CD to put Ubuntu's Grub in hda6 into the MBR

```
grub
Root (hd0,5)
Setup (hd0)
Quit
```
(8) Reboot. If Ubuntu working normally edit its Grub to boot all other systems. Hide Vista when booting XP and hide XP when booting Vista.
(9) The above solution leave you with an empty hda2, of about 40Gb large for the future use. You can vary the size of hda1 and hda2 but I would recommend to leave hda2 in its place because if hda2 if deleted the space will be "dead" and only usable by expanding hda1 or hda3.

If you use a modern Ubuntu it would call hda as sda because Pata disk in 2.6.20 and new kernel no longer support Pata disk device names (may be temporarily during the interim period)

New Ubuntu uses the by-uuid method to call a partition but that you override it with the normal device name like /dev/hda6 in menu.lst and fstab.

Let us know if you have any problem on the above approach, which I prefer working within each system standard characteristic to illegally hacking the operating system code. May be it is just me I thought a guy with hair as black and thick as Tom Cruise should not fancy the hair style of Telly Savalas.


----------

