Triple booting: Vista – Linux – XP using Vista’s boot loader.

Ah it’s Vista again, 😀 but this entry is a bit different from my other ‘Vista’ entries. Do you know you can have a multi-boot system via the Vista boot-loader? OK yes, I am using Vista, or rather I am testing the Doofus game out on various Windows versions and Vista just happens to be one of them. No, I am not officially using it (as yet) on dev machines but since we are heavy into testing and as past experience has shown us that Vista is a pretty unreliable OS, we decided for full Vista compatibility testing this time around. However, none of the team has Vista installed on their PCs so we had to go looking for someone who has. We did find a friend with a Dell laptop who had Vista Ultimate but unfortunately the guy had long since formatted the machine and installed dual booted XP-Fedora combination. However after some fair bit of convincing and coaxing I did manage to have him share a partition on his machine for Vista.

The problem was, we had to keep the XP-Fedora working. However the Vista install overwrites the MBR so GRUB loaded into the MBR is effectively overwritten thus preventing a boot to an already installed Linux partition, and that is exactly what happened. I had initially anticipated the problem, this is not the first time I was working with multiple OS with multiple-boot options. In the past GRUB had served me well in such situations. So I was pretty confident that even if the MBR were to be overwritten, it was just a matter of reinstalling grub. That’s what I did, unfortunately it didn’t work this time around. Maybe because of some problem with chainloader, or maybe Vista doesn’t seem to like anything other than it’s own bootloader. I was unfortunately unable to find out why exactly Vista doesn’t boot via GRUB. So I tried something else, I tried booting into Linux via Vista’s boot loader and with a bit of hacking it really worked, quite nicely I must say.

How To:

OK, I know this has been covered before but most other entries I found on this topic were cryptic and rather difficult to understand. That is why I had to log the entire process somewhere and I figured the blog would be the right place.

So here’s how I did it. First, if your Boot loader is messed up, you need to fix your MBR with Vista’s boot-loader. For that throw Vista DVD into the ROM and boot into the DVD. Select “Repair” as an option when asked. Remember, don’t select “Install” by mistake. The repair window will give you a couple of options. Select “Command Prompt”. From the command prompt run

Bootrec.exe /FixBoot

and then

Bootrec.exe /FixMbr.

(Refer detailed instructions here).
Vista will automatically detect any previous windows versions and allow a boot option into them. If for some reason Vista can’t detect your previous XP or 2000 version, then you need to first use “fixboot.exe” from your XP/2000 CD and restore ntdetect and ntldr, then run the above procedure again. Once your Vista and Xp/2000 are up and bootable it’s time to relocate GRUB to a different location so that it can be used to boot to Linux. You can use grub-install if you want but I find working with grub easier, it’s up to you really. For that use the Linux live CD (any one) or use a bootable floppy having GRUB. Once the live installer is up, start a terminal as root or use sudo to start GRUB

sudo grub

Now it’s time to set the Linux boot partition. If you don’t know your Linux boot partition use the “find” command In the grub command prompt type

grub> find /boot/grub/stage1

The command will return something like “(hd0,2)”. The output may vary depending on where your Linux partitions are. The above means hard-drive 1 and partition 3. We need to set this as root and do a setup. So the commands are

grub> root (hd0,2)
grub> setup (hd0,2)

Note, use “(hd0,2)” in the setup and not “(hd0)”. The latter will install grub on to the MBR, which we do not want. With grub setup done, its time to go to Vista again. Exit grub

grub> quit

Reboot to Vista. Now it’s time to add an entry for Linux under the Vista Boot-loader. Under Vista you have a couple of options. You could use the very cryptic BCDEdit.exe which is the default boot-loader configuration manager for Vista but I can tell you it is more than difficult to understand. Instead I chose an easier path by using EasyBCD. Using the program it is rather trivial to add a Linux entry to boot menu. Remember to select the correct Linux partition, ie the partition you installed grub to. Refer the diagram below.

EasyBCD

That’s it. Your system show now boot correctly into Vista/Linux/XP. You can edit your GRUB configuration options and remove the entries for Windows. You will find them under /boot/grub/menu.lst

Leave a Reply