Fedora 20 on a Macbook Air

Update 3/24/2014: Suspend working well, moving to mba-fixes RPM

Update 3/23/2014: Removing RPM version of backlight also added some attempts at avoiding wakeups

Update 2/17/2014: Added tip on reloading the wireless module

Update 2/5/2014: Added instructions for a shared partition and better backlight driver installation

With Fedora 20 out, it was time to refresh my Macbook Air (model 6,2) installation and see what I could get working.  You might have seen my earlier post using Fedora 19 but this time around, things went much smoother.  I’ve also tried to cover the initial installation with a little more detail, so hopefully that will help out someone just getting going.

Step 0 – Uninstall rEFIt

If you had previously installed Fedora on your Macbook like myself, you probably installed rEFIt as your bootloader.  Since that project is no longer maintained, you’ll want to uninstall it and move to the newer Refind bootloader.  I uninstalled Refit using their instructions and it worked fine. After uninstalling, I made sure I could boot into OSX by just rebooting and it worked.

Step 1 – Install Refind

I followed the Refind Mac OSX Instructions and while it was a few steps of pasting things into the terminal, it went very smoothly.  Since I have the MBA 6,2 model, I kept the 64 bit binary and drivers.  Also, the instructions mention that you can remove drivers to optimize boot time but I only removed the HFS driver.

Step 2 – Build Fedora 20 USB Key

First I downloaded the Fedora 20 ISO and followed these instructions to build a USB key.  I followed the Mac OSX section and used the dd program to create the key.  Worked like a charm.

Step 3 – Install

With the newly created USB key plugged in, you’ll want to restart and immediately hold down the Option key on your Mac.  That will pull up the boot device options and you can select the ‘Fedora Media’ option.

Note – I wasn’t able to successfully check the media.  When I tried, I received errors about a devmapper device not being present.  Continuing without checking worked fine for me.

Important – I’m going to describe how to do a clean install as that is what I normally do.  This is going to delete any existing Fedora installation you might have.  Also, if you mess up partitions, it could delete some of your Mac data as well.  This is the point where you need to triple check that you have all your stuff backed up.  I don’t claim this installation is fool-proof nor do I want anyone accidentally reformatting their machine as a part of this effort.  Make sure if that happens, that you aren’t going to permanently lose anything.

Step 3.1 – Partitions

Since I had Fedora 19 installed on encrypted partitions, it was a little confusing for me at first how to make sure the Fedora 20 partitions were created properly.  The following steps did the trick for me:

    • Select the encrypted partitions and unencrypt ALL of them
      • At this point, you should see the Fedora 19 partitions recognized, including swap
    • Delete all of the Fedora 19 partitions.  Remember – clean install being described
    • Click the link to auto-create the Fedora 20 partitions
    • Apply the changes

Sharing a partition with OSX

I wanted to share some data and documents between my OSX instance and my Fedora setup.  To do this, I actually changed the mount point of the /home partition in the Fedora 20 list to /mnt/shared (I had left enough space on the / partition).  I also changed the filesystem to Linux HFS+.  I assume that is just a non-journaled HFS+ partition.  Anyway, it created on install and mounts up on Linux.  The only thing I had to do was sync the UID of my Linux user with my already existing Mac user of the same name.  To do that, I switched to runlevel 1 and just ran (replace the contents in the braces with your values):

sudo init 1
# Put in root password
usermod -u <MAC_UID> <LINUX_USER>
chown -R <LINUX_USER> /home/<LINUX_USER>

After doing this, I was successfully able to read and write files when booted into Linux or Mac OSX.  I symlinked most of my directories like ~/Documents to that share.

At this point, you’ll let the install proceed as normal and you’ll create your users, root password, etc.  From this point on, I’ll assume you are running these steps from your newly installed Fedora machine.

Step 4 – Update

First odd thing I hit was that after the installation, PackageKit was telling me everything was up to date, so I had to run yum at the command line:

sudo yum update

That worked fine and applied a few hundred updates.  Reboot to get the new kernel.

Step 5 – RPM Fusion (extra packages)

You’ll want to install RPM Fusion to get the wireless drivers among other things.  You can either following the RPM Fusion docs or following these condensed steps:

  • Click this link on your Fedora machine and install it (free repo)
  • Click this link on your Fedora machine and install it (non-free repo).

Step 6 – Wireless

Now with the RPM Fusion repos, you can just install the broadcom wireless drivers:

 sudo yum install kernel-devel akmod-wl

Reloading the wireless module

After updating my kernel, the wireless module didn’t load automatically for me.  I’m fairly new to akmods so I’m not sure if the new akmod wasn’t built, loaded or what.  However, here is what I did to fix

# Make sure the module built for your kernel
sudo akmods

# See if the module is loaded (if no results, it's not)
sudo lsmod | grep wl

# Manually load the module
sudo modprobe wl

Step 7 – Backlight

Once of the most annoying things for me with Fedora 19 on my Macbook was that the backlight would always go to 100% after a resume.  Luckily Patrik Jakobsson came to the rescue and implemented a new kernel module specifically for the Macbook Air 6,2.  The source of his driver is located here.  To build it, simply follow the instructions on his repository.  You’ll need to rebuild and install the driver on each kernel update.

For the X11 configuration file, I just create a file in /etc/X11/xorg.conf.d/01-backlight.conf with his suggested X11 configuration specifying the driver.  It works great.

Why did I give up on the RPM?  Well, I tried to hack around actually learning how to build a kmod RPM and the results just weren’t consistent.  Without calling ‘make modules’ and ‘make modules_install’ properly, the module wouldn’t always get loaded properly.  If there are any volunteers that are willing to put the mba6x_bl driver in a kmod RPM, I’m happy to host it.

Step 8 – SSD errors and Keyboard mapping

The next things I hit were some sporadic SSD errors.  In this thread, I found that I was able to set a queue depth to 1 and my errors largely went away.  Also, the tilde is mapped improperly so you need to apply a fix for that.  I’ve bundled both of these fixes as systemd service and a udev rule that will run at startup.

Step 8.1 – Add MattOnCloud Repository

I’ve created a yum repository that contains a built version of this code for Fedora as well as some of the other fixes below.  I’m keeping the source on GitHub and pull requests are definitely appreciated.  This was my first attempt at a package that would automatically rebuild with kernel updates so install at your own risk…  To install my repository, run:

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

To apply the fixes, then run:

sudo yum install mba-fixes

Wakeups after Suspend

I found the following blog which describes a way to avoid wakeups after suspending.  This is a bit of a pain for me since I’ll suspend at night only to have it wakeup after I’m asleep and drain the battery.  I’ve created a systemd script that runs each startup and disables XHC1 and LID0 from waking the machine up.  This means that after closing the lid to suspend, you need to open the lid and push the power button to wake the machine up.  This is now installed by the mba-fixes RPM.

Random Items

I went ahead and ran Fedy to setup a bunch of other random things, including the better IO scheduler for a SSD.  I would probably recommend doing that – there are a couple of options, but Fedy is pretty nice.

End Result

The end result with Fedora 20 is an impressive setup.  Mini-display to VGA projection actually works this time around which was a huge win for me.  Sound also works right out of the box.  Performance seems solid and I’ll be tracking battery life and updating.

I’ll keep you updated!

Advertisements

51 thoughts on “Fedora 20 on a Macbook Air

  1. Pingback: Fedora 19… on a Macbook Air (2013 Model)! | Matt on Cloud

  2. Pingback: Fedora 20 on a Macbook Air | Matt on Cloud - My Website

  3. Pingback: Fedora 20 on a Macbook Air | Matt on Cloud - My Website

  4. Matt, not sure if you are doing that, but instead of yum install broadcom-wl, do a: yum install kernel-devel akmod-wl

    using the akmod-wl, instead of the kmod-wl, you won’t have to download a new rpm every time you update your kernel.

    • The actual display of battery life remaining is a little quirky. Sometimes shows 5% or critical in the display even though in power settings you’ll see you have 70% or more. I think it is related to suspend resume. When running, battery life seems comparable to OSX although I haven’t done an extended test yet. However, I have noticed that when you suspend, it often wakes back up at some point. To combat this, I turned on Automatic Suspend after 15 minutes when on battery power and this seems to have corrected it.

      Hope this helps!

      • I haven’t seen this myself on my MBA (only on my older MBP) but in OSX the system wakes up after being in suspend for a while to go into hibernate. So if you leave the system in suspend for too long (a couple of days), it wont drain the battery. Could also be that if the battery goes too low while in suspend, It’ll wake up to go into hibernate so you don’t loose any data. No idea yet on how to solve this.

    • I haven’t experienced that issue. Every once in a while, my network connection will seem to be a little unstable (nothing close to dropping every 10 minutes though) but usually the next significant update fixes it.

  5. Hi, thanks for this article. Could you send avarage battery life time? with full display, mp3 and work in shell over wifi?
    Thanks

    • I can usually get about 6-8 hours out of it on a normal working day (mostly email, reading code, etc). I tend to run on a fairly dim brightness setting which helps. If I’m running virtual machines for development or doing Google Hangouts or anything video related, it burns through the battery quicker. I do run tuned with the balanced profile.

      In general, I think it’s roughly equivalent to what I experienced on OSX.

  6. Thanks so much for writing this up, you definitely saved me a fair amount of grief! One problem I’ve been having that I didn’t see documented here is the backlight switching to “off/on only” when I resume from sleep. Once I resume, the brightness control only serves to turn the brightness to either zero or full and no longer increments it.

    I was able to fix it using the instructions found here (https://bugs.freedesktop.org/show_bug.cgi?id=67454#c78). It was very easy to build and install and has taken care of the problem for me.

    • Yeah, that is absolutely key. I found it via a different source, but tried to document the same approach in Step 7. Technically, I tried to build a nice RPM around it but eventually gave up after fumbling through the kmod stuff. Was easy enough to build and install manually with each kernel update.

  7. Hi Matt,

    Thanks for your informative article.

    I have a question on the network capabilities. You have a MBA 6.2, as far as I know, it comes without a RJ45 LAN interface. Same for the MBA 6.1 that I recently bought, it is the 11 inch version, the 6.2 is the 13 inch version.

    I’m curious how you could do the yum update after the install as -at least in my experience- the wifi is not working yet. Did you use a hardware adapter, and if so, did you use an USB-RJ45 or an Thunderbolt-RJ45 ?

    Thanks in advance for our reply,

    • I did the first updates over USB-RJ45 ethernet. Once I didn’t have that available and shuffled RPM’s around on a USB stick, but the wired ethernet is a lot faster 🙂

      • I can also confirm that the Thunderbolt adapter works just fine as well. I was a bit concerned since I didn’t know what type of kernel support there was for Thunderbolt devices, but I just plugged it in and it worked flawlessly until I got the wifi up and running.

  8. Matt,
    thank you for the guide.
    none of the live versions of Fedora worked for me – 18-20. All the core dumping on me. At the same time i had no problem installing Fedora from the 20th netinst.iso. Well, yes, it was a couple hours ordeal while it was getting all 2500 packages. But it worked fine.
    i’m still having problem with the keyboard though – not sure hwo to switch to F1-F8 terminals.
    any ideas?

  9. This is a great tutorial, thank you ! But I am having a problem installing your mba-fixes for the ’tilde’ issue of MBA.
    I followed “sudo rpm -Uvh https://files-oncloud.rhcloud.com/yum/RPMS/x86_64/oncloud-repo-0.4-1.fc20.x86_64.rpm“, and then “sudo yum install mba-fixes” but this shows up:
    ____________________________________________
    Loaded plugins: langpacks, refresh-packagekit
    oncloud | 2.9 kB 00:00
    rpmfusion-free-updates | 3.3 kB 00:00
    rpmfusion-nonfree-updates | 3.3 kB 00:00
    updates/20/x86_64/metalink | 17 kB 00:00
    updates | 4.9 kB 00:00
    updates/20/x86_64/primary_db | 10 MB 00:07
    (1/2): updates/20/x86_64/updateinfo | 1.1 MB 00:01
    (2/2): updates/20/x86_64/pkgtags | 1.0 MB 00:00
    No package mba-fixes available.
    Error: Nothing to do
    _____________________________________________

    I also tried to follow this page : https://github.com/matthicksj/mba-fixes
    , and after ‘sudo tito build’
    I had :
    ___________________________
    Creating output directory: /tmp/tito
    WARNING: Please rename [globalconfig] to [buildconfig] in tito.props
    WARNING: please rename ‘default_builder’ to ‘builder’ in tito.props
    WARNING: please rename ‘default_tagger’ to ‘tagger’ in tito.props
    Checking for tag [mba-fixes-0.5-1] in git repo [https://github.com/matthicksj/mba-fixes]
    Building package [mba-fixes-0.5-1]
    ___________________________
    But after reboot, the problem is still here.
    Can you tell me what to do next ?
    Is there any other fixes just for the keyboard issue ?

  10. For whom has no RJ45 – USB convertor, if you have Android phone which can provide bluetooth tethering, it is available to use that network for the inital installation without WIFI support. I could handle it smoothly with bluetooth tetherng with my Galaxy S4.

  11. Thanks for a good guide! As I don’t have an ethernet adapter (MBP) I wanted to install the wireless drives with no network connection. So after some fiddling, I found http://forums.fedoraforum.org/showthread.php?t=255435 and basically followed instructions there, i.e. – after your step 3 I did following:
    1. Copied the kmod-wl and broadcom-wl rpms (in all 3) from rpmfusion repos
    2. Put on an usb
    3. Installed as described
    After reboot, this made wifi work – and I could proceed with step 4.

    I’m not very experienced here – so could be some things I’m missing, i.e. this is bad practise for some reason. But if sane, your guide might be updated with a “If not having a Thunderbolt adapter” alternative.
    Again – thanks for taking the time to write down your experience!

  12. Addition to my comment: After running your step 4, sudo yum update, the wifi entry was gone in the Network panel. So ran your step 6 (no need for the manual load you described) and after reboot, wifi back in Network panel. Again – not sure if optimal, but saved me the cost of a Thunderbolt adapter 🙂

  13. Pingback: Install and customize Fedora 20 on macbook | Mister Alphaville

  14. Pingback: Témoignage d’un développeur iOS : un mois formidable sous Linux, après des années sur Mac | Le Verbe Mondial

  15. Pingback: HowTo: Fedora 21 on a MacBook Air 6,2 (dual boot & good battery life) | trudgian.net

  16. I recently upgraded my mid-2013 from FC19 to FC21 just by doing “fedup 21”. It worked a dream and “shutdown -r” now works correctly. I would never go back to OSX.

  17. Hi everyone,
    I’ve managed to build an RPM for the backlight driver but there are still a few issues to fix. Currently builds only for one kernel and for some reason driver doesn’t get detected by a more recent kernel via wek-updates like my wireless driver is. My code is at
    https://github.com/atodorov/mba6x_bl (the rpm_on_rhel7 branch). I’ll send an offical PR once cleaned up.

    A question for Matt:
    I have a MacBook Air 7,2 (early 2015) and this driver seems to work. After resume my screen is lit up which was not the case before. However the display brightness controls don’t seem to work. Neither the keyboard buttons not the the GUI tool in MATE desktop. (I’m running RHEL 7 btw).

    Matt, do screen brightness controls work in Fedora ? If not how did you fix that ?

    Thanks,
    Alex

    • Hey Alex, unfortunately I’ve moved on to my Thinkpad X1 Carbon as my primary machine and passed along my Macbook Air. I don’t believe the brightness controls worked when I was using but I’m not 100% sure. Anyone else know?

  18. Hi Matt,
    I’ve been successful in getting brightness controls to work under RHEL 7.

    In short:
    1) mba6x_bl.ko wasn’t loading automatically b/c my hardware is newer (see RP #25 in their repo)
    2) I was experiencing RHBZ #989555 comment #20 (fix in comment #17)
    3) I’ve managed to build a kmod RPM package (see PR #26)

    I’ll post a detailed description for everyone who’s interested tomorrow and I’ll also host my RPMs publicly.

  19. Last week I installed Fedora 21 on Macbook Air 6,1 using the netinstall.iso. WIFI works by the rpmfusion, keyboard is out of the box working (US int dead keys), backlight works out of the box. Quit amazing.

  20. Since I got pinged on a new post on this thread, I thought I should file an update as well. The MacAir that I had set up with F21, has now been updated via “fedup –network 22” when Fedora 22 came out. All of the functionality is there – wifi, mouse etc. No complains at all.

  21. Pingback: HowTo: Fedora 21 on a MacBook Air 6,2 (dual boot & good battery life) – trudgian.net

  22. Pingback: HowTo: Fedora 21 on a MacBook Air 6,2 (dual boot & good battery life) – trudgian.net

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s