You are here: Home robotic thoughts... MacBook Pro Triple Boot With Arch Linux, XP and OS X

MacBook Pro Triple Boot With Arch Linux, XP and OS X

Filed Under:

We just hired some new people at Six Feet Up which means we had to buy new laptops. Every once in a while I will assert my seniority and upgrade to the latest and greatest Apple hardware and pass mine on down the line. This time around the hardware I couldn't resist was the unibody MacBook Pro. I love the look and the feel of it. I had been putting off re-installing and upgrading the hard drive in my old MBP for a while. Procrastination pays off again! Installing the 320GB drive in the unibody MBP took all of fifteen minutes.

The reason for the HD upgrade was two-fold, one was a slight bump in performance (7200 RPM) and the other was obviously storage size. Recently I have become less impressed with OS X as a development platform and have been wanting to try another OS. We have a few people at the office that are running Arch Linux and our summer intern showed me some pretty cool features of the OS. I liked the Arch philosophy and it looked like a good candidate for a dev platform.

Now this is where the 320GB HD comes in handy :)

The Triple Threat

I had seen my fellow colleagues dual booting into OS X and Arch Linux. They were using reFit as a boot loader and I was pretty impressed with the set up. Having been a long time Parallels user, I also remembered that it could take a bootcamp partition and use it as a VM in OS X. Thus the dream was born, the triple boot: OS X, Arch Linux and Windows XP.

Having just received a copy of Snow Leopard I decided it was finally time to re-install and give my OS X installation a breath of fresh air. So first things first, I created a clone of my drive with Carbon Copy Cloner and proceeded to google around a bit to find some hints on how to install all three OSes on my MBP.

I ended up using several different sources to get started. First was a blog entry that covered the most of the information that I needed. Of course it was aimed at using Vista and Ubuntu so I had to interpret it slightly. Looking back at it, there is still one thing I need to do, set up a swap file.

Update: I found a nice how-to about how to set up swap space on linux (quite old but still relevant it seems). Here is the gist of what I ended up doing:

$ sudo mkdir /work
## make a 1GB swapfile
$ sudo dd bs=1024 count=1M if=/dev/zero of=/work/swapfile.1
$ sudo mkswap /work/swapfile.1
$ sudo swapon /work/swapfile.1

Then add the entry at the end of your /etc/fstab so that it gets created on boot.

$ sudo vim /etc/fstab
...
## here is the swap file entry
/work/swapfile.1 none swap pri=5,defaults 0 0

You can add more swap as needed by adding more swapfile.n files. I had to go in later and add a total of 6GB (double my RAM). end update

Second I used the AchWiki page dedicated to the MacBook to setup the Arch Linux side of things. The ArchWiki is quite impressive and is loaded with useful information. Sometimes you have to use several pages to really figure out what is going on, but overall it's pretty concise. One handy tip was to change the UID and GID of your OS X account before using it so you can line it up with the same IDs in Arch Linux, thus making sharing home directories easier. One extra step that was needed was to create a new 'group' in the 'Accounts' preference pane in OS X so that my group showed up with a name and not just a GID.

Live and Learn

I learned a few valuable lessons while installing everything. The first lesson was realizing I should have read the bootcamp docs before I started. There is some helpful info in there including the fact that you have to use XP SP2 or higher to install. All I had lying around was an original XP Pro install disc. I attempted the first install with that disc and ended up nuking my OS X install since only one partition was showing. Common sense should have prevailed here, but I was in a hurry. A download of SP3 and a re-install of OS X later and I was back on track.

GRUB

The biggest pain I had while installing the three OSes was accidentally installing GRUB directly onto /dev/sda. Both the tutorials I was using told me NOT to do this, but apparently I was in opposite day mode. The GRUB install had the immediate effect of not allowing me to boot into Windows but still but still able to boot OS X. I was still able to boot into Arch Linux via the GRUB screen. As an interim fix, I added windows to the GRUB config file. Arch Linux sets up a windows partition example, I just had to change the partition number.

I finally got around to backing up my OS X partition so I was able to try fixing the situation (and potentially borking all the installs). First thing I tried was to use the XP install CD. Which included following these steps:

  1. Boot up with the Windows install CD
  2. Go into recovery mode
  3. Select windows install (usually number 1)
  4. Run the FIXMBR program from the prompt: C:\> FIXMBR

This didn't quite fix the issue, Windows would now just boot up to a black screen and Linux wasn't an option from reFit anymore. After some more googling around I was able to find a post with a potential fix on the Apple support forums.

I booted up into single user mode to fix the master boot record.

# fdisk -u /dev/rdisk0
new MBR [y/n]: y

This fixed it, now I was able to boot into OS X and XP! I'm not sure if the FIXMBR was required or not, YMMV. Next I just had to re-install GRUB on the linux partition. I used the steps on the Arch Linux wiki about re-installing GRUB and installed it into the same partition as my Linux install (/dev/sda3).

Now reFit shows and boots into all three OSes properly. Success!

Bootcamp and Parallels

Next objective was to get the bootcamp partition working with Parallels. I chose to use NTFS for my XP install. Snow Leopard can read this by default, but it doesn't read and write by default. I found a little snippet on a MacFUSE forum somewhere that showed how to turn on the native read write support in Snow Leopard. Here is what I had to do.

Get the UUID of the partition with Windows installed on it (my XP install is on the fourth partition)

$ echo `sudo /System/Library/Filesystems/ntfs.fs/ntfs.util -k disk0s4`
6369b368-57d8-46e6-80c6-e6ac095fb604

Use your favorite editor to modify the fstab.

$ sudo vim /etc/fstab

Then add the following (replacing your HDs UUID)

# bootcamp partition in read/write
UUID=6369b368-57d8-46e6-80c6-e6ac095fb604 none ntfs rw

Next time you boot up you will have an NTFS partition that is read write in OS X. The rest of the Parallels install was straight forward. Now I can use my XP boot partition as a VM in OS X!

Final remarks

I'm quite excited to have three bootable OSes on my laptop giving me the best of all worlds! I learned a lot about boot loaders during this exercise as well. Though I'm still a bit hazy on how this works with reFit. Whatever you do, DO NOT install GRUB into /dev/sda! This set me back a couple days since I was using the laptop for work purposes as well.

Next step for me is to get OS X to recognize the ext3 partition and for Arch Linux to use HFS+ read write. None of the MacFUSE modules and ext3 helpers seem to work on Snow Leopard at the moment. Anyone know of any working solutions out there for Snow Leopard?

Update: I was able to mount the ext3 filesystem with fuse-ext2 using the following commands.

$ mkdir /Volumes/ARCHIE
$ sudo fuse-ext2 /dev/disk0s3 /Volumes/ARCHIE -o force,allow_other,volname=ARCHIE

This mounts the FS at the /Volumes/ARCHIE folder with read write capability and names the volume ARCHIE. One last thing that I haven't figures out is how to get this to work properly in /etc/fstab in Snow Leopard. end update

Document Actions

Shared filesystem

Posted by Glen at Sep 22, 2009 01:57 PM
Any particular reason not to allocate some FAT32 space, which all three can R/W?

Shared filesystem

Posted by claytron at Sep 24, 2009 01:23 AM
Didn't think about doing that. I might do that when I decide to nuke some partitions and start fresh.

Robotic Thoughts-Boot Default

Posted by bandit.tech at Nov 12, 2009 06:03 PM
I made a triple boot on my macbook, but its default boot is Mac OS, while Unbuntu & XP only boot with pressing a key (option), does the quad boot allow equal access to all OSs so no one is default?

re: Robotic Thoughts-Boot Default

Posted by claytron at Nov 12, 2009 06:07 PM
reFit takes care of the boot loader. It defaults to OS X with a delay of 15 seconds on the boot screen. Sounds like you are using Bootcamp. You should check out reFit if you want more control (make sure you have backups before tinkering around with it!)

http://refit.sourceforge.net/

re: Robotic Thoughts-Boot Default

Posted by deesto at Jan 28, 2010 10:12 AM
rEFIt is great, but you may need to play with it to get it working: it claimed to have installed successfully for me in 10.6.2, but I found that the installation didn't really take until I created a boot CD, and ran its partition inspector from there to update the boot sector.

I agree that Boot Camp is a real PITA, but I found that I couldn't get XP to boot after install unless I let Boot Camp create the Windows partition and then installed afterward. Of course, that means you can only have two partitions, but I solved this by making the XP partition larger in Boot Camp and then splitting the partition with a Gparted LiveCD, so I now have Fedora 12 running as well. Something thereafter hosed the XP install, so I'm stuck with a missing hal.dll error on boot now, but at least the others are working.

Brilliant

Posted by Toby at Sep 16, 2010 04:13 PM
I also managed to accidentally install grub to /dev/sda. Your advice on running fdisk worked like a charm. Thanks for saving me many hours of effort.