IT Intern Blog

IT Challenges Solved

Archive for August, 2009

Multi-Boot with Windows 7, Vista and XP

Posted by IT Intern on August 6, 2009

Yesterday I got a ticket to add a Windows 7 installation on a new partition on one of our 64 bit testing machines that currently runs both XP and Vista. Win7 installed just fine, but it got rid of the option to boot into XP, and it took me almost 2 full days to figure out how to get it back! I’m telling the tale here of all the tries-and-errors I went through before finally getting it to work.

* If you’re not interested in the entire tale then click here for a summary of what worked.

I began by repartitioning one of the drives using Vista’s “Shrink” option in Disk Management. I then rebooted from my Win7 installation disc to install on the new partition. All went well until I rebooted after Win7 was installed and the boot loader only gave me the options to boot into Vista or Win7. XP was gone.

I did some searching and found it was a common occurrence, and started out trying a free tool called EasyBCD to get the XP entry back. It added a new entry for XP and the entry showed up when I rebooted, but when I selected it I got an error that said “the file \NTLDR could not be loaded because it is either missing or corrupt” and recommended I repair XP.

After I had installed Win7, I noticed something interesting: XP was originally on the C: partition and Vista on the E: partition. I installed Win7 on the new F: partition, but Win7 renamed them all, so that XP is now on F: and Win7 is on C:. However, looking at the Disk Manager in Vista still shows the original configuration, with XP on C: and Win7 on F:.

As the error message suggested, I inserted the XP disc and ran Recovery Console, where I was surprised to see the following options:
1: D:\WINDOWS
2: C:\Windows
3: E:\Windows

I ended up figuring out that XP was on number 1, the D: drive (and from what I’ve learned I now suppose C: to be Win7).

I selected 1, then tried running fixboot, first on C: and then on D:, restarting each time. Both times it gave me the same NTLDR error message, with no options except to restart.

At this point I couldn’t get into any of the OS’s, so I booted from my Win7 disc and chose repair. It brought back my Vista bootloader with the bad XP entry. I deleted the XP entry with EasyBCD and decided to try using bcdedit.exe instead. After searching around for bcdedit help I finally found this: http://technet.microsoft.com/en-us/library/cc721886%28WS.10%29.aspx#BKMK_bcdedit

To install a previous version of Windows onto a computer running Windows Vista
1. Install the previous version of Windows.
2. Log on to the older operating system and restore the latest boot manager by running the following. Fixntfs.exe will be in the \boot directory of the active partition.
fixntfs /lh
3. Create a BCD entry for the older operating system by specifying the following. Bcdedit.exe is located in the \Windows\System32 directory of the Windows Vista partition. Description is the description of the new entry for the older operating system.
Bcdedit /create {legacy} /d “Description”
Bcdedit /set {legacy} device boot
Bcdedit /set {legacy} path \ntldr
Bcdedit /displayorder {legacy} /addlast
4. Restart the computer in order for the changes to take effect.

Although XP was the original installation, I thought this may work. I skipped step 1 (obviously), and for step 2 went into the Recovery Console from the XP CD.

From here, the \boot directory was “access denied”. ATTRIB didn’t work on it, so I couldn’t access the fixntfs file. I rebooted to Vista and browsed the C: drive (which is where Vista sees the XP installation). I looked in \boot ( I had to access the folder by typing the path in the address bar), and fixntfs.exe was not even there. So I downloaded it from http://forum.osnn.net/attachment.php?s=7e7a81fa0b57c9cceb78aa2e1f8f55f6&attachmentid=7473&d=1147018827, pasted it into the C:\boot folder (as well as C:\ and C:\WINDOWS just in case), and rebooted back into Recovery Console.

I tried to run it from different locations with every possible syntax, but it always came back with “the command is not recognized.” So I decided to try booting back into Vista and running it from there. Double-clicking it looked like it ran, and no errors came up, but nothing else happened either. C:\NTLDR was still not listed, so I typed in C:\NTLDR in the address bar and a “Open With” dialog came up asking me which program to use to open the file. So something was there. I decided to proceed with the next 2 steps from within Vista.

I went to the Vista icon > All Programs > Accessories > Right-Click on Command Prompt and chose Run as administrator.

I typed the first command and got the message “The entry {ntldr} was successfully created.
Next three commands came back with: “The operation completed successfully.

Sounded good to me. Restart. XP was now back in the boot list, but when I tried to load it I got the same “missing or corrupt” message from Windows Boot Manager.

I found this website http://tinyempire.com/notes/ntldrismissing.htm and decided to give his boot cd a try. I downloaded the 64-bit version .ISO and burned it to a CD. Booting from the CDROM took me straight into Windows XP. The files I needed, however, were not on the .ISO, so I also downloaded the 64ntfile.zip from that website to get good copies of ntldr and ntdetect.com. I copied those into C:\ and restarted (I did not want his copy of boot.ini so I kept what I already had.)

I hoped I would see the old boot manager screen, but instead I got the list from the Vista bootloader. Boo. I tried the XP entry and got the error again, so I rebooted with the CD to get back into XP. I opened the Disk Manager and marked the C: partition as active (the F: partition, which has Windows 7, was the active one, and D: is the CDROM, as it should be, although in the Recovery Console it finds the XP installation on D:. This is so weird.)

I crossed my fingers and restarted.

Hmm, strange. This time before it even got to the boot list I got “A disk read error occurred. Press Ctrl+Alt+Del to restart.” I had left the boot CD in the drive, so I removed it and tried again. Same error. I put the CD back in and rebooted from it, and changed the Win7 (F: ) partition to be active again, and restarted.

It brought up the good ol’ Vista bootloader. This time I booted into Win7, just for kicks (actually, since the newly assigned drive letters only show up in Win7, I hoped I’d have better luck getting the right files on the right partition from there).

Aha! Inside Win7, XP was shown to be on the F: partition, although it’s listed on the D: partition when I run Recovery Console from the XP disc. I went back into the console (run as administrator) and ran bcdedit.exe. When I first did those steps above from the Microsoft website, I wasn’t happy with the line
Bcdedit /set {legacy} device boot

“device boot”? The others have the device set to a partition, like this

device partition=C:

so I wanted to change legacy’s device from boot to partition=D:, so I issued
Bcdedit /set {legacy} device partition=D:

No luck. It said: “An error has occurred setting the element data. The request is not supported.

I was sure my syntax was correct, so I don’t know why it’s not supported. I decided to delete the entry with
Bcdedit /delete {legacy} /f

Running bcdedit again listed only the Win7 and Vista options. I made a new one, this time using the following:
Bcdedit /create {legacy} /d “Windows XP”
Bcdedit /set {legacy} device partition=D:

I had to stop here because I got the same error. Maybe D: is not a valid drive letter for a partition? Instead I tried:
Bcdedit /set {legacy} device partition=F:

And it worked! F: is where Win7 thinks XP is, but the Recovery Console thinks it’s on drive D:… so I wasn’t sure if this would *actually* work. But I finished the last two steps:
Bcdedit /set {legacy} path \ntldr
Bcdedit /displayorder {legacy} /addlast

Restart.

Well, not entirely failed… This time trying to boot XP I got the message:

Invalid BOOT.INI file
Booting from C:\windows\
NTDETECT failed

I wonder if it failed because I had to set the device to F:. I rebooted into Vista this time to take a look at bcdedit. The Win7 entry now has “device partition=F:” and Vista has “device partition=E:” Which means, of course, XP has “device partition=C:” When I tried to set XP’s device to D: it gave me the same error as before.

Since it said “Invalid BOOT.INI,” I tried editing the file, which I had to do from within XP, since it must be done from the Startup and Recovery (right-click My Computer > Properties > Advanced tab > Settings under Startup and Recovery > Edit under System Startup), which is not available in Vista. I tried editing this line (listed twice):
“multi(0)disk(0)rdisk(0)partition(1)\WINDOWS”

to
“multi(0)disk(0)rdisk(0)partition(2)\WINDOWS”

And restarted. I got the same error, so I tried “partition(0)” and it still didn’t work. After looking around some more I found
http://www.5starsupport.com/faq/booting.htm#7-9

Try this as a possible fix in Windows XP:

Boot to the XP CD. When it asks you if you want to install or Repair, choose Repair. This will take you to the Recovery console. Choose the XP install to log into, usually there’s only 1, and enter the password when prompted. For Home, the default password is blank. At the C:\Windows prompt type the following commands:

1. FIXBOOT, answer Yes
2. CD \
3. ATTRIB -H NTLDR
4. ATTRIB -S NTLDR
5. ATTRIB -R NTLDR
6. ATTRIB -H NTDETECT.COM
7. ATTRIB -S NTDETEC.COM
8. ATTRIB -R NTDETECT.COM
9. COPY X:\I386\NTLDR C:\
10. COPY X:\I386\NTDETECT.COM C:\

In steps 9 and 10, “X” is the letter of your CD-ROM drive.

so I changed the file back to the original partition(1) and went back to the Recovery Console to try the new instructions.

I chose the XP installation on D:, but when I ran fixboot from the command line, it automatically ran it on C:. I could specify drive D:, but I let it run on C:, and then ran it on D: as well. I copied the files to both C: and D:, then restarted.

Now the boot list is gone and it goes directly to XP, except it still gives me the error message
Invalid BOOT.INI file
Booting from C:\windows\

But apparently NTDETECT didn’t fail this time, because it continued booting and got me to the login screen. So my BOOT.INI was still invalid. I edited it inside XP and I noticed the line under [operating systems] had the following options at the end:
/NOEXECUTE=OPTIN /FASTDETECT /USEPMTIMER

From here http://support.microsoft.com/kb/289022 I saw that the default should have only the /fastdetect option, so I removed the others and restarted again, but I still got the error message before it booted into XP. At this point, I had no idea if it was looking for BOOT.INI on D: or C:, so I wanted to get a default copy into both to see if that worked. Since the only way I could access D: as a partition is from Win7 (both XP and Vista see it as the CDROM), I had to boot from the Win7 disc and repair again to get the Vista bootloader back. Before I did that I made a copy of the BOOT.INI file inside the Vista (E: ) drive as a .txt, just in case I couldn’t access the original.

The bootloader came up with all three options, but before testing the XP option I loaded Win7 to get copies of BOOT.INI in a few places. Browsing the computer showed me the C: drive as Win7, E: as Vista and F: as XP. If things are working as I suspect, the BOOT.INI file should be in the F: drive. Typing F:\boot.ini into the address bar popped up the file I made in Notepad. But I also needed to have a copy in the C: drive. With F:\boot.ini open, I tried Save As > C:, but I apparently don’t have permission to save files to the root folder. Good thing I made a copy. I opened up E:, copied boot.txt, and pasted it into C:. I had to turn off ‘Hide extensions for known file types”, then renamed the file to boot.ini. But I was still bothered, because in Win7, XP is shown on drive F:, where in the Recovery Console it’s on D:. So I went back to the disk manager and reassigned the drive letter so that XP is now on D:, then restarted.

Success! The Vista bootloader came up with my three options, and XP now boots perfectly.

So now what I suspect is that Win7 not only renamed its own partition to C:, but made itself the *real* C: drive as well. But all the system files for XP are also on that partition, or at least the BOOT.INI is (I edited the BOOT.INI file on the C: drive in Win7 to remove a line I had commented out, and when I tried to make the same edit on the F: drive in Win7 I couldn’t access it, so I logged back in to XP and tried editing it from Startup and Recovery as before, and it was linked to the one I had edited in Win7. So that other file is now just… floating around, inaccessible, and not being used). So both XP and Win7 are booting from the same partition, only XP switches to use its own partition once it’s booted up. A strange configuration, but at least it’s working! And if that really is the case, then XP’s boot files (boot.ini, ntldr and ntdetect.com) need only be on the C: drive, and not on the XP partition. It also shouldn’t matter what letter the XP partition is assigned, but I’m going to leave everything as it is now.

In case you didn’t want to read my trying tale of figuring this all out, I have included a summary of only the steps that (I think) made everything work, since I went through a lot of redundant steps, and some of the stuff I tried didn’t seem to affect things at all. I didn’t try this summary of steps, so it may be missing something – you have been warned.

Summary of (perceived) Contributing Steps to Make a Multi-Boot Box with Windows 7, Vista and XP:

Assumed: You already have XP and Vista working on your machine, on separate partitions of a single drive.

From within Vista, create a new partition by shrinking an existing partition and formatting the new space. Reboot from Win7 installation disc, and install Win7 on the new partition.

From within Win7, open the command line as administrator, and run bcdedit. You should see two entries, one for Win7 and one for Vista. Issue the following:
Bcdedit /create {legacy} /d “Description”
Bcdedit /set {legacy} device partition=X:
Bcdedit /set {legacy} path \ntldr
Bcdedit /displayorder {legacy} /addlast

where Description is what you want XP to be called in the boot list, and X: is the drive letter on which Win7 shows your XP installation. If the partition happens to be D: or some other that bcdedit won’t let you assign, go into the Disk Manager in Win7 and reassign the drive letter for XP’s partition, then reissue the command with the new drive letter.

Reboot using the XP disc, and go into Recovery Console. The installation you should choose has X:\WINDOWS in all caps. You can verify this is the XP installation by issuing
CD \
DIR

and verifying the folder “Documents and Settings” exists.

From there issue the following:
1. FIXBOOT, answer Yes
2. FIXBOOT X:, answer Yes
3. CD \
4. ATTRIB -H NTLDR
5. ATTRIB -S NTLDR
6. ATTRIB -R NTLDR
7. ATTRIB -H NTDETECT.COM
8. ATTRIB -S NTDETEC.COM
9. ATTRIB -R NTDETECT.COM
10. COPY Z:\I386\NTLDR X:\
11. COPY Z:\I386\NTDETECT.COM X:\
12. COPY Z:\I386\NTLDR C:\
13. COPY Z:\I386\NTDETECT.COM C:\
where Z: is the letter of your CD-ROM drive, and X: again is the XP installation. I have duplicated the steps for both drives because I’m still not exactly sure which one worked.

Reboot from the Win7 disc again, and choose Repair. Select Startup Repair, and log back into Win7.

In Win7, open Computer and browse to X:\boot.ini (again, X: is the drive where Win7 thinks XP is located).

The file should open in Notepad, and should look similar to this:

[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” /fastdetect

If there are any other entries under [operating systems], delete those lines so that you have a default file just as above (leaving the partition number as it is).

Use “Save As” to make a copy on the Desktop (or somewhere else… we want it in the C: drive, but Win7 will not allow you to save there). Save it as boot.txt.

Copy the boot.txt that you just saved and paste it into C:\. Now rename the file to boot.ini (you will have to turn off “Hide extensions for known file types” in order to change the extension).

Now reboot and you should see all your options in the boot menu. Select XP and it should boot with no problems.

I did not test these steps; I have only listed the steps out of everything I tried that seemed to contribute to the working solution. If you run into any errors, retrace my original steps to see if there’s anything else you need.

Posted in Windows | Leave a Comment »