Tuesday, September 04, 2007

Tri-Boot Mac OS X, Windows XP, and Ubuntu: Success!

For the past week I have been pretty silent, no posts at all. That's because I have been embarked on a very ambitious goal: To redesign a lab to support Windows, Mac, Linux, CCNA, etc., but use only one set of hardware. Because of the requirements, there is only one computer system that we could use: the Mac. But in order to use it properly, we would need to have it tri-boot Windows, Mac, and Linux.

This process was very time consuming, taking a week to work out the problems. Finally, at 1:00 PM Mountain Time today, I can claim success. Here is the situation, the problems I ran into, and the final solution.

The Problem
I wanted to set up a lab that can use Windows, Linux, and Macintosh all on one machine (ideally on a MacBook Pro for portability). This also includes having an easy navigation system between the operating systems without holding a key down.

The Solution
Because the Mac can run these operating systems, it should just be a matter of installing each operating system on a partition, and go! Right?

What Went Wrong
I started with partitioning the system with Disk Utility. It was easy, having Mac, then Windows, then Linux. That was my first mistake, but I wouldn't figure it out until after the first day. I formatted each partition accordingly, and began the Mac install. It installed without a problem, and I was ready to start the next step.

Next, I installed Windows XP. The install went very cleanly, and installed on the second partition without a problem. I could even boot off the partition when holding down the Option key, and selecting the Windows partition. This seemed to be running a lot smoother than I thought it would be. Linux couldn't be that big of a problem, could it?

Next I tried Linux. Ultimately I wanted to install Fedora for a linux lab, but I started with Ubuntu. This was mainly to test the actual install version. You see, the Mac has a 64 bit processor, but I didn't know if the 64 bit processor install would work. So I burned two versions of Ubuntu (because CD's are cheaper than DVD's), and found out that the 64 bit version worked much better than the traditional i386 version. That was good, because now I knew which version of Fedora to burn.

So, I started burning Fedora Core 6. Then, in the middle of the DVD burn, I found out that Fedora 7 was released, and it wasn't part of the Core releases. After a few choice words, I downloaded and burned Fedora 7 for the 64 bit architecture. By now, I was getting a little anxious, but still excited about this process.

I then started the install. It worked like a charm, and continued the installation without a hitch. Until I tried to reboot: It killed the Linux partition. I couldn't see it at all, even with the Option key. Well, thinking that it was just a problem with the Mac EFI bootloader, I followed some recommendations of a colleague and installed rEFIt.

REFIt is a tool that makes navigating between bootable devices on a Mac very easy. It detects all bootable images, and let's you select them. This includes CDs, DVDs, and even Firewire drives. The problem is, it didn't see the Linux partition either.

So, I started the process again, this time paying attention to the volumes that I could install it on. This was day 2, and I was getting a little anxious. The process seemed to run just fine, but now Windows wouldn't install, at all. So, I started cursing Windows as usual, and started working hard to get the blasted thing to install.

After a few good hours, I realized that the problem was with the partition order. It seems that Windows needs to be the last partition on the drive when you have multiple bootable partitions. So, I set it up that way. Windows finally installed, and I could boot off of it again.

Now, LInux wouldn't work. By day 3, I was cursing and really frustrated. Why wouldn't Fedora work? I didn't know, and my patience was wearing thin. I finally decided that Ubuntu looked good on the Live CD, I might as well give it a try. Besides, I know several people that have gotten it to install without a problem.

Installing Ubuntu
THis took a couple of installs, but I finally got it to work by the end of the 4th day. Now, I had all three installed, and both Ubuntu and Mac ran just fine. Everything couldn't be better! Except for the fact that Grub wouldn't let me get to the Windows partition. Argh!

Well, because it was a long week already, I left the problem until this morning. When I came in, I reinstalled Windows (to have a nice clean install), and then I went back to the boards.

Ubuntu Boards
One thing I don't like about bulletin boards is the difficulty to find exactly what I was looking for. No one had instructions on installing Fiesty (Ubuntu 7.04) in a tri-boot setup, though several people were referred to installing Dapper (6.06). So, I looked at the Dapper install information, and found a section that I think might help me: backing up and restoring the Master Boot Record. I thought I would give it a try.

At first, it didn't work. So I went back to the boards, and found a completely different section about losing the Linux bootable drive in rEFIt. There, they recommended installing the boot loader for Linux on the 3rd partition, or HD0,2. My heart was beating fast, could this be the answer?

I tried it. Before I started the install, I set the location of the boot loader to (hd0,2). While it finished the installation process, I also replaced the MBR with the backed up copy. I rebooted, and it worked! I was finally able to select the boot location for Mac, Windows, or Ubuntu, and have the system boot that OS without going to Grub. The final process is here:

Install Process for Tri-boot MacBook Pro
1. Make 3 partitions (use Disk Utility)
- Mac OS X (EFI with Mac OS X Extended, Journaled partition).
- Linux partition - Unix partition type (will be reformatted by Ubuntu)
- Windows Partition - FAT32 (reformatted as NTFS later)
*NOTE: a fourth partition is created for the EFI partition, this shows up as the first partition while installing your other operating systems.

2. Install Mac

3. Install eRFIt

4. Install Windows XP SP2
- Format drive as NTFS
- Make sure it is the last partition (in this case, 4th).
- When you reboot, be sure to select the Windows drive, instead of the CD.
- Once done, install the Boot Camp drivers.

5. Install Ubuntu
- Boot off of the Live CD
- Opt to use a manual partition scheme. Select the 3rd partition, set to format it and have it mount at root.
- Before you continue, back up your MBR.
- alt-F2 will open a command line then type: dd if=dev/sda of=/tmp/sda.mbr bs=512 count=1
- Continue with the install process, Until step 7.
- Here, click on the "Advanced" button, and enter (hd0,2) for the boot loader install. This will install the boot loader only in the Linux partition.
- Start the install.
- When finished, restore the backed up MBR with this command: dd if=/tmp/sda.mbr of=/dev/sda

That process will let you tri-boot your Mac. My references for each new information can be found below:

Partition order
Dapper install with info on MBR backup
Final information on the Grub issue from which I found out how to reference the Linux partition for the boot loader install.

I hope this will be helpful to many of you looking to utilize all these operating systems on the same machine, if only one at a time. ^_^

8 comments:

Anonymous said...

Thanks a lot from this! I am trying to triple boot Os X + Linux Mint + XP and I am having some problems with these things, too...

I installed originally Mandriva Linux (Spring 2007, one CD version) as a Linux distribution and everything went fine (I selected /dev/sda3 for '/') and the begin of the partition for Grub. Then I made a mistake and decided to change Ubuntu for Linux, and now there's TWO icons of Linux in the rEfit phase (neither of them loads Linux - instead I got a black screen with text 'GRUB _' in the upper left corner of the screen??). And therefore XP doesn't have a change...

So, motivated by you, I'm trying this. Let's hope the best! ;) And greetings from Finland.

Jeremy Robb said...

Glad I could help! I had a similar problem when I ran an install of Grub from the command line. The fresh install should do it. ^_^

let me know how it goes!

dcberg said...

Thanks for the hints!
I want to set up the same on a MacBook and will try the next days. I'm glad I found somebody who already made it. I was thinking to do it without any bootcamp but with egrub, but I don't really care and just want it to work.

Matt said...

Would this work on an ordinary MacBook, with the exact same instructions?

TB said...

wouldn't of it been easier to keep the XP MBR and boot instead of using Grub? Then all you would have had to do was modify the boot.ini to include ubuntu/mac? I know for the Ubuntu installation you have a choice on whether or not you wish to Install grub. Although, grub is awesome, it gets pretty picky sometimes.

Anonymous said...

Yunhaihuang says:
i have format my hard disk by Disk Utility( 4 partition, MacOS is last one). after install MacOS (version 10.5.5) successfully, partition table of my harddisk is not correct. hence, i can't format my HDD by partion magic.
please help me to solve this problem. i want to install 4 OS: 2 windows XP, 1 Ubuntu, 1 MacOS.
thanks alot.

Jeremy Robb said...

Matt, Yes, it will work with a regular MacBook. You shouldn't have any trouble. ^_^

TB,
GRUB doesn't recognize a Mac install, at least to my experience, and you can't install Mac OS X on an MBR drive. It needs to be either a GUID or Apple Partition.

Yunhaihuang,

You will not be able to use Disk Utility to partition 4 times, and install 4 OS images. Each OS needs to be on a Primary Partition, with on partition remaining free for EFI. That means you can only install a maximum of 3 operating systems.

Jamie Williamson said...

You can use grub to find mac osx. just manually edit /boot/grub/menuy.lst, and add a new title, and give the chainloader the drive of osx. In other words, copy the text relating to the windows xp boot, and change the name and the partition it refers to, and it worked for me.