I have spent days and days trying to get Ubuntu running right on my computer. Installing it is fairly easy but actually getting it to run properly without the GPU burning a hole through the bottom of your laptop is a different story. I hope that this tutorial saves a lot of people the headache that I went through.
- 2-3 hours of time
- MacBook Pro (9,1) Late 2012 (retina version may benefit from this guide but your mileage will vary)
- Ubuntu 14.04 ISO
- Mac OSX Installed (I have Mavericks, shouldn’t matter what you have)
- Removable thumbdrive for Ubuntu install
- gfxCardStatus 2.2.1 for OS X
- rEFInd Boot Manager (any version)
Step One: Partitioning the drive
Open up Disk Utility in OS X and partition your main hard drive. Make sure that you have optimal space for Ubuntu to run and enough room for OS X if you want to keep it (I highly recommend keeping OSX). If you cannot properly resize the drive then reboot your computer and hold down Command+S. This will enter you into single user mode where you can run the command
to repair the filesystem so that you can properly resize the partition.
Step Two: Preparing the thumbdrive
Open up your hand dandy terminal (which should be iTerm 2, by the way) so we can run a few commands and setup the thumbdrive so we can install Ubuntu. Run ‘diskutil list’ and then plug in your thumbdrive, then run ‘diskutil list’ again and see what the drive is that you just plugged in. If you don’t have any other drives in your laptop, it’s most likely /dev/disk1 but you should still run diskutil first since we are about to do nasty things to that drive. Once you’ve figured out which drive we’ll be using, run the following commands to copy over the drive:
WARNING: The dd utility will completely wipe whatever drive you use it on. Please make sure you are using it on the right drive and that there is no important data on it.
sudo diskutil unmountDisk /dev/disk1 sudo dd if=~/Downloads/Ubuntu_14.04.iso of=/dev/rdisk1 bs=1M
Make sure to obviously change the command to the correct location of the ISO and the correct drive. After that, you should be all set. If OS X cries telling you that the disk needs to be initialized, just ignore it.
Step Three: Installing rEFInd
Head on over to the rEFInd website and download the latest rEFInd binary files. The installation/setup is pretty straight forward so I won’t hold your hand here.
Step Four: Installing Ubuntu
Just like step three, there isn’t anything too far out of ordinary here. The only thing is to make sure that you select the EFI portion of the USB drive as the rEFInd boot manager will pick up not only that but the grubx64.efi file. As long as it boots via EFI and installs with EFI, you’re golden.
Step Five: Customizing the Installation
Now, if you’re like me and you want to access your files stored in your OS X partition from Ubuntu (files will be read only since you can’t disable journaling on HFS+ filesystems on OS X 10.9+) then there is some trickery involved. Open up a terminal and su to root. Ubuntu installations don’t have a default password for the root user so you can either use ‘sudo su’ to stay in root or just change the password for root with sudo. Onwards!
root@ubuntu# usermod --uid 501 root@ubuntu# chown -R 501: /home/
If you want, you can also edit /etc/group and change GID 50 (dialout I think) to staff and then make dialout GID 99. You should then edit /etc/login.defs and change MIN_UID to 501 from 1000 so that you can login with either GDM or lightDM. Restart your machine and you should have the correct permissions to access your files on your OSX partition. Now, we need to edit some kernel options. Add these kernel options to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub:
ro quiet modeset=1 i915.lvds_use_ssc=0 i915.lvds_channel_mode=2 i915.modeset=1 i915.i915_enable_rc6=3 i915.lvds_downclock=1 i915.i915_enable_fbc=1 pcie_aspm=force vt.handoff=7
and then run
Step Five.One: Turning off the GPU
If you’ve noticed by now, your laptop is probably burning the epidermal layer of your skin off your lap. This is because apple uses what is called a “gmuxer” that is a device that controls which graphics display driver is in use. As far as I’ve been able to figure out, you can’t really access the gmuxer and you have to set gfxCardStatus to ‘Integrated Only’ and then reboot your mac. Once you’ve booted into Ubuntu, you should be using the Integrated Display Driver (IGD) instead of your Discrete GPU (DIS). To check, as root, run
You should get something along the lines of
0:IGD:+:Pwr:0000:00:02.0 1:DIS: :Pwr:0000:01:00.0 2:DIS-Audio: :Pwr:0000:01:00.1
To turn off the discrete GPU:
root@ubuntu# echo OFF > /sys/kernel/debug/vgaswitcheroo/switch 0:DIS: :Off:0000:01:00.0 1:IGD:+:Pwr:0000:00:02.0 2:DIS-Audio: :Off:0000:01:00.1
You should now notice that your laptop isn’t nearly as hot after a couple minutes of use. My laptop typically idles around 50 degrees celcius depending on the ambient temperature of the room.
More to come soon!