Debian Install Tutorial for MacBook

Here I describe simple tutorial to install Debian on Macbook. (initially written for lenny beta2 CD on 2008-11-01, using MacBook Core2 Duo Japanese model but applicable to other locales)

(!) Please avoid adding corner cases and detail discussions here. Please refer to . Many problems on etch has been resolved too.

There are 3 major issues with current lenny beta 2 CDs for MacBook:

There is a modified lenny beta 2 netinst installer CD image at : as d-i-osamu-grub2.iso with the corrected grub-installer package. (See DebianInstaller/Modify/CD how I did this with diunpk and dipk.)

MacBook installation prerequisites

(!) Please update your Mac OS X itself and all system softwares including firmware prior to the installation of GNU/Linux.

MacBook has few special keys:

Apple MacBook is build with Extensible Firmware Interface (EFI) for booting system and has SATA harddisk as main boot disk which deploy new GUID Partition table (GPT).

This is different from classic PCs which use PC BIOS to boot and partition data are stored in MBR.

GPT partition data are arranged not to overstep on classic MBR or classic boot record on each partition.

Whenever you update your GPT partition data on the boot disk with utility program which do not know about the hybrid format, your classic MBR record is zapped after using them. For example:

In order to boot system under classic BIOS emulation mode, you need to restore hybrid partition data on MBR using data in GPT by:

These tools are needed since classic bootloaders used under BIOS emulation mode need these MBR data.

{i} Some newer version of MacOS X diskutil program is supposed to update hybrid partition table. But use of diskutil may cause problem with partition type data such as Linux ext3. Thus it is safest to use parted and GPT synchronization tool in sequence to have correct hybrid partition table.

<!> Use of parted to update GPT partition will zap MBR and bootloader installed in it (/dev/sda). You need to run and GPT synchronization tool such as gptsync to have correct hybrid partition table. You also need to run "grub-install /dev/sda" to reinstall BIOS emulation grub-pc in it. It is safer to install bootoader in places such as /dev/sda3 to avoid overwriting.

(!) Use of gptsync and "grub-install /dev/sda" are compatible to each other.

Please note first partition is used by GPT table itself. Let's think following configuration:

Installed contents

Linux device name

Mac OS X device name

Grub legacy device name

Grub 2 device name






Mac OS X





Linux amd64





Linux i386





Linux testing





Data MSDOS (vfat)










In order to chain boot though BIOS emulation provided by Apple, I will deploy following boot sequence and partitioning here:

  EFI boot system -> rEFIt program ->+
    +--> Mac OS X      on /dev/sda2 (by rEFIt directly)
    +--> Linux testing on /dev/sda5 (via GRUB 2 MBR located on /dev/sda)
    +--> Linux amd64   on /dev/sda3 (via GRUB 2 BR  located on /dev/sda3)
    +--> Linux i386    on /dev/sda4 (via GRUB 2 BR  located on /dev/sda4)

GRUB 2 boot loader from BIOS emulation is grub-pc which can access any GPT partition. It looks like 3 places to put BIOS compatible boot record. (Do not install boot record used by this BIOS emulation in /dev/sda1 nor /dev/sda2. I do not know the side effect.)

Install rEFIt to Mac OS X

EFI bootloader rEFIt is available from the rEFIt Project:

The use of rEFIt makes system maintenance easy. It provides proper BIOS emulation initialization (via proprietary Apple code) and can chainload another BIOS compatible bootloaders, such as grub-pc, located on MBR or on each partition.

Downloading "Mac disk image" under Mac OS X and follow instruction at: is easiest.

{i} "bless" is the command to store location of EFI boot loader such as rEFIt to NVRAM. It is run by rEFIt installer.

Reboot system and check rEFIt works.

{i} Read the documentation "Myths and Facts About Intel Macs":

{i} You may as well get ready with GRUB bootloader CD now: grub-rescue-pc package for GRUB 2.

Shrink Mac OS X partition with diskutil

In order to make space for Linux, run following command to shrink Mac OS X partition from normal Mac OS X system:

Mac OS X $ sudo diskutil resizevolume disk0s2 20G
Started resizing on disk disk0s2 Macintosh HD
Resizing Volume
Adjusting Partitions
Finished resizing on disk disk0s2 Macintosh HD
WARNING: You must now reboot!

(When rebooting with rEFIt, always choose "Disk Partitioning and synchronize" to be safe.)

Then you have unused disk space. You may create some dummy partitions as DOS data partition now.

Install Debian lenny

/!\ Do not chose to install GRUB into partition during installation process. This is because d-i (lenny: RC2) is buggy (Bug#502446) and choses grub-pc on GPT machine. It will not function as expected if they are installed on partition such as /dev/sda3. It works with MBR (/dev/sda) but MBR is risky since it will be zapped by running parted.

Here is an example of efficient install process.

{i} Recent rEFIt can be configured to boot non Mac OS X first by editing its configuration in Mac OS X at: /efi/refit/refit.conf

{i} When booting with GRUB, your keyboard will act like US keyboard.

<!> Buggy "/etc/grub.d/30_otheros" created by buggy grub-installer package contains entries such as "set root=(hd0,2)" for a menu entry associated with "/dev/sda3". This offset of 1 is caused by Bug#502446. Simply change it to "set root=(hd0,3)" etc.. You must run update-grub after this to activate this. If os-prober is installed as above example, you may erase this buggy file as alternative.

{i} If you did not fix "/etc/grub.d/30_otheros" as above, you can still edit in interactive the GRUB menu by pressing "e".


(!) Have USB connected keyboard ready. Keyboard on MacBook acts funny under some condition. Beta2 under BIOS emulation did not require this..

(!) Some people say that use of the following voodoo phrase as kernel boot parameters is a good idea but I did not need this for i386 and amd64 install via rEFIt using BIOS emulation:

install noapic irqpoll acpi=force

Booting system (emergency)

(!) Booting while pressing "C" key forces system to boot with CD/DVD first before poking HDD. (Use this you really broke system and re-installing Mac OS X.

If grub can be started, linux installed in /dev/sda4 can be started by providing followings to grub shell:

set root=(hd0,4)
linux /vmlinuz root=/dev/sda4 ro
initrd initrd.img

More on system configurations

Please refer to MacBook for specifics.

-- OsamuAoki