Linux On A Macbook Pro 10,1

I have been using Linux as my primary desktop environment for a long time. It can be impractical, annoying, even infuriating. But it’s still my favorite operating system, and over the years I have grown accustom to its quirks and shortcomings. I also suffer from an occasional obsessive disorder with regards to problem solving. Specifically trivial, unimportant problems. Such was the case two weeks ago when I decided to ditch a virtual Linux environment running in Mac OS for a native Linux install.

Don’t get me wrong, running Linux using a virtual environment like Parallels is a pleasant and pretty smooth experience. I felt however that it should be snappier, should run faster on the super slick Mac hardware, so I innocently decided to dual-boot the machine and compare a native Linux install to what Parallels provides. It took a wee bit longer than I hoped to get things working as well as I wanted, but I’m happy to say the effort has been worth while. Here is a summary of things learned so far running Linux on a Macbook Pro 10,1. For the most part these are not distro specific, and I’m not using any high level configuration tools from a desktop environment like Gnome or KDE.

  • Installation
    There are plenty of how-tos out there to get the installation bits figured out. I’m a Debian man myself, so I found this particular post a useful jumping off point. The tips with regards to rEFInd and getting the wireless card to work during the installation process where very useful, and within an hour or two I had a bootable Debian Sid/Unstable setup, without any breakage to Mac OS.
  • Temperature
    In my experience laptops running Linux tend to run hot, and this Macbook is no exception. Before tweaking a few things it was consistently 10 C degrees warmer than in Mac OS, and would quickly raise to out-of-control hot when doing any CPU intensive work (I triggered CPU temp throttling with a make -j8 in less than a minute). I tried a number of things to reduce the temperature and managed to find two that help bring things back into Mac OS comparable levels. First is to use the Intel Pstate kernel driver for CPU scaling. The only tweaking required is to disable CPU “turbo” mode as the driver is IMHO too liberal with frequency ranges over the normal non-turbo maximum. This eliminates conditions spiraling to dangerous levels when all the cores are pegged. Secondly I’m running a simple Bash script from root’s crontab every minute that does a core temp evaluation and adjusts the minimum fan speed if required. This brings down the average idle temp with negligible additional fan noise. This requires the standard kernel coretemp driver as well as the applesmc kernel module.
  • Power
    To date the best estimated battery life value I have seen under Linux is 5 hours (I have not run an actual timed test yet) as compared to 7.5 in Mac OS. After some acpid rules fiddling I managed to scale the CPU to 75% of max and dim the display significantly when the power is unplugged. Both can be independently restored of course, but this goes a long way toward getting the most out of the battery. The powertop app has also been useful to identify devices that are not taking advantage of available power savings modes, though I can’t say for sure how much power savings they provide.
  • WIFI
    This Macbook has a Broadcom BCM4331 wireless adapter. The b43 kernel driver is the only one that recognizes the hardware, but it’s been hit or miss in the stability department (regardless of power saving mode). Some days are solid, some days are laden with network drops. I’m still working the issue and so far the 3.10.7 kernel seems more reliable than the stock Debian kernel, albeit with limited testing. In the meantime I stuck a tiny Panda Wireless USB card in, built the kernel module, and with the exception of some excessive but seemingly harmless logging, everything has been stable since.
  • Retina Display
    The Retina display is incredible. 2880×1800 pixels packed into a slim bright package. With the apple_gmux kernel driver the brightness is controllable, both from the function keys (using xbindkeys) or when changing from battery to plugged in (using acpid). Everything is really tiny at this res, so adjusting font sizes where possible is a must. I ended up modifying the defaults for my terminal (Mrxvt) and window manager (FVWM), as well as for QT and GTK. This pretty much does the trick for everything I use with the exception of bumping the default zoom level in Chromium.
  • Trackpad
    The mtrack Xorg input module works well with the multi-touch device. I added a few bindings into the xorg.conf file to set up some click and tap combos, and so far it’s working well. I’m not a big trackpad fan but I have to admit this one is slick. I’m laughably clumsy with it but I’m getting better.
  • Function Keys
    Using xev I was able to identify the keycodes for the function keys and bind them to actions with xbindkeys. Brightness and keyboard back-lights are controlled via simple Bash scripts that manipulate /sys entries directly, and the volume controls use amixer. I have not mapped the remaining keys to anything yet.
  • Suspend
    This works quite a bit better than I expected (with nothing but kernel support and standard power management related packages). The only issue so far is that the network needs to be reset after a resume. I have not put any effort into automating this yet but plan to look into it soon. Acpid makes it trivial to trigger suspend on a lid close which is pretty handy (though sometimes annoying).
  • Video
    I’m using the Nouveau kernel driver to power the display on the Nvidia GeForce GT 650M. There is an alternate Intel i915 GPU but I have not tried to activate it yet. I did build modular support for it in the kernel, and I enabled options to allow switching between graphic devices. The Nvidia GPU continues to work fine with the Intel drivers enabled which is better than the last time I tried to run multiple kernel drivers for different GPU vendors simultaneously. Hardware 3D works and the frame rates are what you would expect from a mobile GPU.
  • Hard drive
    This rig has a peppy 251Gb Apple SSD (SM26E). Works great with the standard SATA kernel drivers. I have not run any specific benchmarks, but I’m sort of new to using SSDs and they all seem so fast I could be completely unoptimized and still loving the performance.
  • USB
    No issues here. I’m using the standard UHCI, OHCI, XHCI kernel modules to support USB interfaces. Everything I have plugged into a USB port has worked perfectly so far.
  • Sound
    The Intel HDA ALSA audio driver works with no tweaking. The volume gets pretty loud for a laptop which is nice. Plugging in headphones correctly mutes speaker output and work fine. Overall the sound quality is better than I thought it would be.
  • Webcam
    The webcam is an Apple “FaceTime” HD Camera that is connected internally using USB. Tested with mplayer, it works without issue using the kernel’s generic uvcvideo driver.
  • Card Reader
    This is a Broadcom Corporation NetXtreme BCM57765 Memory Card Reader. The MMC drivers spit out a non fatal hardware interrupt warning when I insert a card and then nothing happens. In all fairness though it might be a bad 😄 card. I could only find one to test with and it’s ancient.

Here is a shot of my very fancy not old-fashioned at all looking new Macbook Pro Linux desktop (click for full res).

macbook_screenshot

And here are some of the scripts and configs referenced above in case anybody finds them useful:

Very, Very Many Years of Living

Aging stinks. “You’re only as old as you feel” as the saying goes. Unfortunately that cuts both ways when you feel older than you actually are (“Off the lawn”, You know the drill). When I was 18 I could work a double shift on three hours of sleep and a diet of nothing but Mountain Dew and Slim Jims. Now I wake up sore because the prior day I climbed stairs. Once.

Getting old sneaks up on you. I don’t remember the point in my life when I started classifying walking as exercise, but now I have a pair of shoes specifically for that purpose. Have you ever had that fish-slap-in-the-face moment when you realize you just said something to your kids that made you cringe when your parents said it to you? These days I catch myself channeling things my grandparents used to say.

To make matters worse I work in a field dominated by whiz kids. To whit, I found out recently I’m a decade older than the median age at my current job — a first in my very, very many years of living. Not that I ever compared my age to a statistical median of the ages of my coworkers in any of the other jobs I have had (see blog title).

I don’t remember where I was going with this post, and my eyes are too tired to reread the first paragraph. I think I will just ramble incoherently about random annoyances until it’s time to take my meds. If you turn down that garbage you kids call music and pay attention you whippersnappers might learn something.

  • The Cloud. I had a lengthy screed about how much I hate that term, but attempting to write it out inflamed my aneurysm to near-hemorrhage levels. Also I forgot most of it. Trust me though — it was good.
  • Start ups that end their company or service with “ly”. I don’t know if this is still a thing but I will always think less of a company that does this. How does this go down in the product development phase?

    “We are, in essence, a delivery mechanism. Lets call our product Delivery”
    “Wait, hold on. I have a brilliant idea! Lets call it Deliveryly!”.
    * Everyone gasps and falls down, overwhelmed *.

  • Not everyone lives their life twitching between ten social networks while streaming today’s bagel topping. if someone is just a “Facebook friend” they are one step away from being someone you could give a crap about. If you can’t take the time to get to know someone outside of the crushing confines of likes and comments, calling them your friend does a disservice to the word. Look up from your phone once in a while, get a nice shoe shine, and head over to the speak easy. But if you do, for the love of Pete stay off my damn lawn.
  • The future may be mobile but I’ve got news for you sonny: the future is not now. I’m sure I’m not the only die-hard technophile with outdated computers running 2.2 series Linux kernels and Arduino hardware with infrared sensors to monitor the perimeter of my lawn for intruders.

    Maybe that’s an extreme example but I think there is a point in there somewhere. For the record I’m not currently doing that, but I could, and if you kids keep it up I swear to God I might.

  • I’m a big fan of expedience. For example I’m doing several other far more important things while I write this post (like soaking my feet in Epsom salts and snacking on some peanut brittle). But is it really that hard to send a message without resorting to a bizarrely shortened version of English (or any other language for that matter)? Nothing says “You are old” like having to Lycos Google the meaning of a text from my college age daughter.

All this typing is making me tired. I’m going to finish my sarsaparilla and squeeze in a second mid-afternoon nap so I’m rested up for square dancing later.