Linux on the Macbook Pro (2016)

Much like the macbook air post, but vanilla Ubuntu 16.04, and this time on a Pro from early 2016 (hardware rev?)

I plugged in a USB ethernet adapter to work around the wireless driver issue so I could choose "download drivers & updates" during install.

To install, I mostly followed http://www.rodsbooks.com/ubuntu-efi/ - start by disabling SIP:
https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11

... which is pretty understandable, although not clear to those unfamiliar w/ the commands: it says "# Take note of available number of free extents", which is not obvious form vgdisplay output. This is apparently "Free PE" near the bottom.

Also note in the ubuntu installer, "Device for boot loader installation" does NOT mean the /boot partition. It should be the physical drive, not a partition, eg. /dev/sda

Other installer options: Keyboard - I'm never sure whether to do "English (US)" or "English (US) English - (Macintosh)". I picked the latter. This requires some fixup post installation (see my macbook air post).

Do NOT choose "Encrypt my home folder". We've already done LVM encryption, and encrypting /home breaks some things I need like exporting specific subdirectories over NFS (at work, our vagrant dev environment uses this to expose a git clone on the host OS to the guest OS).

Install started 12:15, took less than 10 min (I wasn't watching). Then reboot and continue the "Fixing the installation" steps on http://www.rodsbooks.com/ubuntu-efi/

My first reboot went straight into Ubuntu at the (initramfs) prompt, didn't expect that... oh dear, I had missed the part of the jayway article that said "When the installation is finished, DO NOT CLICK Continue, and DO NOT CLICK Reboot!". Couldn't sort out how to pick up from there, so I started over (rebooted to OSX by holding Option at boot; used gdisk to remove the partitions I'd created; restarted in "Try without installing" mode on the ubuntu USB stick.

... hmm USB errors ("usb 1-1: device descriptor read/all, error -110") apparently means too much current consumed by USB ports. And apparently there's a bug around this. Workaround: Unplug computer and all USB devices, turn off computer, wait several minutes, then try again.

Post-install

Backup restore

I manually ran duplicity restore --force to get my home dir backup from an external drive. The --force was required since I had already created the user account. Duplicity complains when you do that but works fine. Lots of stuff about unable to chown things.

Keyboard:

gotta swap command and alt, and fix the tilde key:

echo options hid_apple iso_layout=0 swap_opt_cmd=1 | sudo tee -a /etc/modprobe.d/hid_apple.conf

That didn't seem to fully stick after reboots. Not sure why but I worked around it by adding to /etc/rc.local:

rmmod hid-apple && modprobe hid-apple

This worked, so after restoring my backups, I removed my .xmodmap stuff that I had done for the Air.

... ugh, that only works for the builtin keyboard, not external. So I removed the swap_opt_cmd=1 part and instead, after much googling and trying various config file hacks that had no effect, I ended up doing this: http://askubuntu.com/a/432966/236180

$ sudo apt-get install dconf-tools
$ dconf-editor

navigate to org >> gnome >> desktop >> input-sources

Put your options under xkb-options as a list. Ex: ['altwin:ctrl_alt_win','..etc..']

Then close the dconf-editor. Changes should come live straight away.

Also, the various hardware control keys all seem to work out of the box (backlight, keyboard backlight, sound). So no more mucking with xbindkeys.

Can't seem to bind my preferred move-window-to-next-workspace binding (ctrl-alt-1 to move to workspace 1, etc). Fix: Use CompizConfig Settings Manager (ccsm), enable the Window Management -> Put plugin, and you can bind it in there.

External Keyboard

Kinesis Freestyle 2.

I can't get multimedia, etc keys to work, found only unanswered questions, see eg. https://ask.fedoraproject.org/en/question/33341/multimedia-keys-on-kinesis-freestyle-2-keyboard/ http://askubuntu.com/questions/603190/setting-up-freestyle-2-keyboard-in-ubuntu-14-04

Touchpad

I yanked out all my synaptics tweaks that I had on the Air. No more tweaking syndaemon or synclient, no extra config.

Froze occasionally. Not sure if this was leftover crap from my synaptics tweaks or what. SEeing if libinput helps as per http://askubuntu.com/questions/785629/dell-xps-13-9350-on-ubuntu-16-04-touchpad-stops-working-or-works-erratically

sudo apt-get install xserver-xorg-input-libinput

Theme

I couldn't find a Unity theme with window borders out of the box, and dislike how black terminals tend to blend into each other. I found this: http://askubuntu.com/questions/448204/how-do-i-add-a-border-around-windows-but-keep-the-current-theme and used it to hack the Radiance theme that I was using. Here's my edits:

diff --git a/gtk-3.0/apps/unity.css b/gtk-3.0/apps/unity.css
index b0f484c..4876a62 100644
--- a/gtk-3.0/apps/unity.css
+++ b/gtk-3.0/apps/unity.css
@@ -1,7 +1,7 @@
 /* Decorations */

 UnityDecoration {
-    -UnityDecoration-extents: 28px 0 0 0;
+    -UnityDecoration-extents: 28px 1px 2px 1px;
     -UnityDecoration-input-extents: 10px;

     -UnityDecoration-shadow-offset-x: 1px;
@@ -57,29 +57,19 @@ UnityDecoration.top:backdrop {

 UnityDecoration.left,
 UnityDecoration.right {
-    background-color: shade (@bg_color, 0.7);
-    background-size: 1px 70px;
-    background-repeat: repeat-x;
-
-    /* start color: mix of the top border color and bg-image gradient end */
-    background-image: -gtk-gradient (linear, left top, left bottom,
-                                     color-stop (0, #a89686),
-                                     color-stop (0.5, #a89686),
-                                     color-stop (1, shade (@bg_color, 0.7)));
+    background-color: #555555;
+    background-image: none;
 }

 UnityDecoration.left:backdrop,
 UnityDecoration.right:backdrop {
-    /* start color: mix of the top border color and bg-image gradient end */
-    background-image: -gtk-gradient (linear, left top, left bottom,
-                                     color-stop (0, #b5a395),
-                                     color-stop (0.5, #b5a395),
-                                     color-stop (1, shade (@bg_color, 0.7)));
+    background-color: #555555;
+    background-image: none;
 }

 UnityDecoration.bottom {
     background-image: none;
-    background-color: shade (@bg_color, 0.7);
+    background-color: #555555;
 }

 /* Panel Style */

CPU turbo boost

Unlike the Air on Ubuntu 14.04, this appears to work out of the box. I think. Not sure how to read output of i7z_64bit, need to research.

Suspend

Suspend on lid close spontaneously stopped working on 2016-11-05, no idea why, don't think there were any relevant recent upgrades?

Workaround - trying this: http://askubuntu.com/a/763111 edit /etc/systemd/logind.conf and set HandleLidSwitchDocked=suspend and reboot.

Battery

I have not measured before/after nor spent much time tuning. Some things I did:

  • Install indicator-cpufreq ... seems to work but only allows "performance" and "powersave"? ... aha, apparently this is the case with the intel_pstate driver which now runs by default. And supposedly "powersave" is equivalent to the old "ondemand".

  • Install tlp ... any config tweaks? Not so far.

  • Check sudo powertop and tab to the Tunables page -> nearly all showed "Good"

Printer

Printers

Brother MFC-J835DW: via the settings -> printers tool, searched for network printers, it came up. I searched the tool for Brother drivers, it suggested Brother DCP-1200 Foomatic, I chose that. Test page did not work.

Brother MFC-9970CDN: Basically worked via settings -> printers. I found it in the list of networked printers and accepted all the suggested defaults (generic postscript level 3). BUT ... prints look terrible. Removed the printer from printer config dialog. Went to http://support.brother.com/g/b/downloadend.aspx?c=us_ot&lang=en&prod=mfc9970cdw_all&os=128&dlid=dlf006893_000&flang=4&type3=625&dlang=true and downloaded the "driver install tool" (deb version). Followed the instructions and accepted everything, except I did not have the printer URL handy. So I said "no", and then after completing, I opened the ubuntu printer settings dialog, found the printer, used the GUI to modify the printer URL - it searched for available printers and I picked the right one when it came up. Test page printed fine!

Quality is not as good as under OSX, but it's usable for my purposes.

Application switcher & Window management

I dislike the default switcher because I usually have a bunch of terminals, a bunch of emacs windows, etc, and can't tell which I'm selecting. I used CCSM to enable the Application Switcher plugin, and enabled "focus on switch" and "bring to front", and turned up "zoom" a bit. Turned on "icon" and turned off "only show icon".

In CCSM turn on Utility -> Resize Info to display window size while resizing.

External Display

For a while I saw some flickers on external monitor. TrTrying this: http://askubuntu.com/questions/760934/graphics-issues-after-installing-ubuntu-16-04-with-nvidia-graphics

Fonts

I can't figure out how to get same font size in terminal as emacs. In emacs I use DejaVu sans mono 14. In the terminal if I select the same thing and set zoom to "normal" it's huge. If I try 12 it's still too big, and 11 is a lot smaller - too small.

Misc tweaks

Kupfer doesn't show System Preferences, etc.

Used to work on xubuntu 14.04. The fix is here: http://askubuntu.com/questions/471655/how-to-index-system-setting-in-kupfer