Installing Linux on the MacBook Pro

In Progress - Check back later.

Recently I installed Linux on a MacBook Pro that my employer was kinda enough to provide me. Since I found the experience surprisingly challenging I thought I'd document what I did. Hopefully it will be helpful. The instructions here will be biased toward a recent MacBook Pro (Intel i7 16 GB RAM with OS X 10.8) and a recent version of Linux (Fedora 17 64 bit) since that's what I did.

Preparation

Assuming you want to install Linux to the internal hard drive (as opposed to an external USB drive, which is a low risk alternative) you'll want to shrink the OS X filesystem to make room. You can do this via the Disk Utility in /Applications/Utilities. Select the Partition tab and then shrink the partition by grabbing the tab on the lower right hand corner.

Initial Boot

There are two challenges you're likely to when booting the the install disk. The first, which is really only a challenge to people who are new to MacBooks as I was, is how to boot from a CD/DVD. While booting -C.

The next challenge is a kernel panic that happens early in the boot process that mentions APIC. The solution is to pass noapic on the kernel command line. You do this by pressing on the initial screen then typing noapic and pressing return.

Install

During the install with regard to preserving the existing OS X partition it is safest to install the boot loader to the Linux boot partition, not to the MBR.

After the initial boot the next challenge is getting the system to boot.

Shortly after booting and installing you should update the system:

yum update

In part because doing so overcomes the APIC issue mentioned above. Specifically the based on kernels I've tried the APIC bug relates to the kernel version like so:
kernel-3.3.4-5.fc17.x86_64 - APIC bug
kernel-3.6.3-1.fc17.x86_64 - APIC fixed

EFI Booting

The next challenge is the somewhat misnamed BIOS mode booting that Fedora 17 sets up by default. In contrast to EFI booting the following seems to be true:

  • The installer creates a special BIOS partition. This partition actually contains the second stage loader.
  • Since GRUB was not installed in the MBR other boot loaders, such as rEFit, will consult the MBR rather than the GPT to find the partition that is to be loaded.

The gist of EFI booting is that rather than writing boot loaders to unused portions of the disk each operating system has a EFI boot loader executable as well supporting somewhere in a the EFI System Partition (ESP). The EFI boot manager allows an EFI boot loader executable to be selected.

One problem with BIOS mode booting is that doing so causes an error having to do with copying video memory.

I converted by BIOS booting system to EFI bootnig by reusing the the BIOS partition that contains the second stage boot loader. I reformatted it:

mkfs.vfat -n efi-boot /dev/sdaX

where X is the partition number for the BIOS partion.

You can now mount the freshly formatted partion:

cd /mnt
mkdir efi-boot
mount /dev/sdaX efi-boot

and then setup the files so that the have a layout like the following:

EFI/boot/bootx64.conf
EFI/boot/bootx64.efi

I copied bootx64.efi from my /boot partion, which has this path on my system:

/boot/efi/EFI/redhat/grub.efi

Although I had to read the source code to figure this out boot64.efi looks for it's configuration file by replacing .efi with .conf. For boot64x.conf I created the following minimal handwritten file:

splashimage=(hd0,4)/grub/splash.xpm.gz
default=0
timeout=2
title Fedora EFI
        root (hd0,4)
        kernel /vmlinuz-3.6.3-1.fc17.x86_64 root=/dev/mapper/vg_slemac-lv_root ro rhgb quiet hid_apple.fnmode=2
        initrd /initramfs-3.6.3-1.fc17.x86_64.img

Nvidia Drivers

By default, at least with Fedora, the driver is used for systems that have Nvida graphics cards. Although it's great that the Nouveau project is making progress there are still some limitations to it that are not immediately obvious. In addition to the obvious performance issues the system seems to run hot even when it is relatively quiet. Also, I wasn't able to get and external monitor to work via the Thunderbolt. Consequently getting the proprietary Nvidia drivers to work should be a priority.