codeThis article describes how to install Ubuntu Linux on a MacBook Pro laptop. Although I chose Ubuntu Linux as the Linux distribution, you can easily replace that for whatever distro you like the most. It’s only a matter of choice and freedom.
Download Ubuntu Linux
Download the latest
desktop ISO image from Ubuntu’s web site and burn it down onto a blank CD. I will use this CD to install Ubuntu Linux on the MacBook Pro and also for recovery purpouses in case anything goes wrong.
Install Apple Boot Camp
Boot Camp is some sort of BIOS emulation to allow some legacy operating systems that don’t support EFI to work on MacBooks. Although Linux does support EFI, it seems it only works reliably when used on Itanium-based machines and in combination with the ELILO bootloader. Anyways, I will use plain LILO and BIOS emulation provided by Boot Camp.
Download Boot Camp from Apple’s Web site and install it. After installation, go to Applications -> Utilities and launch Boot Camp.
The first time you run it, Boot Camp will offer to burn some Windows drivers onto a blank CD. We can skip this step since we are not going to install Windows. Next, we need to shrink the Mac OS X HFS+ volume in order to leave space for the Linux volume. I chose to assign 23GB of disk space to Linux, but your mileage may vary.
rEFIt is an extremely powerful GUI EFI bootloader. It allows you to boot up Mac OS X, Linux and even Winblows, graphically, while also allows one to peek inside EFI (using the built-in EFI shell).
Download rEFIt from here. You can choose whatever format you like — Mac disk image, ISO image or tar.gz. The latest version, at the time of this writing, was this.
Extract the /efi directory from the file you downloaded and place it into the root directory of your Mac OS X boot volume. For the tar.gz file you can run:
tar -C /tmp -zxvf refit-bin-0.7.tar.gz
mv /tmp/refit-bin-0.7/efi /
Install Ubuntu Linux
Once Boot Camp has been installed, the Mac OS X volume shrinked to leave space for the Linux partition, and rEFIt installed into your Mac OS X boot volume, we will start the Ubuntu Linux installation.
Insert the Ubuntu Linux CD into the CD-ROM, reboot while holding down the C key — boot from the CD-ROM — and wait for Ubuntu Linux to finish starting up. You should be dropped into a brown-coloured beautiful desktop.
Before installing Ubuntu Linux, make sure you have network connectivity. For wired Ethernet it’s usually as easy as plugging in an Ethernet cable and waiting for a DHCP lease. For Wireless it depends on whether you can get associated with a public/open Wireless Access Point. Fortunately, the MacBook Pro uses an Atheros-based wireless card, so it will just work out of the box, even when using WEP, WPA or WPA2.
To configure for wired Ethernet and DHCP:
ifconfig eth0 up
To configure for wireless Ethernet, via a public hot spot and DHCP:
ifconfig ath0 up
iwconfig ath0 essid GoogleWifi
Check you have network connectivity, usually by pinging a well know host. I tend to use W.X.Y.Z as a check — don’t think it’s a good idea to tell the whole world the machine I use for ping purposes as it system administrator won’t like it much:
ping -c W.X.Y.Z
PING W.X.Y.Z (W.X.Y.Z) 56(84) bytes of data.
64 bytes from W.X.Y.Z: icmp_seq=1 ttl=235 time=179 ms
64 bytes from W.X.Y.Z: icmp_seq=2 ttl=235 time=179 ms
64 bytes from W.X.Y.Z: icmp_seq=3 ttl=235 time=178 ms
— W.X.Y.Z ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2007ms
rtt min/avg/max/mdev = 178.278/178.993/179.612/0.734 ms
Now, double click the Installer icon you will find on the desktop. This will start the Install Wizard that will guide you during the installation process.
The next screens are rather easy to go through: choose your language, keyboard layout, username and password, time zone, etc. The important steps begin once you are prompted about the partition layout. Choose to manually edit the partition table and click on Forward. The next screen allows making changes to the partition layout. I strongly recommend on not making any changes and click on Forward again.
On the next screen, make sure the EFI GPT partition is not mounted — click into the dropdown list and select the blank entry. Mount the Linux partition, usually /dev/sda3 as / and then click on Forward.
- NOTE:I didn’t create a swap partition, so the installer complained at a later point. If your computer has enough RAM (>192MB), you can go on with the installation and create a swap file once the system is installed and ready.
At the end of the installation, GRUB will fail to install. That’s totally normal. Instead, we will use and install LILO as the boot loader. Open a terminal and run the following commands:
mount -t proc none /target/proc
mount -o bind /dev /target/dev
The last command places ourselves into the Linux filesystem of the newly installed Ubuntu Linux.
Next, install LILO and the SMP kernel — since MacBooks have an Intel Core Duo:
apt-get install lilo lilo-doc linux-686-smp
cat > /etc/lilo.conf << EOF
lilo -b /dev/sda
- NOTE: I had to append the noapic option to the kernel command line due to a sporadic kernel panic while booting related to the APIC stuff. Since these MacBook laptops are SMP systems, APIC is expected to replace the aging ISA-compatible way of assigning IRQs. However, it doesn’t seem to work reliably, at least on my laptop.
Exit the chroot jail — usually by running “exit” or typing ^D — and double check you are not inside the chroot jail anymore:
Disk geometry for /dev/sda: 0kB - 100GB Disk label type: gpt Number Start End Size File system Name Flags 1 200kB 210MB 210MB fat32 EFI system partition boot 2 210MB 76GB 76GB hfs+ Merged_untitled 3 77GB 100GB 23GB fat32 Untitled
Flag to change? boot/hidden/raid/lvm/hp-service/msftres?
New state? on/[off]?
Parted understands the new EFI GPT partition table format, while fdisk does not. I think that’s the reason why, after the Ubuntu installer formats the partition and starts copying files onto it, all partitions except sda1 vanish from fdisk‘s listing.
Since EFI boot support is still experimental, we will use standard LILO (it seems GRUB uses certain BIOS calls which are still not supported by Boot Camp BIOS emulation). However, this requires syncing the EFI GPT partition table with the old-fashioned, BIOS-compatible MBR partition table or else Linux won’t boot. We will do this syncing from the rEFIt main menu at a later point.
Check that LILO got installed by running:
hexdump -C /dev/sda | less
Look for the string LILO at the beginning of the listing. If it’s missing, try reinstalling LILO again.
Before rebooting, we need to unmount all the partitions that we mounted before:
I’ve seen the last command failing to unmount the root filesystem a couple of times. It seems some process has opened files on it, but I’ve been unable to catch it up by using fuser or lsof.
Enter the rEFIt Partition editor and make sure the MBR/GPT maps are in sync.
Now, we are ready to boot into Linux, although there are some rough small things we need to get fixed, like the video resolution and aspect ratio.
14 thoughts on “Installing Ubuntu Linux on a MacBook Pro”
Perfect instructions! I just used followed your procedures this morning to install Ubuntu on my new MacBook (2GHz Intel Core Duo/120GB 5400RPM SATA/2GB DDR2). I would suggest adding instructions for becoming root to do the chroot work installing LILO (# sudo su). I’m a fairly savvy Linux Ubuntu user but had forgotten how to do this on the Live CD.
Pingback: » Re: installing Ubuntu on Mac - ubuntu.sitebolt.net
I just spent a frustrating few hours trying to resolve a boot issue with Ubuntu on a MacBook Pro. Everything appeared to be fine after following your instructions EXECPT the boot would fail with a “Cannot open /dev/root” error. After much fiddling with lilo.conf and even trying grub, I eventually worked out that the problem was the BIOS parameters for accessing the hard drive.
To solve the problem and get the installed kernel to boot, I had to append “root=/dev/sda3″ to the kernel boot options. You can do this by updating your lilo.conf to say:
Just got Xubuntu working on my shiny new MacBook Pro. This worked perfectly, although it’s worth noting that I needed Greg’s workaround as mentioned above – with your default lilo.conf I got a “ignoring entry ‘boot'” message along with “Added entry ‘Ubuntu'”. On rebooting, then choosing Linux from HD in rEFIt, the boot process (as far as I can tell) just hung. I may have gotten the same error as Greg, but rEFIt has a splash screen which I’m fairly sure would have hidden any error messages.
I rebooted into the liveCD, opened a terminal and sudo -s’d, and then ran:
mount /dev/sda3 /mnt
mount –bind /proc /mnt/proc
mount –bind /dev /mnt/dev
mount –bind /sys /mnt/sys
vim /etc/lilo.conf (changed the ‘append’ line to say append=”noapic root=/dev/sda3″)
exited out of the chrooted session, and then umounted it all again before rebooting. Perfection 🙂
Hi mate! Appending the kernel option “root=…” in addition to lilo’s own “root=…” saved NOT JUST the day, but finally put an end to a week of frantic searching for buggy behaviour that started occuring on my macbook after months of normal booting. Finally I can get to work on my thesis again. Thanks a million for your in-depth explanation!
Ok, so I go through all of the above steps, I get out of chroot. run parted. When I try the ‘print’ command, I get the following error: “Error: Unable to open /dev/hda – unrecognised disk label.”
What do I do?
Just one thing, to install Ubuntu on an external disc, do I still follow these instructions?
I have a series of questions about how to install Ubuntu 6.06 LTS on a 17 inch Mac Book Pro with a Intel Core Duo Processor
1. Will diskutil force me to reinstalled Mac OS X?
2. What are the commands in Refit to sink GPT with MasterBootRecord?
3. When should sinking take place?
4. What is a chrooted jail?
5. Can Ubuntu still boot If Windows becomes damage?
6. How and what point do I install lilo?
7. How do I make the swap file and tell if it is active?
8. Why is SMP kernal needed?
Can I use the standard x86 install for a PC?
Hi, thanks for your manual. I just tried to install grub in /dev/sda3 (My linux root partition), and it seems that rEFIt boots fine from the partition boot record. I don’t know about the MBR, maybe it works as well.
Pingback: Free Linux Guides: Links
Pingback: Free Linux Guides: Install Linux Without Damaging Windows
I have to express some appreciation to you just for bailing me out of this particular circumstance. Just after surfing through the the net and getting proposals that were not powerful, I was thinking my life was well over. Living minus the answers to the issues you have resolved through your good site is a critical case, as well as those which may have adversely affected my entire career if I hadn’t noticed your site. Your primary skills and kindness in playing with a lot of things was priceless. I am not sure what I would’ve done if I had not encountered such a subject like this. I am able to at this time relish my future. Thank you so much for this skilled and results-oriented guide. I will not think twice to propose the blog to anybody who should get guide on this subject matter.
The more often I visit this blog the more I’m amazed how it is made
Felipe Alfaro Solana » Blog Archive » Installing Ubuntu Linux on a MacBook Pro This web site can be a walk-by for all of the info you wished about this and didn’t know who to ask. Glimpse here, and also you’ll positively uncover it. Regards, Indonesia Furniture