I dropped my Macbook Pro laptop on the concrete sidewalk on the short walk to work a couple weeks ago. I had popped the messenger bag shoulder strap up off my shoulder to pull my coat out, and didn’t quite catch it on the way down. Blammo. Turns out that when push comes to shove, concrete retains its shape a lot better than aluminum. All the USB ports on my Macbook Pro 5.2 were instantly transformed into trapezoids, as the corner crumpled up like a soft soda can.
Those Apple folks know what they’ve got going, and do a good job of treating people with no regard for money well. $600 later I had a lot of heartburn, but also had a 50% brand new MBP that worked perfectly. Too bad the 50% included the hard drive.
Anyway… long story short -too late-… my clean hard drive emboldened me to finally install all the OSes I needed. What does it take to get my four favorite ones squeezed onto one fat-assed macbook pro? A little more pain than should really be necessary. The moral of the story is that this is the stuff you play with when you don’t really care if you blow all your data away. No, really. Back up anything you care about first. Technical details start up after the break…
The problem lies in the fact that Apple has been using EFI and GPT partition tables for booting for quite a while, and the PC world has been booting from MBRs for a thousand plus years, only recently moving towards EFI. And the flavor of the two is a bit different.
To get things working, you have to use a “hybrid MBR” solution, where you have both a MBR partition table and a GPT partition table that are synced with each other. You can read all about it elsewhere if you like, but after reading random conflicting information for a few hours, I’m just going to capture what worked here.
Apple has created a clean solution, as they usually do, so that Windows and OS X can co-exist with almost no user effort, via Bootcamp. Bootcamp installs simply from Mac OS X, and using your Windows installation media, you’ll soon have an automagically created hybrid MBR setup that lets you pick OS X or Windows on startup by holding down the Option key.
Next, I installed Ubuntu 12.04 beta 1. Recent versions of Ubuntu need a little help booting up on my flavor of Macbook Pro (5.2). Your mileage may vary, but I need a special kernel config when booting from the live CD. When the menu comes up, hit F6, ESC, and add this to the boot line to get going:
Once booted up, Ubuntu Live will look pretty much like it does on a PC, nice. I fired up gparted and carved out two 30GB partitions, one for Ubuntu and one for gentoo, by shrinking the 250GB OS X and Windows partitions. Then I ran the Ubuntu installer, which was silky smooth. The only real trick is to change the default location of grub – switch it to the same partition on which you’re installing Ubuntu, instead of the first partition.
Now it’s time to boost the Mac’s booting skillz. rEFIt is an app that replaces the Mac’s boot sequence with something a bit smarter, and prettier to boot (yes you have been punned). Reboot into OS X, and download and install it. Make sure you get the latest version of rEFIt, and not the rEFInd fork, which does not play well with Macs (as I learned the hard way).
Before the next reboot, let’s patch up our hybrid MBR to include our Ubuntu install. The gdisk app was born for this job. It’s by the same author that did the rEFInd fork, only this time it works like a charm with the Macbook. Get the latest Mac version (here is what I used) – that way no matter what you do, you can usually get back to it – and spin it up. Follow these steps to resync your MBR and GPT partitions:
gdisk /dev/disk0 r # for "recovery" mode p # to display GPT partition table - MAKE NOTE OF IT o # to display MBR partition table - MAKE NOTE OF IT h # to sync up the hybrid MBR table 2 4 5 # DO NOT JUST TYPE THESE, use ones that match your setup # You want to pick GPT numbers for [[OS X HFS+] [Bootcamp] [Ubuntu]] place EFI first? Y MBR hex code for GPT part#2 (MBR part#2): AF (for Mac OS X) MBR hex code for GPT part#4 (MBR part#3): 07 (for Windows 7) MBR hex code for GPT part#5 (MBR part#4): 83 (for Linux) w # to write and quit
Reboot, and with a little luck rEFIt will display three purdy icons for you to choose from.
Next, we’ll boot into Ubuntu and do our stage 3 gentoo install on a gentoo partition. That’s a snap if you’re a fan of gentoo. Don’t bother with another boot partition, we already have rEFIt’s EFI partition and Ubuntu’s boot folder on the Ubuntu partition. There are (as always) good docs on setting up the gentoo kernel and drivers for Macbook Pros. Since Gentoo Does Everything (TM), we have the choice of tapping into the MBR boot process that we just set up with Ubuntu, tapping into the EFI boot process of rEFIt, or going direct with an EFI boot. I monkeyed with grub2 and building an EFI boot image, but that stuff is currently pretty raw and truly a pain in the ass in its current state. I’m excited to get a 3.3 kernel going and directly boot a gentoo EFI image, but for now, it was plain and simple to update the Ubuntu grub install to add a reference to my gentoo kernel. I’ll revisit this in 6 months when there’s a chance that all the open source egos have worked out the EFI kinks… and in the meantime, to get to gentoo, I’ll select “Linux” in rEFIt, then I can select Ubuntu or gentoo from grub.
Yay, I now have my four favorite OSes in my messenger bag!
One last piece of advice: the current world of boot loaders sucks. Very few people want to learn the intricacies of boot loaders, let alone deal with bugs and incompatibilities. Just find the easiest path that works, and revisit the subject in another year. Have fun!