Linux on the Mac Mini

Index

(This article has been translated to Spanish by Maria Ramos "Webhostinghub.com; Gracias, Maria!)

Update (2006)

The first generation of Mac Mini systems used PowerPC G4 processors. This page primarily describes a technique for installing Debian on these earlier PowerPC G4 based systems; I have now added a short guide to installing Ubuntu on the newer Intel based systems.

Mac Mini systems shipped since February 2006 contain Intel "Core Duo" processors and an Intel 945GM+ICH7M chipset. In other words they are regular PCs using Intel's Centrino platform, modulo some fancy firmware, and with a little persuasion can run common or garden i386 Linux.

We have both an i386 (Intel) and a PowerPC Mac Mini. The i386 Mac Mini dual boots MacOS X and a pre-release of Ubuntu 6.10 (Edgy Eft Knot 2). Ubuntu is a Debian-based distribution focusing on desktop usability and regular stable releases. In the photo below, the ICBM (Intel chip based Macintosh) is on top, with the G4 system underneath. The dimensions and paint colours match exactly, although the width of the optical drive slot is wider on the ICBM to allow space on one side for the infra-red receiver, and the G4 has a very slight chamfer around the top edge which the ICBM does not.

Corky (Core Duo) and Audrey (G4)

Quick Guide - i386 Mac Mini

Here's a super-condensed guide to installing Ubuntu on the i386 Mini. I wouldn't attempt this unless you are confident you can mount your root partition and install GRUB by hand from the command line, or you don't mind abandoning the entire thing and re-installing from the MacOS X DVD. There are more comprehensive guides online if you get stuck, for example you could start reading here. I won't write a detailed discussion of the hardware, as there are plenty of well written pieces online already.

Anyway ... mix up some weak lemon drink and let's get started.

  • Boot into MacOS X
  • Download and install Boot Camp. This tool allows you to resize your existing HFS+ partition without reformatting. Make enough space for your Ubuntu install, then quit the tool when it prompts you for your Windows XP CD.
  • Download and install rEFIt, an EFI boot manager. rEFIt will allow you to choose between MacOS X and Ubuntu when you power on. Follow their instructions to install it on your MacOS X volume.
  • Download and burn an i386 Ubuntu CD (I used Edgy Eft Knot 2 because it was the most recent at the time).
  • Pop the CD into the drive, reboot (allow it to boot from the hard disk, no need to force a boot from the CD). You should end up at the rEFIt menu.
  • Use rEFIt's partition map tool to copy the GPT partition map into the MBR. The new GPT partition format can handle very large disks and contains the canonical partition map; the old MBR partition map should contain a shadow of this information and is used here primarily by the GRUB bootloader. I am sure that one day soon rEFIt will boot Ubuntu's Linux kernel directly and will be able to skip this.
  • Tell rEFIt to boot from the CD. You should land up at an Ubuntu desktop, running directly from the CD. Use the "Install" icon to install onto the hard disk. Do not allow the system to automatically repartition the disk! Use the manual partition editor and format the partition that Boot Camp made for Windows (most likely it's the last one on the disk) as your root filesystem. If you're feeling adventurous, delete it and create two partitions, one for swap and one for root -- although this may have implications when you come to install the bootloader (see next point).
  • I found that I couldn't install GRUB after I split the partition created by Boot Camp using the Ubuntu partition editor. The reason appears to be that the Ubuntu partition editor rewrote the GPT partition map but did not shadow this this information into the MBR partition map (presumably it assumes all GPT systems are GPT-only). The fix was to reboot, use the partition map tool in rEFIt to update the shadow map in the MBR, then boot again from the Ubuntu CD and install GRUB by hand. I installed into the boot sector of my Ubuntu root partition (which was marked as bootable in the partition map) rather than into the MBR. An alternative would be to install for a second time, without repartitioning at all in Ubuntu, which would be easier but more time consuming. I have not tested if this second technique works, caveat lector.
  • ...
  • Profit!

If you try this out, I'd be curious to hear how you get on with this technique. I can't do as much experimentation with the i386 box as I could with the PowerPC because Celia and I are already using it for "real work".

We now return you to your regularly scheduled programming...

Introduction - PowerPC Mac Mini

From this point on, you should read "Mac Mini" as "G4 Mac Mini". There is no further discussion of the Intel based Mac Minis on this page.

Apple's first generation Mac Mini is something which a lot of Linux users have been waiting for: An inexpensive, readily available PowerPC system in a small, quiet and attractive chassis.

Debian is very popular on Intel i386 compatible systems. Due to the open source nature of the Linux kernel and the Debian operating system, it is possible to build the same software to run on the PowerPC processor found inside the Mac Mini. It's simple to swap your big, noisy old PC for the slim, svelte Mac Mini, and this page aims to show you how to do just this.

Personally, I bought the Mac Mini as a replacement for my girlfriend's aging 1GHz Pentium-III system. Thanks to the portability of Debian and its advanced package management tools, making her new Mac look like her old PC took only an hour or so.

Hardware

The hardware specification is somewhat less than stellar by 2005 standards, but still perfectly adequate. One can choose between a 1.25GHz or 1.42GHz PowerPC G4, both running with 512K on-chip L2 cache and a 166MHz "MaxBus" front side bus. This is markedly less powerful than contemporary Intel or AMD x86 systems, but for the overwhelming majority of tasks this is more than enough processing ability. If you need more power, you can always stack a few more Minis on top ;-)

The advantage of the G4 used in the Mac Mini is that it produces very little heat relative to an x86 processor with comparable computational power, making it ideal for the small space inside the Mac Mini. The G4 used dissipates around 21W at 1.42GHz, and 18.3W at 1.25GHz.

The other hardware in the box is also mature and reliable (or, if you're a glass-half-empty person, cheap and slow). The Mac Mini has an RV280 GPU ("Radeon 9200") with 32MB of dedicated DDR SDRAM. The RV280 has four rendering pipelines, hardware geometry transform and lighting acceleration, and both programmable pixel and vertex shaders. On my Mac Mini, the GPU is clocked at 250MHz and the graphics memory is clocked at 190MHz DDR. It's more than adequate for people who aren't interested in playing the very latest 3D games. Much of the 3D hardware is supported by XFree86, which is excellent news.

The system has a single DIMM socket which takes standard PC2700 modules, although it is slightly tricky to gain access to it. The largest available upgrade at present is a 1GB module, but I believe that the Mac Mini will also be certified for use with 2GB modules when they enter production. For the average Linux user, 1GB will be more than adequate. The 256MB Apple supply is far too little for Mac OS X.

For heat and noise reasons, Apple have chosen to use a 2.5" (laptop-size) hard drive in the Mac Mini, making end-user upgrades fiddly and expensive. The 40GB or 80GB hard drive supplied is unlikely to be large enough for everyone. Apple appears to be shipping a mix of 4200rpm and 5400rpm units in the 40GB size, but currently all 80GB units are 4200rpm. The 5400rpm drives are apparently faster, presumably due to their shorter head seek times. My unit has an 80GB Toshiba MK8025GAS.

The Mac Mini uses Apple's "Intrepid" north bridge. It appears to be a very compact derivative of the eMac's motherboard design. This diagram illustrates the hardware in the Mac Mini as exactly as I can. Note that the MaxBus and SDRAM are clocked at 166MHz, and the internal optical drive is configured as a slave device on the same ATA-100 bus used by the hard drive. This is a cost-saving measure on Apple's part, as the Intrepid chipset has a second ATA channel that could be used for the optical drive.

The Airport card and Bluetooth modules are mounted on an optional mezzanine card. If your system did not come with either of these options, the mezzanine card will not be present. I am told that the modem is not present on models sold into the educational market.

Apple's Developer Note on the Mac Mini is now online.

Noise

It's quiet -- very quiet. But not silent. The only noise is the barely audible hum from the hard disk. Thanks to the fluid dynamic bearings, this isn't the annoying high-pitched whine that older 2.5" disks produced. I'm very pernickety about noise, and I find it quite acceptable. After a few months I upgraded the internal disk in my G4 to a 7200rpm 2.5" model (Hitachi TravelStar 7K60) which is very slightly louder, 20GB smaller, but noticably faster.

The Mac Mini has a fanless external 85W switch-mode power supply, about half the size of the Mac itself (picture here), moving a major source of heat out of the metal chassis. Combined with the G4 processor's relatively low clock speed, this was presumably key to Apple's thermal design. Having less heat to dissipate means that, while the Mac Mini does have a small cooling fan, it rarely spins up to a high speed. Performing normal office work it is inaudible. The only noise coming out of the Mac Mini is the quiet hum of the hard disk, and even that can spin down automatically when the system is completely idle.

The optical drive is relatively loud when in use. I never really use optical media, so this doesn't bother me. It may bother you.

Inside the Mac Mini

Upgrading the RAM requires opening the case. See this page, where you can download a nice PDF and a video showing how to disassemble the system.

In fact, the PDF is a complete maintenance guide, presumably written for Apple service technicians.

You'll need a putty/spreading knife, be sure to buy the very thinnest possible. The tool I used is extremely thin and springy and still it left little gouge marks on the base of the chassis.

Please don't attempt to open your Mac unless you're familiar with opening consumer electronics devices. If you break your Mac, you get to keep both halves.

Linux Hardware support

MPC7447A ("G4") processor with AltivecSupported
Apple UniNorth 2 AGP 4X bridgeSupported
Apple UniNorth 2 FireWireSupported
Apple Intrepid ATA/100 controllerSupported
Apple 10/100Mbit ethernet (Sun GEM)Supported
NEC PCI USB 2.0 controller (EHCI/OHCI)Supported
ATI Radeon 9200Supported
Apple Intrepid AudioSupported
Apple Bluetooth moduleUntested (but should work)
Apple 56K V.92 modemUntested (but may work)
Apple Airport Extreme (802.11g)Supported (work in progress)

I did not expect the 802.11g wireless ("Airport Extreme") to ever work. The Apple Airport Extreme module uses a PCI 802.11g chipset from Broadcom, and there were no specifications available to write an open-source driver for this hardware. However, some very dedicated people have set about reverse engineering the hardware and writing their own specifications. This then allowed a second team to produce an open source driver for Broadcom BCM43xx chips. This driver is included in recent linux kernels.

I'm not sure about the modem or the optional Bluetooth module, I've not tested either yet.

Ben Herrenschmidt (all praise BenH!) has fixed the audio driver. Apparently his patch is in kernel 2.6.12-rc4 or later, and you need alsa-lib 1.0.9rc3 or later.

A few odd problems I've discovered:

  • If I plug the firewire port into the firewire port on my PC, it seems to interfere with the PC's power supply. It's like holding down the "reset" button on the PC. This makes it impossible to use "firewire target disk mode" on the Mac Mini. This may turn out to be a problem with the firewire card in my PC; I've not been able to test with another system yet.
  • The "radeon" driver in kernel 2.6.10 cannot reliably drive my 1600x1200 LCD over DVI. The image flickers, as if the timing was wrong. Mac OS X can drive this LCD fine on the same hardware, so it appears to be a problem with the "radeon" driver in 2.6.10. The driver in 2.6.9 fares better, but the screen is afflicted with some sort of bizarre technicolour snow. Very annoying. The driver in kernel 2.6.9 can drive my 1280x1024 LCD over DVI without any problems, and I assume it's fine at lower resolutions too. I've not tested 2.6.10 with the 1280x1024 LCD yet.

Installing Debian GNU/Linux

Tools you will require:

  • Apple Mac OS X installation media (comes with the Mac)
  • Internet connection
  • Blank CD-R
  • Weak lemon drink

The following process will erase your Mac's internal hard disk. Any data on it will be lost. Copy anything you value to another computer or onto writable optical media before proceeding.

When you receive your Mac mini from Apple, it will have a single partition for Mac OS X which occupies the entire disk. In order to install Debian, you'll need to set aside part of the disk for Debian's filesystem. This process is called "partitioning". When we repartition the disk, any filesystems on it must be reformatted (or "re-initialised" in Apple-speak). If you have any valuable data on your Mac, copy it somewhere safe (preferably another computer) before proceeding.

If you want your Mac to run only Debian, you can skip ahead to burning the installation CD. If you want to dual-boot Mac OS X and Debian, read on.

With Mac OS X running, insert the gray "Mac OS X Install Disc 1" that you received with your Mac. Run the installer from the disc and, when prompted, click the "Restart" button. Your Mac Mini will reboot (bong!) and load the Mac OS X installer from the optical disc. If you've nadgered your OS X installation already, just reboot with the disc in the drive and hold down the "C" key on your keyboard -- this will force the Mac's firmware to try to boot from the internal optical drive.

With the installer running, open on the "Installer" menu in the top left of the screen. Choose "Open Disk Utility". You'll now need to tell Disk Utility how to partition the hard disk. I asked for five partitions. Most of these I marked as "Free Space". This is fine, we will re-assign their purpose in the Debian installer. Disk Utility is a little fiddly to use, but persevere and you'll figure it out in the end. A few tips: If you use the mouse to resize a partition below one gigabyte, it starts counting in megabytes instead. This allows you to type in the exact size you want for small partitions. To select a partition which is too small to be visible, click on another partition and use the tab key on the keyboard.

This table shows how I partitioned my 80GB internal disk. I decided to have an 8GB partition which I would format as FAT32. This allows me to easily and reliably share files between OS X and Linux, both of which have good FAT32 support but, at the time of writing, poor or incomplete support for each other's native filesystems.
PartitionTypeSizePurpose
Partition 1Free Space16 MBDebian Bootstrap
Partition 2Free Space2 GBDebian swap space
Partition 3Free Space44.5 GBDebian root filesystem
Partition 4Free Space8 GBShared FAT32 filesystem
Partition 5Mac OS Extended (Journalled)20 GBMac OS X filesystem

A word of caution: I found that Disk Utility would sometimes "lose" some space, presumably this is a bug in the software. Check that the partition sizes add up to the right amount when you're done resizing them. And remember than an 80 "marketing-gigabyte" disk contains only 74.5 "real-gigabytes". I had to quit and re-start Disk Utility several times before I managed to make it work right. I think the trick was to do the last partition first, then start down from the first one.

Once you're done, click the Partition button, quit Disk Utility, and install Mac OS X onto your new partition.

Drink your weak lemon drink now.

Eventually the Mac will reboot into Mac OS X so you give all your personal details to Apple and then get on with life in OS X. Your computer now has some empty partitions for Debian to install itself onto.

Next up you'll need a Debian Installation CD.

Debian has several "branches", several of which are in continuous development. New versions of software are uploaded into the unstable branch. After a few weeks without serious bugs being found in unstable, the testing branch accepts these packages. Periodically Debian "freezes" testing and releases it as a new stable branch. A new branch is then created to become the new testing.

I'm going to show you how to install "Sarge", which is the name for the current testing branch. It's not quite the white-knuckle-ride that the unstable branch is, and unlike the stable branch it contains pretty up-to-date software. It's the smart choice.

Here's an outline of the process:

  • Download an ISO image from the Debian web site
  • Burn ISO image to a blank CD-R
  • Reboot into the Debian installer
  • Install the Debian "base system"; this is a minimal Debian system with just enough tools to download and install any additional packages you require
  • Reboot into the Debian base system
  • Select the packages you'd like to use
  • Download and install the packages
  • Build an optimized kernel
  • Enjoy!

Run Safari and go to the Debian Installer page. Here you can download an ISO file, which is a filesystem image ready to be burnt onto a blank CD-R. I downloaded the Release Candidate 2 ("rc2") version of the installer. If a more recent version is available, you may wish to try that instead. There are many different CD images available.

You want one of the "powerpc" images. There are several different sizes available. If you connect to the Internet through your Mac's ethernet port, I'd recommend the businesscard CD image, which is about 110MB. This contains enough to install the base system without any further downloads. If you don't mind downloading a lot, or if you connect to the Internet through the Mac's internal modem, it might be a better idea to download the full CD set instead, as these include a snapshot of the most popular packages. Don't worry that there are 14(!) CDs, they are organised with the most popular software on the low numbered CDs. You can get a working system with just CD 1, I believe. Each full CD is about 650MB.

Once you've got a lovely ISO, you'll want to burn it to CD. You can't just burn it as a file on a CD, the file is itself an image of a CD ("iso9660") filesystem. Open your "Applications" folder, then the "Utilities" folder, and run "Disk Utility" again. Sometimes it feels like this is the only OS X application I ever run. Anyway, from the "Images" menu select "Open". Find your ISO file and open it. Click on the ISO image and then click the "Burn" button on the toolbar. Feed your Mac Mini a blank CD-R and drink some weak lemon drink now.

Before you reboot, you might want to flick through the Sarge installation manual for PowerPC. We're about to start Chapter 5.

Reboot or power on your machine. Before the "bong!", hold down the "C" key. The bootstrap on the Debian CD should load. If you just end up in OS X, try again.

At the "boot:" prompt, just hit enter. The kernel will boot. After a few seconds, the installer will start and you'll be asked a few simple questions. Ideally you would be connected to the Internet through the Mac Mini's ethernet port, in which case you can tell the installer to use "eth0" as the primary network interface.

After downloading the package lists from your local Debian archive, the installer will launch the partitioning tool. We've already partitioned our disk, but we need to use the tool to set the correct partition types. When prompted, choose to "Manually edit the partition table". If you followed my five partition plan earlier, this is what you want to end up with:

  • Don't touch the small Partition #1 at the start of the disk, that contains the partition map itself.
  • Partition #2 (16MB) is for "yaboot", the bootstrap that allows you to boot Linux or MacOS. You want to tell the partitioner to use that partition as a "NewWorld boot partition", and set the bootable flag.
  • Partition #3 (2.0GB) should be used as "swap area".
  • Partition #4 (48.0GB) is your root filesystem, you want to use that as a "ReiserFS journalling file system", format it, and mount it on "/".
  • Partition #5 (8.7GB) is used as a "FAT32 file system", I've mounted mine on "/shared".
  • There is no Partition #6!
  • Partition #7 (21.3GB) is Mac OS X's filesystem. Don't touch it.

When you're done, select "Finish partitioning and write changes to disk". For me, the installer complained that the FAT32 partition "had errors". I think this means that it couldn't format it, presumably because it's missing mkfs.vfat. Don't panic, just continue with the installation -- it's a simple problem to fix later.

Debian will now install a base system. This is a system with enough tools to get started, connect up to the Internet and download any additional software you need. This step takes a few minutes, so why not use this time to enjoy drinking some of your refreshing weak lemon drink.

Eventually your Mac will spit out the Debian installation CD and reboot. Instead of rebooting directly into Mac OS X as before, it will now load a bootstrap from which you can hit the letter "L" to boot Linux, or "X" to boot Mac OS X. Tap "L" and, at the "boot: prompt, the Enter key.

Debian will boot up and you can now complete your installation. The Sarge installation manual will guide you through the rest of the installation process, which is painless. If you're following along, start at Chapter 7.2.

  • If you wish to build your own kernel, here is my kernel .config for 2.6.9, which you may find useful. Building a new kernel is very quick and simple with the Debian tools, just install "kernel-package" and follow the documentation.
  • Once you've installed the base system, you can easily install the same software on your Mac Mini as you use on another Debian system:
    • Use "dpkg --get-selections > selections.txt" on your current system.
    • Copy the "selections.txt" file over to your Mac Mini.
    • Run "dpkg --set-selections < selections.txt" on your Mac Mini, to tell it which packages you want installed.
    • Finally, "apt-get dselect-upgrade" will download and install the packages.
  • Here's my XF86Config-4 file. I use a 1280x1024 LCD over DVI.
  • To make the FAT32 partition work, see my post to the debian-powerpc mailing list from 2002.
  • I have also run Ubuntu 6.06 on my G4 Mac Mini with excellent results.



Copyright © 2005—2006 William R Sowerbutts