Ubuntu on MacBook10,1

From Lower Ground
Jump to navigationJump to search

This is not as simple as most devices, but it's not as horrifyingly painful as in the past.
This method is for dual-booting with OS X remaining on the drive, booting Ubuntu EFI, and installing the nvidia drivers.
This method (most likely) has no optimus (intel/nvidia gpu switching) functionality.

This will also be poorly written. Suckers.

If keeping OS X, shrink your partition in Disk Utility.
Use the normal AMD64 ISO for your installer, NOT the Mac ISO.

When you boot the disc, choose the try out option, not straight into the installer.
If you want to be able to grab updates, open a Terminal and install bcmwl-kernel-source to get the wifi driver going.

  • Note: You will have to reinstall bcmwl-kernel-source after install as well, to have functional wifi.

You might as well also install efibootmgr at this time, we'll need it later.

During install, choose the 'something else' option to set up your own partitioning.
Add a root partition (and others, if ye desire) and a swap partition.
Select the EFI partition (usually sda1) as the target for the bootloader install (default will be sda).
Proceed normally with installation, until you reach the end.

Now choose Continue Testing, instead of rebooting, then return to the Terminal.

sudo efibootmgr -o 0000,0080

If you get an error, about something not found or doesn't exist, reboot back into the ubuntu livecd, install efibootmgr again and rerun the same command.

You may now reboot, and you should be shortly greeted by an Ubuntu login screen.
If you do not have the discrete GPU, or you are happy with the Nouveau drivers, life is much simpler, there are just some final tweaks to do.

In /etc/default/grub, if you want to see the grub menu each time you boot, comment out the GRUB_HIDDEN lines
Also in this file, please change GRUB_CMDLINE_LINUX="" to:

GRUB_CMDLINE_LINUX="libata.force=noncq"

After that, run an update-grub.

Another grub tweak: font size.

sudo grub-mkfont -s 36 -o /boot/grub/DejaVuSansMono.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

Then in /etc/default/grub

GRUB_FONT=/boot/grub/DejaVuSansMono.pf2

Recommended power management stuff:
PowerTOP: Install powertop, then run sudo powertop --calibrate. It'll take a bit, and it'll turn your screen on and off, just come back in 10 minutes or so and prod it awake again.
Then add "powertop --auto-tune" to /etc/rc.local
TLP: # add-apt-repository ppa:linrunner/tlp && apt-get update && apt-get install tlp && tlp start
Go read about those things if you want to know more about them.

Lots of people recommend the mtrack driver instead of the synaptics driver. Personally it doesn't fucking work right. Tap Hold/Tap to Drag is squirrely and I never got the sensitivity right. YMMV. Whether you use mtrack or synaptics, the following will get you 'natural' scrolling like OS X and mobile devices.

echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" > ~/.Xmodmap

There is also a natural scrolling option in the Ubuntu 14.10 if you're in Unity.

For those with later rMBPs with PCIe SSDs, specifically the Marvell ones edit /usr/lib/pm-utils/power.d/sata_alpm And replace the following line:

false) set_sata_alpm max_performance;;

With this one:

false) set_sata_alpm min_power;;

Failure to do so supposedly spams dmesg, clobbers performance and risks data corruption.

Sensors stuff: Add coretemp and applesmc to /etc/modules

Recommended daemons I haven't tried are Lightum (automatic backlight and keyboard lights) and Fan Control Daemon (does what it says on the tin).

Want your F-keys to be F-keys first and special controls second?

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all

No matter which video driver you're using, if you do what I did and installed Ubuntu MATE initially, you'll find everything is tiny. You can crank up the font DPI, but the window dressing and everything stays tiny. And of course Chrome is going to stay ugly no matter what.

I gave up and installed the standard ubuntu-desktop, then just turn scaling up to your desired factor (I'm using 2, some stuff is a bit big feeling after using tiny MATE, but it feels about right for 1440x900, and Unity seems to have mostly hidpi elements down). Scaling is in the display settings. Chrome will still be funky, I set zoom to 150% globally, which is a bit smaller than how it renders in OS X in normal Retina mode, but 200% was way too big. 175% should be pretty comfortable.

NVIDIA, that which follows applies if you want the proprietary nvidia driver:

Fuck.

You're going to need the xorg-edgers repo.

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install nvidia-346

If there's newer than 346, give it a shot. 331 and older DID NOT WORK for this troublemaker.
Supposedly, some of the older versions will work with Option "UseDPLib" "off" in the xorg.conf, but I couldn't get Ubuntu to stop clobbering mine, so I couldn't verify that.

In /etc/default/grub, we need to add the following boot options to GRUB_CMDLINUX_LINUX_DEFAULT

i915.lvds_channel_mode=2 i915.modeset=0 i915.lvds_use_ssc=0

And then update-grub. Otherwise the stupid GPUs fight over the display.

You'll find that while it worked in Nouveau, your backlight adjustment has stopped working. This quickie in /etc/rc.local will sort that out:

setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0