HowTo - Fedora 21 on MacBook Air 6,2

/Update 2015-02-09: High CPU in gnome-shell is caused be the gnome-session background-logo extension. Easy to disable by turning off 'Background Logo' via https://extensions.gnome.org/local or gnome-tweak-tool/

I've recently been playing with Ubuntu on home VMs and DigitalOcean again after realizing how far ahead of CentOS/Fedora/RHEL it is for the availability of Ansible playbooks etc. However, I've used RHEL/CentOS every day at work for the past 5 years and just prefer its way of doing things to Ubuntu. Tiring of OSX, I enjoy having Fedora on my laptop.

There are some great guides for Fedora 20 on an Air, but I couldn't find anything yet for Fedora 21 workstation. So here are my notes on making it work, working roughly (but with various changes) from a Fedora 20 guide from mattoncloud.org

1. Make Space for Fedora

Starting from an installation of Yosemite using the whole disk and with FileVault enabled, the most foolproof way of getting a functioning dual boot I've found is to ignore guides that mention splitting an encrypted partition, using refit/refind etc. and do the following:

  1. Decrypt the OSX install by disabling FileVault in OSX settings. Wait for the decryption to complete (needs Mac to be plugged in) and reboot.
  2. Using OSX disk utility reduce the size of the OSX partition. On a 256GB Air I made 100GB of free space for Fedora.
  3. Reboot again.
  4. Enable FileVault again, let it completely encrypt the drive, and reboot once more into OSX before installing Fedora.

I've found over the course of trying many distro installs that this gives the cleanest partition layout, and never fails. Note that if you try to install Linux before first re-enabling FileVault you may later find that FileVault complains about an incompatible disk layout, and you are stuck without encryption on OSX.

/This doesn't give you refit/refind on bootup to choose OSX / Fedora, but you can hold option to get the Mac's own menu, and set your preferred startup disk in OSX settings./

2. Install Fedora 21 Workstation

Download the Fedora 21 .iso image and write it to a USB stick. Make sure you use a direct image writer (e.g. dd or the methods detailed in the Fedora docs). If you use unetbootin it won't work!

Attach the USB stick to your Mac, reboot while holding down the option key. Choose the Fedora image in the boot menu and proceed through the installer using default options. Automatic partitioning will magically work, install the correct EFI bootloader etc. Wonderful!

Reboot into Fedora. You can login but you won't have WiFi, and your Air will get hot very quickly due to some problems…

3. Stop the gpe66 interrupt storm

On Airs that have been updated to recent OSX you'll find if you check top that kworker uses a huge amount of CPU. This will drain your battery, and heat up your Air very quickly and is due to an interrupt storm on gpe66. To disable the interrupt you can use a systemd script.

Put the following into a file /etc/systemd/system/disable-gpe66.service

[Unit]
Description=Disables interrupt GPE66

[Service]
ExecStart=/usr/bin/bash -c 'echo "disable" > /sys/firmware/acpi/interrupts/gpe66'

[Install]
WantedBy=multi-user.target

Then start and enable on boot:

sudo systemctl daemon-reload
sudo systemctl enable disable-gpe66.service
sudo systemctl start disable-gpe66.service

4. Get WiFi Working

The Air uses a WiFi chipset that isn't supported by the drivers that come with the Kernel / Fedora. The non-free 'wl' driver is available from rpmfusion.

Connect to the net using a USB Ethernet dongle (hopefully you have one!). Update your Fedora install so that you are using the latest kernel, and the kernel / kernel-devel package versions will match etc. Then, reboot into the latest kernel.

sudo yum update
sudo reboot

Now enable the rpmfusion repo by following the instructions for Fedora 21 at:

http://rpmfusion.org/Configuration

Once this is done you can install the 'akmod-wl' driver that will rebuild automatically if your kernel version changes etc.:

sudo yum install kernel-devel akmods akmod-wl
sudo akmods

Once this is finished you should be able to unplug from ethernet and connect by WiFi. Hooray!

5. Fix Backlight on Suspend/Resume

The standard mechanism which sets backlight brightness works fine on first boot, but after a suspend/resume it will fail to work correctly, so that the backlight can only be fully on or off. patjak on Github has created a module that's easy to install to fix this issue:

git clone git://github.com/patjak/mba6x_bl
cd mba6x_bl
make
sudo make install
sudo depmod -a
sudo modprobe mba6x_bl

Log out and back in and the backlight should work properly.

6. Wakeup / Keyboard Mapping Fixes from matthicksj/mba-fixes

In the mattoncloudarticle for Fedora 20 on the Air 6,2 the author provides a package to fix:

  • unwanted wakeups from suspend
  • missing mapping for the ~ key
  • SSD i/o errors

I don't see the SSD i/o errors anymore on F21, but the unwanted wakeups and missing ~ mapping are still there. Luckily the mba-fixes package works fine on F21 to fix these issues, so you can do install mba-fixes and these problems will disappear after a reboot.

sudo rpm -Uvh https://files-oncloud.rhcloud.com/yum/RPMS/x86_64/oncloud-repo-0.4-1.fc20.x86_64.rpm
sudo yum install mba-fixes

7. Ditch Gnome for Cinnamon <optional>

UPDATE - High gnome-shell cpu /is caused by gnome-shell-extension-background-logo. Turn off the 'Background Logo' extension via browsing in firefox to https://extensions.gnome.org/local or using gnome-tweak-tool (yum install gnome-tweak-tool). No need to ditch GNOME to get good battery life! See: https://bugzilla.redhat.com/show_bug.cgi?id=1177683/

On Fedora 21 I've found that gnome-session constantly use 40-50% CPU - something that didn't happen in Fedora 20. This CPU usage will cut battery life quite a bit. I can't find any fix for this and need to file a bug report. However, I switch to Cinnamon for the desktop and then don't have any issue. Since I use RHEL6 with GNOME 2.x all day at work the 'Classic' layout in Cinnamon is more familiar than the standard gnome-shell anyhow.

sudo yum group install cinnamon

Log out. Choose the 'Cinnamon' session via the little gear icon setting button when logging back in.

8. Install thermald

Intel provides a linux daemon for thermal management that works with many features of newer intel chips. In other distros I've noticed improvement in battery life when using thermald, perhaps due do cpu governor settings. Not checked this thoroughly in F21, but I'm installing it anyway from the hadrons123/thermald copr:

sudo dnf copr enable hadrons123/thermald
sudo yum install thermal-daemon
sudo systemctl enable thermald
sudo systemctl start thermald

I'm just leaving it with the default config. You can configure a lot via thermald to have a cooler mac that uses it's fan more, or aggressively throttles the CPU etc. if you want to.

9. powertop and tuned power saving tweaks

At this point everything (except the iSight) should be working nicely, and battery life is fairly good. A little bit more battery life can be gained by using powertop to find some tuning options and tuned to ensure these are applied.

Install powertop and calibrate

sudo yum install powertop
sudo powertop --calibrate

Let powertop calibrate without touching anything. It takes a couple of minutes. At this point with backlight at 50% brightness and an idle Cinnamon desktop I see a draw of about 5.3 watts. By applying all of the recommended tunables within powertop I get down to a draw of 4.8 watts. This is 9% lower, which definitely seems worth having.

Powertop tuning doesn't persist over restarts. One method of making it persist is to use tuned and setup a tuned profile that applies powertop recommended tuning. Unfortunately this isn't working at the moment. It seems that the 'powertop2tuned' command isn't compatible with the version of powertop on F21.

As a temporary workaround until this is fixed I just call powertop with the –auto-tune option directly from the root user's crontab at reboot. This does mean that if any of powertops tuning options cause problems there's no way of turning some off, but I've had no issues so far.

sudo crontab -e

Add the line

@reboot /usr/sbin/powertop --auto-tune > /dev/null 2>&1

All Done!

After these steps I'm happy with the way Fedora 21 is working on my Air. Everything is shiny, fast, and the battery life is great. Not too much effort overall - far better than when I attempted this back in the day on an original Air with much older distros.

Comments

Comments powered by Disqus