Ubuntu 14.10 + MacBook Pro Retina 13″ 2014

[Updated on March 10th, 2015]

I just got my new setup for work and as usual I performed Softwares changes: Install Ubuntu on the MackBook Pro retina. With the system by default I run on the following issues:

  • Suspend takes a long time
  • On Resume after suspend, the wireless driver stopped working
  • CPU scaling governor is powersave, but the CPU is always at maximum! (high temperature)

I manage to solve the problems with the following steps:

Wireless

Get a compatible bcmwl driver for the next Kernel 3.19: bcmwl-kernel-source. Then install the new module:

$ sudo dpkg -i bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu2_amd64.deb

Kernel Upgrade:

Install the Linux Kernel 3.19 for Ubuntu, this Kernel is available for the next Ubuntu release but it works for our purposes, get the following files:

then install them with:

$ sudo dpkg -i linux-*.deb

reboot your system, make sure you boot the new Linux 3.19.

Turn off CPU Turbo mode

By default the Intel CPU is running in turbo mode, turn it off with:

$ sudo su -c '/bin/echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'

just in case, did you installed the Fan control tool for your Macbook ?:

$ sudo apt-get install macfanctld

that should be enough 🙂

Power Consumption

I am using the following lines on my rc.local to perform optimizations on power consumption and also a workaround for a kworker facing high CPU on MBP:

# Powertop suggestions
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
/sbin/iw dev wlan0 set power_save on
echo 'auto' > '/sys/bus/usb/devices/usb1/power/control';
echo 'auto' > '/sys/bus/usb/devices/1-5/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb2/power/control';
echo 'auto' > '/sys/bus/usb/devices/1-3/power/control';
echo 'auto' > '/sys/bus/usb/devices/1-3.3/power/control';
echo 'auto' > '/sys/bus/usb/devices/2-3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:03.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:07:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.4/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:06:04.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:06:03.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.5/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:06:06.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:05:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:04:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:06:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:06:05.0/power/control';

# Kernel Bug on Macbook Pro ? (kworker CPU high)
status=`cat /sys/firmware/acpi/interrupts/gpe66 | grep disable | wc -c`
if [ $status -eq 0 ]; then
    echo disable > /sys/firmware/acpi/interrupts/gpe66
fi

Suspend

I ran into many problems when suspending my laptop. To fix the problem, create the file /usr/lib/pm-utils/sleep.d/45fixusbwakeup with the following content:

# !/bin/bash

acpi_disable_wakeup () {
    state=`cat /proc/acpi/wakeup | grep $1 | cut -f3 | cut -d' ' -f1 | tr -d '*'`
    echo "device = $1, state = $state"
    if [ "$state" == "enabled" ]
    then
        echo $1 > /proc/acpi/wakeup
    fi
}

case $1 in
    hibernate)
            echo "Going to suspend to disk!"
            ;;
    suspend)
            echo "Fixing acpi settings."
            acpi_disable_wakeup "XHC1"
            acpi_disable_wakeup "LID0"
            echo "Suspending to RAM."
            ;;
    thaw)
            echo "Suspend to disk is now over!"
            ;;
    resume)
            echo "We are now resuming."
            ;;
    *)
            echo "Somebody is callin me totally wrong."
            ;;
esac

then assign execution permissions to the script:

$ chmod +x /usr/lib/pm-utils/sleep.d/45fixusbwakeup

1 comment

  1. I cannot express enough thanks for this article. After checking /var/crash for the billionth time and trying to get apt-get’s version of bcmwl-kernel-source to work with Linux Kernel 3.1.9, this was exactly what I needed. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax