Triple Boot via BootCamp
This procedure allows you to triple boot Mac OS X, Windows XP and Linux. It has been successfully used to setup a MacBook, but is untested on the iMac/mini. Therefore if you try this you do so at your own risk.
- 1 Before you start
- 2 Installing the Operating Systems
- 3 Further issues
Before you start
This procedure takes 3-4 hours (with broadband downloading), which is mostly Windows & Linux installation. Also note that if you want to undo this process without destroying and reformatting your JHFS+ partition, you'll need iPartition. This is not reversible (nondestructively) with Apple's tools.
Before you begin you will need the following:
Installing the Operating Systems
- Install Mac OS X: Install Mac OS X as normal onto your hard disk drive with a single partition. (If it's already installed, you can skip this step.) In order to save time, only install the base system at this point. Boot into Mac OS X.
- Mac OS X update: Install the Mac OS X 10.4.6 combo update (if necessary)
- firmware update: Install the firmware update for your mac (if necessary).
- Boot Camp: install Boot Camp.
- rEFIt: you can install rEFIt at this point, and it'll make life much easier (as you will always get the choice of which OS to start in, for instance)
Boot Camp & partitioning
- Run the Boot Camp Assistant and create the Windows XP driver cd. Then exit Boot Camp. DO NOT PARTITION USING BOOT CAMP: you are only using Boot Camp for the drivers, not the partitioning. If you already partitioned, it created a 3rd partition at end of the drive. You can remove it if you boot from another drive and run this command: sudo gpt remove -i 3 /dev/disk0. A simpler way to remove the partition is to use Boot Camp Assistant, which allows to "restore the startup disk to a single volume" (see its manual).
Alternatively, you can burn the disk to a CD (or DVD) without running the Boot Camp Assistant. (This is also necessary if you wish to update the drivers after setting up triple-booting.) To do so, Right/Control Click on the Boot Camp Assistant and select 'Show Package Contents'. Then copy the Contents/Resources/diskimage.dmg file to the Desktop and use Disk Utility to burn that image to a CD.
- Open up a terminal window and type diskutil list. It should look something like this:
/dev/disk0 #: type name size identifier 0: GUID_partition_scheme *233.8 GB disk0 1: EFI 200.0 MB disk0s1 2: Apple_HFS Macintosh HD 233.4 GB disk0s2
- Find the identifier of your Mac OS X partition (in this case disk0s2) and type the following in order to repartition the drive. In the example below, I have repartitioned a 100GB hard disk to contain 60GB Mac OS X, 17GB Linux and 15GB Windows XP partitions. You can change the volume names/sizes but not the order. The command syntax is...
sudo diskutil resizeVolume [disk identifier] [disk size] [partition type] ["Partition label"] [partition size] [partition type] ["Partition label"] [partition size]
so, you'll enter something like...
sudo diskutil resizeVolume disk0s2 60G "Linux" "Linux" 17G "MS-DOS FAT32" "Windows" 15G
- If you get the error message "Resizing encountered error: the chosen size is invalid for the chosen file system..." it usually means the total size of the three partitions is larger than the original size of the first partition. If you look at the above output of diskutil list you'll see that Apple_HFS Macintosh HD reports a size of 233.4 GB (the symbol is disk0s2). This means that the new partition sizes (60G + 17G + 15G in the example) should add up to no more than 233.4 GB. Since 60G + 17G + 15G = 92G this is safe. Of course, those numbers were provided from an example using a 100 GiB hard drive while the diskutil list numbers were taken from a 250 GiB drive.
- If diskutil resizeVolume still reports "chosen size is invalid..." errors, an alternative solution is to try to use MB instead of GB as following;
sudo diskutil resizeVolume disk0s2 60000M "Linux" <name of linux volume> 17000M "MS-DOS FAT32" <name of windows volume> 15000M
- In some case, the diskutil resizeVolume reports "Resizing encountered error No space left on device (28) on disk" even you've used "diskutil list" command to confirm that disk space has enough apace. Do this work around will fix the errors;
1. Resize the current partion size first;
sudo diskutil resizeVolume disk0s2 60G
2. Creat the rest of partions;
sudo diskutil resizeVolume disk0s2 60G "Linux" "Linux" 17G "MS-DOS FAT32" "Windows" 15G
- Once you have completed the resizing, it will ask you to reboot. Reboot Mac OS X as you would normally do. When it starts up, run diskutil list again and verify that your new partitions have been created!
- Insert your Windows XP CD and restart. When you hear the chime, hold down the C key (to boot from CD).
- Windows Setup will start. At the disk partition screen, select the C: drive. "Quick partition" it as FAT32. Setup will continue and eventually it will restart your computer. (see Talk:Triple_Boot_via_BootCamp for a workaround if the Windows installer does not offer to reformat your windows partition at install time - the Windows installer should format it here or it may not be bootable)
- After the first restart, hold down the OPTION/ALT key and select the Windows HDD from the bootloader in order to continue setting up XP. You will need to repeat this until Windows is fully installed. It will not work yet (notably, the network won't) -- you need to install drivers.
- Driver CD: Finish the Windows XP installation by using the driver cd you created earlier to install the system drivers; you will need to click through (hit "Continue Anyway") to many messages of the form:
"The software you are installing has not passed Windows Logo testing...", but otherwise don't need to do anything.
- Activate windows: Now that your network card works, activate Windows (so that it doesn't stop working)
I think as of Boot Camp 1.1.2, the following is taken care of by the drivers CD. If not you will likely want to add some of the following utilities to make Windows more usable with your Mac hardware, notably:
- Apple Mouse so that you can right-click with 'Control' (put in your startup folder)
- Microsoft Keyboard Remapping if you want Delete, Page Up/Page Down, and other changes.
- A virus scanner (else Windows complains)
You now have a dual boot system! But obviously, we aren't finished yet.
- From here, you need to bootstrap your favorite Linux distro. Depending on the variant, this may also require you to compile your own kernel.
- The easiest way to compile your own kernel is to download a vanilla linux kernel and use the kernel config file from mactel-linux.com BUT NOT THE KERNEL PATCH. The kernel patch is necessary only for elilo whereas we will be using lilo.
- We now need to set up the Lilo bootloader so that we can boot into Linux. Install Lilo in the manner that is normal for your distro of choice.
- Create the /etc/lilo.conf file as follows:
# Global LILO settings boot=/dev/sda3 timeout=5 default=Linux # Kernel specific LILO settings image=/boot/<kernel image file> label= Linux read-only root=/dev/sda3
- Next Install Lilo onto the partition record of your Linux partition:
Via Debian etch
Further advice is at: Brian W. Carver's HOW-TO, but it is now out-of-date: notably, the network card is supported and X is set up correctly.
Lots of Debian-specific information is at: Debian Wiki on MacBook
- Install rEFIt: I installed rEFIt first; this not only makes it easier to choose OS on boot, but it allows you to use gptsync to deal with GPT/MBR discrepancies.
- Burn CD: Download the net installer (I used Debian etch RC1 net install) and burn
- Boot from CD: insert the CD, reboot, and choose the CD from the rEFIt menu
- ? I was unable to use the built-in keyboard to start the boot process! When I inserted a USB keyboard, I was able to proceed, and I could use the built-in keyboard later in the process
- Expert install: type expert at the install prompt (do not just hit ENTER!), as we will want to partition and set up booting manually
- Most of the installation process is as usual (click-through); we flag differences below.
- Partition: format the third (empty) partition; you can use whichever file system you want except xfs which is incompatible with lilo; set mount point / & flag it bootable. You will get a warning that you are not setting a swap partition. Say "OK" and move on: we don't have enough partitions for a swap, and we will instead make a swap file later. This step messes up the partition table, so you will need to fix it later (with gptsync), and work around it with LILO below.
- Alternatively, you can set up a lvm logical volume from the linux partition, and then define as many partitions as you need in the lvm system. Lilo is able to boot a system that has all the partitions under lvm !
- Boot: GRUB does not support the GPT/MBR hybrid setup (as of this writing), so we instead use LILO: we install LILO on the Linux partition, and use rEFIt as the boot manager (which then loads LILO).
- !!! We cannot just install LILO, as the partitioning (gparted?) trashed the MBR. Apparently, you can fix this by running gptsync before installing LILO, via dropping to a command prompt and typing:
chroot /target apt-get install refit /target/sbin/gptsync /dev/sda
(This is from Debian Wiki on MacBook.) Presuming that this works, in the next step, LILO will succeed, and you won't need to do it manually.
- LILO: Install LILO to the partition, not to the MBR!!! It will fail; this is ok. Drop to a shell (using the option at the bottom of the installer), and edit lilo.conf via
Comment out the reference to Windows XP at the end (rEFIt is dealing with booting, not LILO), then setup LILO via:
chroot /target /sbin/lilo -v -P ignore
-v makes it verbose, and, crucially, -P ignore tells LILO to ignore the confusing, out-of-sync hybrid GPT/MBR (it may be possible to instead use gptsync, but that involves a reboot). This should succeed; now exit the shell, and choose "Continue without a boot loader", as the Debian installer doesn't know that you manually setup LILO.
- Done! (or are you?): you can now finish the install and reboot: Debian is set up
- gptsync: In rEFIt, do not boot: go to the EFI shell, and type gptsync: this will tell you that the partition table is out of sync, and will offer to sync it for you. Say "yes", naturally. Now reboot and all systems should be go!
- swap: as there is no swap partition, create a 1GB swapfile via:
dd if=/dev/zero of=/swap bs=1024 count=1048576 mkswap /swap swapon /swap chmod 600 /swap
Now you are actually done with installing; there is some hardware configuration (below).
Hardware: What works, what doesn't?
See Debian Wiki on MacBook for up-to-date info on hardware especially.
- Monitor: Install 915resolution; on Debian,
apt-get install 915resolution
...and it works automatically (restart X, or perhaps reboot). Without this, you get 1024x768 resolution, which is very fuzzy. (This loads the 1280x800 video mode onto your Intel 915 video card, so that it works properly.) Note that your xorg.conf will list 1280x800 (presuming you selecting this during install), but without 915resolution, it won't work.
(I imagine this should only be necessary on the Mac Mini, MacBook, and the low-end iMac; Mac Pros, MacBook Pros, and the higher-end iMacs don't use Intel graphics.)
Currently, your network card and X are setup correctly, and monitor does with 915resolution; sound works as of Linux kernel 2.6.18-rc1.
I do not know about other accessories (iSight camera), and I don't know an easy way to setup the keyboard.
- From here you can either setup the mac to boot via rEFIt (recommended) or via NTLDR
Booting your mac via rEFIt
- Restart your computer into Mac OS X
- Mount the rEFIt disk image, and copy the efi folder contained within to the root directory of your Mac OS X partition.
- Open a terminal window and install rEFIt via:
cd /efi/refit ./enable.sh
- (optional) Open the /efi/refit/refit.conf in textedit to customise the boot menu to your requirements.
Now restart your mac. If everything has been done correctly, the rEFIt menu will be displayed with icons for all three operating systems. Select the OS of your choice using the arrow keys and return.
gptsync: if the GPT & MBR get out of sync (as they may when installing Linux), use gptsync to fix this: at the rEFIt screen, choose the command prompt, let it boot, then type gptsync at the prompt, and it will check if GPT & MBR are in sync, and offer to fix them if they are not.
Booting your mac via NTLDR
You do not need to do this if you have installed rEFIt; this uses the Mac native loader (to select between Mac & Windows), plus the Windows NT NTLDR (to select between Windows & Linux), instead of rEFIt (which selects between all 3, via a nice GUI).
- You now need to mount your Windows partition, create a chainload file for ntldr and then add a reference to it in the Windows boot.ini file:
mkdir /mnt/windows && mount -t vfat /dev/sda4 /mnt/windows cd /mnt/windows dd if=/dev/sda3 of=linux.mbr bs=512 count=1 echo 'C:\linux.mbr="XYZ Linux"' >> /mnt/windows/boot.ini cd && umount /mnt/windows
Now restart your Mac. If everything has been done correctly, when you hold down the OPTION/ALT key, you will be given an option to boot to OSX and Windows. Select Windows. NTLDR will now show up and present you with the option to either boot into Windows or Linux. Select Linux!
- Version 8.24.6 or later of ATI's notebook linux drivers support the X1600 card found the MacBook Pro. They are available on (ATI's website)
- wstein has a working xorg.conf using Ati's drivers and lilo+bootcamp for triple boot. This xorg.conf file is written for a Macbook Pro, but has also been tested successfully on a 20" iMac. (Simply change all occurances of "1440x900" with "1680x1050")
Upgrading Boot Camp from 1.0 to 1.1
On the 16th August 2006, Apple released an updated version of Boot Camp which includes drivers for iSight, amongst other things.
(The point of this upgrade is just to install newer drivers, so you just need to create a new drivers disk; you don't need to do any repartitioning or reinstalling of OSes.)
However the Boot Camp Assistant will not run on triple boot setups due to the different disk layout. In order to upgrade, you need to use the following workaround:
- Download version 1.1 from Apple's website (the link is at top of this article).
- Install as normal.
- Locate the Boot Camp Assistant icon in utilities, right click (or ctrl-click for single button mice) on it and select "show package contents".
- In the finder window that opens, double click on contents, then double click on resources.
- Right or ctrl-click on the diskimage.img file and select "open with -> disk utility".
- Insert a blank cd, and burn the diskimage.dmg file to create the updated windows driver cd.
- Restart into windows, and insert the driver cd to update your drivers.
Restoring your Mac to its original state
The following instructions worked for me on Mac OS X 10.4.8 with BootCamp 1.1.2.
Basically, there are two operations that need to be done:
- Remove the Linux and Windows partitions.
- Resize the Mac partition to the full size of the disk.
Removing the partitions can be done with "gpt":
- Read the "remove" and "show" sections of "man gpt".
- Reboot using the Mac OS X install disk.
- Run the disk utility and make sure all volumes on your harddisk are unmounted. I've had to repeat this step after each gpt command, which, for some reason, caused them to get mounted again.
- Run the terminal.
- Use "diskutil list" to find the device identifier of your harddisk (usually, it's "/dev/disk0").
- Use "gpt show" to find the indices of the volumes you want to remove (if you've completed the triple booting sequence successfully, it should be 3 and 4).
- Use "gpt remove -i <index> <device identifier>" to remove the Linux and Windows volumes. Replace "<device identifier>" and "<index"> with the values you found in the previous steps. Obviously you will need to run this command once (with the corresponding index) for each volume you want to remove. Note: Volumes are mounted automatically whe you remove a partition. Dismount them again.
- Close the terminal, run the disk utility, check that the only remaining volume is the one you wanted. Make sure it's mounted.
- Close disk utility and quit the installer. In the "Startup disk" dialog, select Mac OS X on your harddisk.
- After rebooting, you should be back in your regular Mac OS X, with the Linux and Windows volumes gone.
Resizing the Mac volume is surprisingly difficult. Although "diskutil resizeVolume" claims to be able to grow volumes as well as shrink them, in reality, it fails with a "Resizing encountered error No space left on device (28) on disk" error message. Luckily, Boot Camp Assistant has an option to restore your disk to its original single-volume state, and that option will make that volume span the entire disk. To convince it to do this, however, you first need to use it to split your Mac volume into a smaller volume and a Boot Camp (Windows) volume. The steps:
- Run Boot Camp Assistant. Note, this will only work after you've removed the Linux and Windows volumes, as Boot Camp Assistant expects a single-volume disk.
- Skip the "Burn a Macintosh Drivers CD" step and split your disk into two volumes as instructed by Boot Camp Assistant. The actual sizes of the volumes don't matter.
- Tell Boot Camp Assistant you do not want to install Windows now. It will then make you reboot.
- Run Boot Camp Assistant and choose the "Restore to a single Mac OS partition" option. It should show you that the new size of your Mac volume will be as large as the entire harddisk. Confirm the restore, and you're done.
Resizing Windows and Linux Partitions
- Read the "remove" and "show" sections of "man gpt".
- Reboot using the Mac OS X install disk.
- Run the terminal
- Dismount all volumes
umount /dev/disk0s2 umount /dev/disk0s3 umount /dev/disk0s4
- Remove 3rd and 4th partitions. Note: Volumes are mounted automatically when you remove a partition. Dismount them again.
gpt remove -i 3 /dev/disk0 umount /dev/disk0s2 umount /dev/disk0s4 gpt remove -i 4 /dev/disk0
- Resize partitions as you like using diskutil
diskutil resizeVolume disk0s2 40G "Linux" "Linux" 51G "MS-DOS FAT32" "Windows" 20.5G
- Check new distribution with diskutil
- Reboot and reinstall Windows or Linux