Fedora 24 on MacBook Pro 11,4 and 11,5 – suspend and brightness fix

I have a great news for those of you with a MacBook Pro 15″ 2015 (MacBook 11,4 and 11,5)!

As you might have noticed, when running Linux on this machine, it can’t be suspended, shut down, and you can’t even control brightness of the display. These issues have been reported a while ago, and yes, there are some patches, but they didn’t make it to the production code.

Suspend and shutdown: https://bugzilla.kernel.org/show_bug.cgi?id=103211#c172
Brightness: https://bugzilla.kernel.org/show_bug.cgi?id=105051#c32

So I took those patches, applied them to the kernel in Fedora and built it in my Copr project.

How to make it running on your machine? First, download and install Fedora 24. Then you just need to enable my Copr project and install the patched kernel:

$ sudo dnf copr enable asamalik/MacBook-kernel
$ sudo dnf install kernel-4.6.6-300.AdamsMacBookSleepBrightness.fc24

Reboot your machine with the patched kernel, and that’s it!

I will try to keep the repo updated, so you will be able to update kernel as usual.

  • NullVox

    How do you patch ubuntu?

    • Adam Šamalík

      Probably similar way like Fedora. I do not have experience with ubuntu packaging. But you should be able to use the same patches with ubuntu kernel package and rebuild it.

  • Hervé Rilos

    Thanks for the patch. It works very well. Hope they’ll package it soon into the main repository.

    • Adam Šamalík

      I think it breaks something on a hardware that is not in the MacBook – more details in the kernel bug report. So it might not make it into the main repo.

  • Jarl André

    Any idea of when you are releasing a patch for 4.7.7 kernel? 🙂

    • Adam Šamalík

      Hey Jarl, if you’re fine with 4.7.2, I just submitted a build: https://copr.fedorainfracloud.org/coprs/asamalik/MacBook-kernel/build/449315/

      • Jarl André

        I might actually have taken the kernel version from memory so it might be 4.7.2 is the current kernel… 😉 but anyway. I think … That shutdown is not working. Works sometimes but mostly not. Suspend always works. Good job anyway because why should you restart or stop. And if you need just hold down power to shutdown. Also with never Linux versions they should be able to hot patch kernel.

        • Adam Šamalík

          Yes, I have noticed that the shutdown doesn’t work always… But at least we have suspend and brightness control working! And it’s not my work, I just applied patches found in kernel bugzilla 🙂

      • Jon Walton

        How do I install the 4.7.2 build?

        If I try sudo dnf install 4.7.2-201.AdamsMacBookSleepBrightness.fc24 I get an error saying the package is not available.

        • Adam Šamalík

          In this example you are writing here you missed “kernel”. The following command should work.

          $ sudo dnf install kernel-4.7.2-201.AdamsMacBookSleepBrightness.fc24

  • Jarl André

    Oh, and a ncie tip is to disable kernel updates in /etc/dnf/dnf.conf with adding exclude=kernel* to avoid sudden and unexpected updates of the kernel.

    • Adam Šamalík

      Nice tip! I’ll add it to the repo description. Thanks!

  • Steve

    I’m having trouble with the copr repo. I suspect I’m doing something stupid:


    $ sudo dnf install kernel-4.6.6-300.AdamsMacBookSleepBrightness.fc24
    Last metadata expiration check: 0:20:58 ago on Wed Sep 7 08:50:31 2016.
    Error: Unable to find a match.

    $ sudo dnf list asamalik/MacBook-kernel
    Last metadata expiration check: 0:21:16 ago on Wed Sep 7 08:50:31 2016.
    Error: No matching Packages to list

    $ uname -r
    4.7.2-201.fc24.x86_64

    Any ideas?

    • Adam Šamalík

      Did you enable the Copr repo first?

      $ sudo dnf copr enable asamalik/MacBook-kernel

      • Steven Webb

        Yes. No luck.


        $ sudo dnf copr enable asamalik/MacBook-kernel
        ...
        Repository successfully enabled.
        $ sudo dnf install kernel-4.6.6-300.AdamsMacBookSleepBrightness.fc24
        Last metadata expiration check: 2:24:08 ago on Tue Oct 4 06:34:45 2016.
        No package kernel-4.6.6-300.AdamsMacBookSleepBrightness.fc24 available.
        Error: Unable to find a match.

        • Steven Webb

          Finally got it working using the updated package name. Not sure why I had so much trouble the first time.

          Thanks Adam.

  • Rocky

    I was trying to compile the https://github.com/patjak/bcwc_pcie kernel module so that I could use the webcam, but I ran into the following error. I’m not sure where to turn for help:


    bcwc_pcie$ make
    make -C /lib/modules/4.7.2-201.AdamsMacBookSleepBrightness.fc24.x86_64/build M=/XXX/bcwc_pcie modules
    make[1]: *** /lib/modules/4.7.2-201.AdamsMacBookSleepBrightness.fc24.x86_64/build: No such file or directory. Stop.
    Makefile:12: recipe for target 'all' failed
    make: *** [all] Error 2

    Thanks for this kernel though, it does fix my power/suspend and brightness problems!

    • Adam Šamalík

      Sorry I am no Kernel expert. I just took those two patches and applied them.

  • Dennis

    Would you share your build process with me maybe? I’m trying to apply the apple-gmux patch myself, but I can’t seem to find the apple-gmux.c file.

    It’s not in kernel-devel it seems.. Any pointers on where to get the source from would be very welcome! Thank you for your work btw 🙂

  • Roy

    Adam,
    Great work! I am hesitant to put linux back on my Mac as I don’t have the time ringt this moment to troubleshoot more issues. The big issue for me is the Force Touch trackpad. Have you seen a solution where right-click works like in OSX?

    Thanks

  • Ihar Hrachyshka

    For those wondering what to do with Fedora 25 and the new kernel (4.10.x), I prepared the following COPR:

    https://copr.fedorainfracloud.org/coprs/ihrachyshka/macbook-fixes/

    Note it includes the kernel with those two fixes applied (brightness and suspend), as well as facetimehd-kmod package that contains web camera module for the custom kernel built from https://github.com/patjak/bcwc_pcie