Triple Boot via BootCamp Ubuntu

From OnMac.net Wiki
Jump to: navigation, search

The primary version of this doc is located here: https://help.ubuntu.com/community/MacBook

All the information here should be moved over.

The purpose of this is to allow for Triple Booting on an Intel Mac using OS X 10.4.6+, Ubuntu Linux, and XP SP2. You will need a slipstreamed XP-SP2 CD and an Ubuntu Dapper Drake 6.06 Live CD (which is just the regular installation disc). I've tested this on a 20" 2.0Ghz iMac, but I am assuming it will work on all available Intel iMac platforms thus far. This also seems to work on the MacBook and 15" MacBook Pro. Haven't tested on a Mac Pro yet. Some resolvable issues with the 17" MacBook Pro... notes below.

This guide also works for the newly released Edgy Eft (Ubuntu 6.10). To install edgy, you will either need a network connection or the DVD version.

Open up a terminal and type the following command (changing values for the drive sizes you want). Keep in mind that these partition sizes are final after they are set!

 meredon:~ mjw1$ diskutil list
 /dev/disk0
  #:                   type name               size      identifier
  0:  GUID_partition_scheme                    *93.2 GB  disk0
  1:                    EFI                    200.0 MB  disk0s1
  2:              Apple_HFS Macintosh HD       72.7 GB   disk0s2

Take the device that your Mac OS is installed on, in this case disk0s2, and resize it into 3 new partitions. Syntax is like this:

 diskutil resizeVolume /dev/disk$OSX OSXpartsize 2ndPartType 2ndPartLabel 2ndPartSize 3rdPartType 3rdPartLabel 3rdPartSize

i.e.

 diskutil resizeVolume /dev/disk0s2 40G Linux Linux 30G "MS-DOS FAT32" Windows 30G

Restart and verify by running diskutil list that the partitions were made correctly.

Now, download and install rEFIt by following their instructions.

Restart and boot off of the XP-SP2 slipstreamed disc. Select and then quick format the drive marked as C: as fat32 if you want read-write access or NTFS if you want the increased speed and security; it should be the last drive. If it isn't then you have a typo in your partition code. If you do not format the drive with the installer, Windows might not boot. Do NOT remake the partitions at this point or you will hose up the whole thing. Set up Windows as you would normally - you can use Boot Camp to create a driver CD for Windows.

Boot off of the Ubuntu installation disc. The majority of the Ubuntu install walkthrough came from this site.

Open Applications-Accessories-Terminal and type:

 sudo parted
 mkfs 3 ext2
 quit

In Edgy, you may need to do this instead:

 sudo mkfs -t ext3 /dev/sda3

As the installer will not accept an ext2 filesystem mounted at '/'.

Double click the installer on the Desktop and fill out each box correctly.

When it comes time to set up the partitions, do so manually. Because we only are able to have four primary partitions setup for the MBR mirror and Apple has already taken the first spot with the EFI System Partition, we will need to only mount the / drive to /dev/sda3, nothing else, not even a swap. This will cause an error to get thrown about decreased performance or installations errors from the lack of a swap... it will be fine and will actually install faster (I had 1 gig of RAM, so I can't guarantee anything under that). I recommend formatting the partition.

After awhile it will toss an error when it tries to install GRUB and throw a bunch of errors in an output screen; click past that. (If you do not get an error, see the Talk page)

Open Terminal and type:

 sudo su -
 mkdir /mnt/ubuntu
 mount /dev/sda3 /mnt/ubuntu
 mount -t proc none /mnt/ubuntu/proc
 mount -o bind /dev /mnt/ubuntu/dev
 chroot /mnt/ubuntu /bin/bash

Create and make a swap file. The following command will make an empty 2 gig file at /swapfile: (beware it might take some time)

 dd if=/dev/zero of=/swapfile bs=1024 count=2048000

Make the file a swap file:

 mkswap /swapfile

Set Ubuntu to use the swap:

 swapon /swapfile

And enable it at boot time by editing /etc/fstab with a text editor like nano and adding the following line (each item is separated by tabs):

 /swapfile               swap                    swap    defaults        0 0

Example command to type:

 nano /etc/fstab

Open a new Terminal window that isn't chrooted into the Ubuntu installation. Install lilo and some kernel updates:

 apt-get install lilo lilo-doc linux-686-smp linux-restricted-modules-2.6.15-23-686 linux-kernel-headers

If you are using the CD version of edgy, you will need a network connection to install the above packages. Edgy users should do this in the chrooted terminal. UPDATE: Edgy users dont need to do this download. Follow this guide which is super easy and uses grub. https://help.ubuntu.com/community/MacBook You will need to run instead of the above:

 apt-get update
 apt-get install lilo lilo-doc linux-686-smp linux-restricted-modules-686 linux-kernel-headers

When that finishes, we will make the /etc/lilo.conf config file by hand with a text editor) (edgy users still in the chroot): Example command to type:

 nano /etc/lilo.conf

Contents of file:

 boot=/dev/sda3
 default=Ubuntu

 map=/boot/map
 delay=20
 image=/vmlinuz initrd=/initrd.img
 root=/dev/sda3
 label=Ubuntu
 read-only

Edgy users need to add:

 append="quiet"

To the end of the lilo.conf file. This is because the GUI booting crashes Ubuntu.

Open a new Terminal window that isn't chrooted into the Ubuntu installation:

 sudo parted
 set 3
 boot
 on
 quit

Edgy users need to use "sudo parted /dev/sda" instead of "sudo parted". This should be executed in a normal terminal

Switch back to the chrooted terminal:

 lilo

Edgy users may need to do:

 lilo -P fix

If lilo complains about a CHS/LBA mismatch.

Reboot, use the rEFIt partition tool to make sure the MBR and GPT maps are in sync. You should now be Triple Booting! There are proprietary ATI drivers out there for Intel Macs running Linux, so check out their site. For more info about setup after initial installation, try this site, which provided the majority of the walkthrough for the Linux installation.

This *SHOULD* be the end. If you have issues or errors when running lilo continue to the bottom of the page...

[edit] ================================================================================================

Problem Freezing on the rEFIt penguin watermark, first time booting Ubuntu from HD
If you run into this problem after everything above, try booting in Windows and OS X a couple of times, and maybe also try shutting down the computer before booting Linux again. I did this, and LILO fixed itself (don't ask me how) so now I can boot into whatever I like.
This fix was an idea in Brian W. Carver's Triple Boot Debian tutorial. -AC
End section about frozen first boot

Issues on 17" MBP
I've had issues with this portion on a 17" MacBook Pro... not sure if it is because of partition table issues or architecture yet... Solution was to run:

 lilo -P fix

Then reboot into rEFIt, sync with partition manager; then boot off CD once again and run:

 lilo

WARNING: This may kill your MBR at this point...

Instead of lilo (not lilo -P fix) I used following commands and sync with rEFIt after that:

sudo su -
parted
print
set 3 boot on
quit
reboot

Exit out of the chrooted terminal and unmount all partitions:

 sudo umount /mnt/ubuntu/proc
 sudo umount /mnt/ubuntu/dev
 sudo umount /mnt/ubuntu

Reboot, use the rEFIt partition tool to make sure the MBR and GPT maps are in sync.
End section about 17" MBP issues

As usual, the typical disclaimer... Kainewynd2

See the Talk page if you just get a blank screen when trying to boot Edgy.

[edit] Creating the Swap File

'dd' always work faster with a larger block size. So when creating your '/swapfile' do it in 1 MiB blocks.

dd if=/dev/zero of=/swapfile bs=1048576 count=2048000

Takes only 20.5 sec on my 2007 Macbook.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox