Wednesday, February 13, 2008

Dual-booting Vista and Ubuntu / Linux

I recently decided to fresh-install my laptop, and decided this time I'd like to have it dual-boot Vista and a Linux distro (I chose Ubuntu 7.10 after playing with it for a while, but what I write about below should work with almost any current *nix distro).

The tricky thing was that I wanted to keep using Vista Bitlocker Drive Encryption (BDE), since my laptop has a TPM and having the drive encrypted means I don't need to worry as much about having my laptop stolen and all my data being up for grabs. BDE is a bit tricky to set up at the best of times, but luckily at work we have a Remote Installation Services (RIS) server that makes it a lot easier.

So, I booted my laptop, selected a network boot, and selected the Vista Bitlocker setup from the RIS menu. This re-paritions your drive and creates two partitions for Windows to use (one small one for the Bitlocker boot stuff, and the main one for your Vista install). I selected the manual setup option so I could create two more partitions for Linux to use (one for extfs3 and one for swap). Then The Vista setup trundled along and within an hour I had a nice Vista setup (with Office 2007 installed already - how sweet it that!?)

At this stage, BDE is not yet enabled on your Vista drive - you need to go into the control panel and enable it. But I knew I wanted to hold off until my Ubuntu install was done, otherwise when the Ubuntu install changed the Master Boot Record (MBR) on the hard drive, Bitlocker would "throw a wobbly". (Yes, that's the technical term)

The next step was to insert the Ubuntu 7.10 CD and reboot the machine from it. The Ubuntu install is very slick and went without any hitches. Now when my laptop rebooted, I was presented with the GRUB boot loader, which let me choose between Ubuntu or Vista.

Now at this point I should mention that I subsequently found out that this is not the best order to do things. This blog has incredible information, but sadly I only found out about it after I had installed Vista and Ubuntu. The preferred order is to install Ubuntu first, then install Vista... (That way the Vista boot loader is one sitting in the MBR) However, using the information from the afore-mentioned blog, you can quite easily get the system working even if you've installed things in the "wrong" order like I did.

The key pages to read for instructions are this one and this one. The modified steps I used, based on the info in these pages, is then:
  • Step 1 – Install GRUB on the Linux partition (outside of MBR) (See step 1 here)
  • Step 2 – Get a copy of Linux boot sector (See step 2 here)
  • Step 3 - Boot into the Vista Recovery Environment (RE) using the Vista DVD / RIS server. You'll need to run bootrec.exe and tell it to fix the MBR record. (See this page for info)
  • Step 4 - You should be able to reboot from the hard-drive and Vista will load automatically (there will be no option to boot Ubuntu since Vista doesn't know about it yet...) Log in to Vista, and...
  • Step 4 - Set up Windows Vista Boot Manager to boot Linux. (See step 4 here)
  • Step 5 - Enable BitLocker on Windows Vista (See step 7 here)

(I also removed Vista from the GRUB boot menu, since we're now using the Vista loader to boot into Vista. This is pretty easy to do, just edit /boot/grub/menu.lst and remove the Vista entries form the end of the file).

Step 4 will take a few hours as it needs to encrypt the hard-drive contents, but once that is done you should be set...

No comments: