26 MayMacBook Triple-Boot HowTo (With Debian Etch and XP Upgrade version).

Triple-Boot on Brian's Black MacBook (Thumbnail) 0. Buy a MacBook. I suggest 120Gb HD and 1 or 2GB RAM. Buy an Upgrade version of Windows XP (so long as you have an older Windows CD)–My cost $99. Buy an external CD-Rom drive with USB connection–My cost $40. Find two blank CD-Rs (one for XP Drivers, one for Debian Etch Net Install). An additional CD-R or USB-key will come in handy for subsequent configuration.

1. Prepare XP Drivers. Follow the instructions at OnMac up to a point. That is:

Take the steps necessary to install Boot Camp and use that first blank CD-R to burn the Windows XP drivers. Then QUIT Boot Camp without using it to partition your drive!

2. Partition your hard drive. (Um, you have a back-up, right?)

Type: diskutil list
It should give you something like:

   #:                   type name               size      identifier
   0:  GUID_partition_scheme                    *111.8 GB disk0
   1:                    EFI                    200.0 MB  disk0s1
   2:              Apple_HFS Macintosh HD       111.4 GB  disk0s2 

Find the identifier of your Mac OS X partion (in this case disk0s2) and type the following in order to repartition the drive. In the example below, I have repartitioned a 120Gb Hard disk to contain 60Gb OSX, 20Gb Linux and 31Gb windows partitions. You can change the volume names/sizes but not the order. (Making the GNU/Linux partition smallest made sense to me because it will be the only OS able to read all the other partitions so it will be able to access all the files, wherever located. So, probably all my photos and mp3s are going to be on the OS X partition.)

sudo diskutil resizeVolume disk0s2 60G Linux <name of linux volume> 20G "MS-DOS FAT32" <name of windows volume> 31G

3. Install Windows XP. You continue to follow the directions at OnMac except you plug in your external CD-Rom drive via USB and you place your old Windows 98SE disc (or comparable) in there. The Windows XP installer will find the external CD drive and your old copy of Windows without you having to do anything, except maybe press enter. Stop following OnMac’s directions just before you get to installing GNU/Linux.

When Windows boots for the first time, use your Windows XP drivers disc to add the drivers you need. Then add this Apple Mouse Utility to get right-clicking with CTRL. You’ll probably want that in your Startup folder.

You’ll also probably want a program to remap your keyboard. Currently, I don’t know how to make all the keys on the MacBook work under Windows, but I decided that a true DELETE key and a page-down key were important enough to me to sacrifice my right Apple key and that stupid little extra enter key. The linked “remapkey” program will allow that.

You now have a dual-boot system!

4. Install the rEFIt bootloader. Download the latest rEFIt (I used 0.7). Mount the disk image, copy the efi folder to your root directory, and run the enable script. That is, you’ll need to open a terminal in OS X and type:

sudo mv /Volumes/rEFIt/efi /efi
cd /efi/refit

I would try booting into both operating systems a couple times. I didn’t do this step at this point, and think it would have gone more smoothly if I had. So, I’m asking you to save yourself some trouble: do it!

Update: I now believe that if you run the gptsync tool that rEFIt provides then the Debian installation (particularly the lilo part) will go much more smoothly. You need to get your EFI and MBR in sync before going to the next step. I didn’t do this at first and think that’s why lilo was such a pain to get working.

5. Install Debian Etch. The Sarge 3.1r2 Net Install disc will not work because it lacks the Marvell Gigabit Ethernet driver you need and because it won’t recognize the SATA hard drive in the MacBook. I used the Etch 2006-05-18 nightly which is already gone from the ftp site. You should get the latest Etch nightly Net Install ISO (Typically under 128Mb). Use that second CD-R to burn the iso and set up somewhere with a fast ethernet connection.

A 2.6 kernel boots by default, but I typed “expert26″ at the boot prompt anyway. I think you could just type “expert” but in any event you need to do the expert version of the install, not the normal one you get by just hitting enter.

Be sure you only format your third (empty) partition! I chose ext3, mount-point /, and flagged the partition bootable. You should select CONTINUE when it warns you that you don’t have a swap partition. We’ll make a swap file later.

Choose the 2.6.15 kernel or whatever the latest one is that your Etch installer provides.

During package selection, let tasksel install the desktop environment and the standard system (The top and bottom options, I think). You can also save yourself a lot of trouble if you add the following packages which we’ll need to compile a new kernel (among other things) later (Unfortunately none of your network connections are going to work on the first boot of Etch, so install these packages NOW):

kernel-package libncurses5-dev tk8.4 tcl8.4 module-assistant

When x.org is being configured choose 1280×800 and everything below that. We’ll also have to make some slight modifications to our /etc/X11/xorg.conf on reboot (described below).

The installer will fail when it comes time to install LILO. That’s OK. Let it try to install into your Linux partition and fail, but don’t mess with the MBR! Then go to a shell from within the installer (the option at the bottom) and type

nano /target/etc/lilo.conf

Comment out the stuff about Windows XP at the end of the file. rEFIt is handling that. Then:

chroot /target
/sbin/lilo -v

I had a good bit of trouble at this step. Keep at it until LILO is happy (although eventually if nothing works just move on and rEFIt will probably fix things later.) Your /etc/lilo.conf probably just needs to say this:


Hopefully because you already installed rEFIt you’ll be allowed to boot your new Debian installation right away. I wasn’t able to do this because the partition table was inconsistent. If you get strange behavior from rEFIt (I had it where selecting Tux would boot Windows, and where selecting Tux or Win wouldn’t boot anything, etc.) then run the gptsync tool that rEFIt provides and you’ll probably see that the GPT partition record doesn’t match the MBR. Let gptsync work its magic and then try rebooting all your OSs a few times, especially OS X. I think a series of reboots finally fixed things for me. I had just run the gparted liveCD just to take a look at the partitions, but I didn’t change a thing with gparted. Nonetheless, when I rebooted right after running that liveCD my Debian partition booted for the very first time via rEFIt. I’m slightly stumped as to what finally made it all work.

6. Add a 1GB swapfile. Once you finally boot into Debian, type:

dd if=/dev/zero of=/swap bs=1024 count=1048576
mkswap /swap
swapon /swap
chmod 600 /swap

Edit /etc/fstab to include:

/swap       none      swap     sw      0      0

You can type “top” to have a look at the swap and see whether it’s being used.

7. Improve the /etc/X11/xorg.conf with a few edits. This Modeline and sync rates are what an Ubuntu CD automatically generated. It may ruin our LCDs, so I warn you that these instructions are provided AS IS without warranties of any kind and with all faults.

Make changes like so:

Section "Device"
        Identifier      "Generic Video Card"
        Driver          "vesa"
        BusID           "PCI:0:2:0"

Section "Monitor"
        Identifier      "Color LCD"
        Option          "DPMS"
        HorizSync       28-64
        VertRefresh     43-60
        Modeline "1280x800@60" 83.91 1280 1312 1624 1656 800 816 824 841

Also make sure that the Screen section lists 1280×800 as the first option for all your depths. (I don’t know how this happened–probably my fault–but at first I had 1200×800 instead, cheating myself out of 80×800 pixels!) UPDATE: I was never really getting 1280×800 until I started using 915resolution. (apt-get install). For using an external monitor see this config file on the mactel-linux-users mailing list.

8. Compile new Linux kernel with support for Marvell Gigabit Ethernet. Hopefully you installed everything you needed to compile a kernel during installation, if not, now is when that extra CD-R or a USB key will be used. You can get needed packages for kernel compilation on another machine (or OS on the MacBook) and transfer them to your new installation. In any event you need a new Linux kernel. I used, the latest stable version as of this writing. So put at least that on your USB key or CD-R, copy it to /usr/src and then compile the kernel the Debian way:

tar -jvxf linux-
rm linux
ln -s linux- linux
cd linux
make menuconfig
# be sure to build in SATA and ext3 support or your kernel won’t boot. You’re also looking for the Yukon Gigabit Ethernet driver known as sky2. You should compile for Pentium-M processors and include SMP support. RTC-dev must be built-in on Core Duos in order for your hardware clock to work right. See this rtc thread. You can see my (bloated) kernel config.

make-kpkg clean
make-kpkg --append-to-version=.060525 kernel_image
# 060525 is the date in YYMMDD format

cd /usr/src
dpkg -i linux-image-
# Note again that your YYMMDD version will likely differ.

Edit your /etc/lilo.conf file to reflect the changes. Mine now looks like this:




Remove the lines “prompt” and “timeout=100″ if you just want it to automatically boot the default kernel.

RUN /sbin/lilo -v OR YOUR MacBook MAY NOT BOOT!

Cross your fingers and reboot.

9. Add Linux wireless support.
Once your ethernet interface is working again, include the following in your /etc/apt/sources.list to get the needed wireless driver. (Once wireless works, you might want to comment it out so that no future upgrade ever breaks it.)

#NEW Archive for pkg-madwifi snapshots GPG key: 71409CDF
deb http://debian.tu-bs.de/project/kanotix/unstable sid madwifi
deb-src http://debian.tu-bs.de/project/kanotix/unstable sid madwifi

apt-get update
apt-get install madwifi-source madwifi-tools

You want to install madwifi-ng the Debian way using module-assistant. Their instructions work beautifully (and have changed several times in recent weeks, so always refer to their instructions if something above seems broken.)

10. TO DO: Figure out how to use MacBook-specific keys like “fn”, try the Bluetooth, fiddle with infrared, and find a way to monitor CPU temp and fan speed. Sound works via headphones but not internal speaker. iSight now works. See instructions at the MacBook entry of the Debian wiki. Adding an external mouse provides right-click or use xmodmap to assign the eject key to right-click. Haven’t even tried the Bluetooth/infrared yet.

You can read my output from lspci, cpuinfo and cpufreq on the mactel-linux wiki.

2 Responses to “MacBook Triple-Boot HowTo (With Debian Etch and XP Upgrade version).”

  1. Daniel Lillqvist says:

    Fantastic. I’ll follow your guide as soon as I have got my hands on the Leopard. Very interesting way to work in the future with three differently working operating systems. Picking the best from the best and putting together an ultimate operating system, well at least in the conscious mind. Thank you!

  2. […] Master Boot Record. Originally (the old days), pulling this off required a lot of hacking (like this example and this example using this method). The end result, which is still in use today using rEFIt, is a […]