Blog

July 18, 2013 16:24 +0000  |  Apple Linux 13

The end result

The colour is relevant you see. This is how Mac people tell their hardware apart. "Not the grey one that came out in 2010, but the silver one that was released in 2011"... or whatever.

For the sake of those who might search for something like this post, the specs of this particular MacBook are:

Serial No: W872632DYA8
White/2.16/2x1G/120/SD/AP/BT-NLD
EMC No: 2139

The backstory

I recently acquired an older MacBook as part of an experiment and learning experience. Either that or an attempt at self-flogging. You see, I'm forced to use a Mac at work (though thankfully they let me use Linux on it), but my understanding of how to get Linux installed and working on a Mac is still pretty limited, so I picked up one of these to try to turn it into a simple file server. This post is the result of that torturous process experiment.

So here's the deal: the firmware on the white MacBooks is broken, placing it in a unique and problematic position:

The Problem

blinking question mark

Older CDs that do not support EFI

These will boot on the Macbook, but won't be able to install an EFI-aware bootloader so when you're all finished you end up with a blinking folder with a question mark on it (see image)

Newer CDs that support EFI

These will hang with the super-awesome-and-totally-useless prompt:

1.
2.
Select CD-ROM Boot Type:

Searching for this returns all manner of panicked mac users and clueless Windows users trying to figure out what they did wrong and very little helpful information regarding why an ISO that boots just fine on normal computers will just flake out like this on a mac.

Bootable USB sticks

These just won't boot at all.

My attempts

A lot of the how-tos out there point you to rEFIt, which is now defunct, replaced by rEFInd. Both of these projects aim to allow for dual-booting, which I didn't care about, and neither solves the problem above. All you get is a a dual-boot environment with one of those environments refusing to boot.

It turns out though that if you spend enough days, and enough distributions (I started with Gentoo, then Fedora, then Gentoo again, back to Fedora), you will eventually stumble upon what you need. In my case it was the 22nd comment in a bug report to the Fedora mailing list. It explained that the Macbook firmware was broken, and the only work around is to rebuild the install cd without EFI support, which would force the MacBook to revert to BIOS mode, boot the disc, and from there do what you need to install an EFI-friendly bootloader.

In other words, the MacBook was broken, but Apple didn't care because their software works just fine on broken firmware. If you want to use it anyway, you have to break your software to play along.

That's roughly 7days of pain I've saved you. You're welcome.

The actual solution

So enough with the griping. Here's what I had to do to make this work:

# Download a Fedora ISO and mount it (as root) to somewhere convenient
mount -o loop Fedora-Live-Desktop-x86_64-19-1.iso /mnt/floppy

# Create a temporary place to copy the disk data
mkdir /tmp/image
cp -a /mnt/floppy/* /tmp/image

# Create a new ISO, stripping out all of the stuff that confuses the MacBook
mkisofs -r -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V Fedora-Live-Desktop-x86_64-19-1 -o /tmp/fedora.img /tmp/image/

# Burn that baby to a new disc
cdrecord /tmp/fedora.img

You may still run into problem where the boot process complains about not being able to find the disk labelled "Fedora-Live-Desktop-x86_64-19-1" or whatever you've downloaded. If this happens, you'll be dumped into an emergency shell where you can find out what the CD is calling itself these days:

# ls -l /dev/disk/by-label/

You should see the name of your CD in there, take note of it, reboot, and at the very first screen where it asks you if you'd like to install Fedora, hit tab to edit the options, and change the relevent portion of the command to use the appropriate disk name.

And that's it. I now have Fedora running on my MacBook, which isn't ideal, since I would have preferred Gentoo, but since this is already 7days of my life I won't get back, I'm going to stop here and be happy.