Instantly share code, notes, and snippets.

Embed
What would you like to do?
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - see the updated instructions below and make sure to update your clone of the roadrunner2/macbook12-spi-driver repo to get the latest drivers.

Summary Of Current State

What works

  • Booting (i.e Grub etc)
  • Recognizes disk on all models (older kernels may need patch for some models, though)
  • Keyboard, touchpad, and basic touchbar functionality
  • HiDPI detection
  • Accelerated video
  • Screen brightness control
  • Keyboard backlight
  • USB
  • Sensors (install lm_sensors package)
  • Camera
  • Bluetooth (older kernels need patches)
  • WiFi on MBP13,1 and MBP14,1

What doesn't work

  • WiFi on ,2 and ,3 models (though some folks have had success with some of the workarounds)
  • Suspend/Resume
  • Audio (two cards show up, and intel driver is loaded, but no sound)

Untested

  • Thunderbolt
  • DisplayPort

Details

Partitioning

If you want to keep your MacOS installation (generally a good idea if you can afford the disk space, because that's the only way to get/install firmware updates), then first boot into MacOS and resize the partition there, creating a new partition for the Linux installation. If you also want to have a Windows partition, see this comment below.

Warning: If you're not going to keep MacOS, either back up the EFI System Partition (and restore its contents to the new ESP after installation) or leave it intact (i.e. don't do a full disk install, but just use the space after the ESP). This partition (it's the first one) contains drivers/firmware/etc needed by Apple's EFI loader during boot, in particular to initialize the Touchbar.

Initial Installation

Since the internal keyboard and touchpad won't work until you have built and loaded the drivers, you'll need to plug in an external USB keyboard to do the initial setup and installation.

Booting

If you're booting a 4.11 or later kernel, no special params or patches are needed.

If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the kernel-nvme-controller.patch from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):

echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
sudo dracut --force --kver <kernel-version>

If you're booting a kernel < 4.10 then you'll need the following kernel param to boot properly: intremap=nosid. E.g.

sudo sed -i 's/\(GRUB_CMDLINE_LINUX=.*\)"/\1 intremap=nosid"/' /etc/default/grub
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Lastly, if you are booting a live CD or similar with a kernel < 4.9 then you will also need to add the nomodeset kernel parameter to your kernel line; you will then not have proper HiDPI detection or accelerated graphics.

Keyboard/Touchpad/Touchbar

For this we need the drivers from https://github.com/roadrunner2/macbook12-spi-driver.git (a clone of https://github.com/cb22/macbook12-spi-driver which includes a preliminary touchbar driver and keyboard fixes). The following commands set this up.

First some extra packages:

sudo dnf install git kernel-devel dkms

Next we need to prepare for the modules to be included in the ramdisk (so they are loaded early during boot):

cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
# load all drivers needed for the keyboard+touchpad
add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform apple-ib-tb"
EOF

On distros using mkinitramfs instead of dracut you'll want to do the following instead:

cat <<EOF | sudo tee -a /etc/initramfs-tools/modules
# drivers for keyboard+touchpad
applespi
apple-ib-tb
intel_lpss_pci
spi_pxa2xx_platform
EOF

Now get and build the drivers:

git clone https://github.com/roadrunner2/macbook12-spi-driver.git
pushd macbook12-spi-driver
git checkout touchbar-driver-hid-driver
sudo ln -s `pwd` /usr/src/applespi-0.1
sudo dkms install applespi/0.1
popd

Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the 61-evdev-local.hwdb and 61-libinput-local.hwdb from this gist):

sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
sudo systemd-hwdb update

You can test the drivers by loading them and their dependencies:

sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi apple-ib-tb

Finally, reboot to make sure it all works correctly:

sudo reboot

Screen Brightness Control

Screen brightness control works out of the box on MacBookPro13,1 and MacBookPro13,2 (all kernels), and MacBookPro13,3 with recent kernels, but requires a kernel patch on MacBookPro13,3 with older kernels (see also https://github.com/Dunedan/mbp-2016-linux/issues/2). Specifically, if you have any of these kernels you need to patch: < 4.14, 4.14 - 4.14.21, 4.15 - v4.15.5 (i.e. the issue was fixed in 4.14.21, 4.15.5, and 4.16). The following will create and install the patched apple-gmux:

mkdir apple-gmux
pushd apple-gmux

curl -o apple-gmux.patch 'https://bugzilla.kernel.org/attachment.cgi?id=192601'
curl -o apple-gmux.c 'https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/platform/x86/apple-gmux.c?id=refs/tags/v4.9.11'

patch < apple-gmux.patch

echo -e '
obj-m += apple-gmux.o

all:
\tmake -C /lib/modules/`uname -r`/build M=`pwd` modules
' > Makefile
make

mod=$(ls /lib/modules/`uname -r`/kernel/drivers/platform/x86/apple-gmux.ko*)
sudo mv $mod{,.orig}
sudo cp apple-gmux.ko /lib/modules/`uname -r`/kernel/drivers/platform/x86/
sudo depmod

popd

sudo reboot

Other

The touchpad defaults to using the bottom-left corner for right-clicks - to get 2-finger right click, install the Gnome tweak tool and change it in there.

WiFi

WiFi works fine on MBP13,1 and MBP14,1. But the other models use a different chipset, and while on those the brcmfmac driver is automatically loaded, there are a number of issues with it, making it for all practical purposes unusable:

  • it only does 2.4GHz - no 5GHz channels are visible
  • it has an extremely low sensitivity - you must be within a few feet of the base station, and even at 5 feet distance it shows a weak signal.
  • it stops working after 10 or 15 or so minutes; turning WiFi off, waiting a several minutes, and then turning it back on generally gets it working again. Maybe a thermal issue?

Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=193121

In the mean time some folks have that one or both of the following hacks make the WiFi work well enough them (personally, while they do improve the situation, I have not found them to be sufficient enough for actual work, i.e. I still see many packet drops and connection failures - YMMV):

  • reduce the transmit power: sudo iwconfig wlp3s0 txpower 10
  • edit the firmware blob (/lib/firmware/brcm/brcmfmac43602-pcie.bin) and modify the regrev and ccode values (see the above bugreport for details)

Display

The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On the 13 inch models the use of the intel needs to be forced (see first comment below).

Camera

MacBookPro13,3/14,3: works out of the box on kernels 4.13 and later; on earlier kernels you need the following:

echo "options uvcvideo quirks=0x100" > /etc/modprobe.d/uvcvideo.conf

For MacBookPro[13,14],[12] you need the bcwc_pcie driver (mainline branch) - see also https://github.com/Dunedan/mbp-2016-linux/issues/15.

Bluetooth

As of kernel 4.16 bluetooth works out of the box; older kernels need patches - see https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-331693489 and following discussion for details. But in short you'll need to:

  • Ensure your kernel is configured with CONFIG_BT_HCIUART_BCM=y
  • apply the patches from hci_bcm-4.13, hci_bcm-4.14, or hci_bcm-4.15, depending on whether you have a 4.13 or earlier, 4.14, or 4.15 kernel.
  • build and reboot
  • on 4.14 and earlier apply the service patch from the above comment and start the service as described there (not necessary on 4.15 and later).

Note that as of 4.16 there are still issues on MacBookPro13,1 and MacBookPro14,1 - see the above bug for details on what additional patches are needed.

# MacBook8,1 (2015), MacBook9,1 (2016), MacBook10,1 (2017)
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook8,1:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook9,1:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook10,1:*
EVDEV_ABS_00=::95
EVDEV_ABS_01=::90
EVDEV_ABS_35=::95
EVDEV_ABS_36=::90
# MacBookPro13,* (Late 2016), MacBookPro14,* (Mid 2017)
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,1:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,2:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,1:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,2:*
EVDEV_ABS_00=::96
EVDEV_ABS_01=::94
EVDEV_ABS_35=::96
EVDEV_ABS_36=::94
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,3:*
evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,3:*
EVDEV_ABS_00=::96
EVDEV_ABS_01=::95
EVDEV_ABS_35=::96
EVDEV_ABS_36=::95
libinput:name:*Apple SPI Touchpad*:dmi:*
LIBINPUT_MODEL_APPLE_TOUCHPAD=1
LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
LIBINPUT_ATTR_TOUCH_SIZE_RANGE=200:150
LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=1200
--- a/drivers/nvme/host/pci.c 2017-01-22 21:49:03.710949755 -0800
+++ b/drivers/nvme/host/pci.c 2017-01-22 21:49:23.490761505 -0800
@@ -2121,6 +2121,7 @@
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, nvme_id_table);
@Dunedan

This comment has been minimized.

Dunedan commented Jan 24, 2017

Very good overview, especially as I basically did the same with a focus on the MacBookPro13,2: https://github.com/Dunedan/mbp-2016-linux

Regarding the screen resolution issue: That appears to be a bug in the EDID data provided by the display. Happens on the 13,2 as well (https://github.com/Dunedan/mbp-2016-linux#screen). It could also be that the displays have a higher resolution as advertised, but as Xorg correctly probes the right resolution I suspect it being a bug.

Hardware accelerated graphics output is also no problem with the integrated intel graphics card on the MacBookPro13,2. I just had to force Xorg to pick the intel driver (with Debian). I did a quick try with 0ad and that runs really smooth with >50fps with highest graphical details and native screen resolution.
Settings the screen brightness works also out of the box with Debian. The UX isn't that nice, as there are no dedicated keys for doing it, as the Touch Bar isn't working yet and the integrated ambient light sensor isn't working either yet. But in KDE I can easily change it via the power management settings.

I have the problem from time to time that NVMe isn't properly working at boot and I have to restart to get it working. Do you have the same issue as well? I thought it could be related to the queue depth related workaround from https://github.com/torvalds/linux/blob/v4.10-rc5/drivers/nvme/host/pci.c#L1619 which is in place for the MacBook8,1, but not yet for the MacBookPro13,x, but I haven't tried it out yet.

I also have no problem with the spurious events from the Touch Bar you mention, don't know why.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jan 24, 2017

No, so far I've not any issues with the disk at all - must be due to the different controller I guess.

Interesting about the intel graphics card: I don't see it at all on my system, for some reason. Here's where I looked:

$ dmesg | grep -i vga
[    0.620237] vgaarb: device added: PCI:0000:01:00.0,decodes=io+mem,owns=none,locks=none
[    0.620239] vgaarb: loaded
[    0.620240] vgaarb: setting as boot device: PCI:0000:01:00.0
[    0.620240] vgaarb: bridge control possible 0000:01:00.0
[    1.077795] fb0: EFI VGA frame buffer device
[    1.627562] [drm:amdgpu_init [amdgpu]] *ERROR* VGACON disables amdgpu kernel modesetting.
[   11.912424] [drm:amdgpu_init [amdgpu]] *ERROR* VGACON disables amdgpu kernel modesetting.

$ lspci -nn | grep -i VGA
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Radeon RX 460] [1002:67ef] (rev ef)

How is it showing up on your system? Without a pci bus id, I don't know how I'd tell xorg to use the card.

Lastly, on my system the resolution (using the fbdev driver) shows up as:

$ xrandr 
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 3360 x 2100, current 3360 x 2100, maximum 3360 x 2100
default connected primary 3360x2100+0+0 0mm x 0mm
   3360x2100     90.00* 

$ xdpyinfo | grep -A4 ^screen
screen #0:
  dimensions:    3360x2100 pixels (889x556 millimeters)
  resolution:    96x96 dots per inch
  depths (7):    24, 1, 4, 8, 15, 16, 32
  root window id:    0x25d

so wrong resolution and wrong physical size/dpi.

@Dunedan

This comment has been minimized.

Dunedan commented Jan 25, 2017

Ok, I got the MacBookPro13,2 which only has the integrated Intel graphics and no additional AMD graphics. That it doesn't show up for you is probably related to that additional graphics chip. 😟

Regarding the wrong resolution with fbdev: I get the same if I boot with modesetting disabled. If I boot with modesetting enabled the screen becomes unreadable during boot, but Xorg starts properly and I get the correct resolution afterwards. If I then in addition force it to use the intel driver I get a pretty decent graphical experience.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jan 26, 2017

Well, your comment prompted me to test again, and it turns out that with the 4.9 kernel kms works 🎉 So thank you! And as you say, it then discovers the correct resolution, and even plymouth and gdm then properly detect HiDPI. I can then run both X and Wayland, and AFAICT graphics performance is good. I still don't see the Intel GPU, but at least the AMD one now works well.

@tudorbarascu

This comment has been minimized.

tudorbarascu commented Jan 30, 2017

Hi and thanks for this nice walk-through. I got stuck at mv ...the-attached-dsdt.dsl.patch... dsdt.dsl.patch as I don't know where to get from ..the-attached-dsdt.dsl.patch..

Thank you!

I just noticed I had to "Download zip" on the upper right of this page.

@bubuntux

This comment has been minimized.

bubuntux commented Feb 26, 2017

i'm not able to make it work on Arch

i'm using mkinitcpio instead of Initramfs, so not sure where or how to add the keyboard.conf

i already tried including it into file /etc/mkinitcpio.conf
FILES="/etc/keyboard.conf"

and regenerating the img
mkinitcpio -p linux

but didn't work
halp!

@Edweirdo256

This comment has been minimized.

Edweirdo256 commented Feb 28, 2017

I was able to get my MacBook Pro 13,3 working with these instructions. Unfortunately, the wireless card is still flakey. It sees it but when I try to attach to the SSID, it just drops me.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Mar 4, 2017

@bubuntux Sorry for the late reply. I don't know Arch, but some searching indicates you need to do the following:

  • See Arch's DSDT page on how to use the modified dsdt (the first option looks best - note that there's no ssdt1.aml to copy here, just the dsdt.aml)
  • For the loading of the additional modules, add applespi intel_lpss_pci spi_pxa2xx_platform appletb to the MODULES in /etc/mkinitcpio.conf.
@mhkabir

This comment has been minimized.

mhkabir commented Mar 11, 2017

@roadrunner2 @Dunedan Many thanks for your contributions! I managed to install Ubuntu 16.04.1 and got it booting using nomodeset.

I then upgraded to the mainline 4.10.1 kernel in order to get proper HiDPI detection and booting without nomodeset, but it gets stuck at fb0: EFI VGA frame buffer device. Any ideas on what's going on? Is there a proven kernel version which works? A description of your stable setup would be super-useful here.

I'm currently trying to get the keyboard and touchpad working, after which I shall be able to assist with bugfixing and potentially upstreaming these patches.

Thanks!
Kabir

@mhkabir

This comment has been minimized.

mhkabir commented Mar 11, 2017

Got it working by running a dist-upgrade. Now amdgpu initializes properly and I get correct HiDPI detection. I'm on kernel 4.10.1-041001-generic. I also got the touchar/touchpad/keyboard working after some hackery, because mkinitramfs wouldn't use the patched DSDT. I had to install dracut and generate a new image with the patched DSDT.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Mar 12, 2017

@mhkabir

I also got the touchar/touchpad/keyboard working after some hackery, because mkinitramfs wouldn't use the patched DSDT.

Do you have any idea why it didn't accept it? Any particular errors? Did you try running mkinitramfs with -v? Or are you saying that mkinitramfs ran fine but when the kernel booted it didn't pick up the new DSDT?

Assuming the latter, and that what dracut did was prepend an uncompressed cpio archive to initrd, then you can also achieve that with the following commands (assuming a regular, mkinitramfs generated /boot/initrd.img-...):

mkdir -p kernel/firmware/acpi/
cp ...dsdt.aml kernel/firmware/acpi/
echo 1 > early_cpio
find early_cpio kernel | cpio -H newc --create > initrd.img
cat /boot/initrd.img-... >> initrd.img
mv initrd.img /boot/initrd.img-...
@mhkabir

This comment has been minimized.

mhkabir commented Mar 13, 2017

@roadrunner2 Thanks! mkinitramfs ran fine, but the new DSDT wouldn't be picked up.

I have made interesting progress here meanwhile : Dunedan/mbp-2016-linux#6

@Camicaze

This comment has been minimized.

Camicaze commented Apr 10, 2017

Great summary, thank you for sharing! It seems like the statement "(MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly)." is not correct. My MacBookPro13,3's nvme doen not work out of the box and manually binding it with

echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id

does not work either. I will try to use the patch you named for the 13,1 and 13,2 to see if that helps. What model is the SSD you used? Mine is listed as "Apple SSD SM0512l"

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 13, 2017

@Camicaze What is the pci id of your NVMe controller? (lspci -nn | grep NVMe ) On mine it's 144d:a804. Also, from the model number it seems you have the 512GB SSD? Mine is the 1TB and shows up as "APPLE SSD SM1024L".

@ghost

This comment has been minimized.

ghost commented Apr 16, 2017

Thanks for this awesome summary!
I just tried to get Fedora working on my MacbookPro13,1 and failed miserably, because of the nvme problem.
Using the commands modprobe nvme; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id made it possible for me to get through the installation process, but it just won't boot afterwards, since the command is not a permanent solution.

My question is, how to boot the system to patch the kernel? Do I have to patch the files using the LiveUSB environment?
I'm relatively new to Linux, so I would be really glad if somebody could help me finding a solution.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 16, 2017

@B14ckSh4d0w Yes, you'll need to boot using the LiveUSB in order to fix things. However, I think you can avoid patching the kernel (untested, so please let me know either way). Once booted, mount the disk and run the following commands (assuming you mounted the disk on /mnt - otherwise substitute appropriately):

sudo chroot /mnt
cat <<EOF > /etc/modprobe.d/nvme.conf
install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id
EOF
dracut --force
exit

Then reboot. What this does is intercept the modprobe nvme operation to both load the module as well as add the desired id. If this works (as I think it does) then I'll update the instructions above.

@ghost

This comment has been minimized.

ghost commented Apr 17, 2017

@roadrunner2 Thank you a lot for your reply! At the beginning, I had a few difficulties performing the dracut --force command, but I just made a mistake while mounting the disk. (If anybody has this problem as well: here's a solution)

After running all commands without any error messages, I tried to boot the system but had no success.
The system starts the dracut emergency scripts after random: crng init done
At the end it says, that /dev/disk/by-uuid/... does not exist, which is my root partition.
Have you got an idea how to solve this problem?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 18, 2017

@B14ckSh4d0w I'm sorry this didn't work. Good to see you managed to figure out how to mount the stuff (yes, I glossed over that a bit). Hmm, I wonder if an explicit load of the nvme module is missing - try forcing it as follows (this is in addition to the modprobe change above):

... do your mounts ...
sudo chroot /mnt
echo <<EOF > /etc/dracut.conf.d/disk.conf
force_drivers+="nvme"
EOF
dracut --force
exit

and reboot.

@legendtang

This comment has been minimized.

legendtang commented Apr 21, 2017

Great work but with one issue. The keyboard driver doesn't work on some keys of non-standard keyboard. Like Japanese one | and _

@ghost

This comment has been minimized.

ghost commented Apr 21, 2017

@roadrunner2 That's absolutely no problem. I've learned from my mistake so it was actually good to figure things out by myself.
I've tried forcing to load the module with the command above, but it didn't work either. It seems like the file /etc/dracut.conf.d/disk.conf is empty after running the command? I still get the same error message while booting.

Could it be possible, that Fedora is the problem? I installed an rc version of the 4.11 Kernel while chrooting (since the nvrm bug should be gone in this version), but with the new kernel it doesn't even start booting at all.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 22, 2017

@B14ckSh4d0w Argh! I can't believe I made such a stupid mistake - that was supposed to be a cat not an echo - disk.conf should definitely not be empty (so no wonder it didn't work) ☹️. Or the simpler way to put the right contents in that file (this time correctly using echo):

echo 'force_drivers+="nvme"' > /etc/dracut.conf.d/disk.conf

As not even starting to boot, that is probably some other issue then. If you're trying out the 4.11 kernel, you might want to remove that /etc/modprobe.d/nvme.conf we created earlier, though I don't think it should cause issues.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 22, 2017

@legendtang I recommend you look at and comment on cb22/macbook12-spi-driver#12

@ghost

This comment has been minimized.

ghost commented Apr 22, 2017

@roadrunner2 YOU ARE MY HERO! Finally I can use Linux. Thank you a lot! :-)

EDIT: Well, one problem goes and another one comes, haha. I updated the kernel to the latest version (4.10.10, not the experimental 4.11) but grub just won't load it. I can boot the old kernel (4.8.6) without any problems now, but choosing the new one ends up in a black screen right after hitting enter. I don't even get a single system message and nothing is written in the log files either, which I accessed with the command journalctl --boot=-1. Have you got an idea on that?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 22, 2017

@B14ckSh4d0w Great to hear that worked. As to booting 4.10.10: sorry if this is a stupid question, but did you rebuild the initrd for that kernel? If you run plain dracut --force it'll rebuild the initrd for the currently running kernel version - to rebuild for a different version use the --kver <version> option. E.g., assuming you're talking about Fedora 25's latest 4.10.10 kernel, the command would be:

dracut --force --kver 4.10.10-200.fc25.x86_64

You can determine the version by looking at the names of the files /boot/vmlinuz-<version>.

@ghost

This comment has been minimized.

ghost commented Apr 23, 2017

Experts, I am very keen to run linux on my mbp-2016 but obviously I got stuck at the well known issues addressed in this project.
I got to the point to build a live USB for fedora25 ubuntu1404 and ubuntu1610 but obviously everything hangs at the beginning of the boot. I am very happy to hear that most of the problems are addresses. But I don't understand how to apply the fixes that you have found.
Can you kindly share a simple guide how to move forward.....
Thanks!!

@ghost

This comment has been minimized.

ghost commented Apr 23, 2017

@roadrunner2 That's not a stupid question, don't worry! But yes, I did rebuild the initramfs by using the command above
(dracut --force --kver 4.10.10-200.fc25.x86_64). I rebuilt it several times now, but my mac just won't start doing anything after choosing the newer kernel.
I added the -v option to the dracut command and didn't get any error messages. So the build of the initrd seems to be ok.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 23, 2017

@B14ckSh4d0w and @ltosolini: I presume you've made sure that the linux command line in grub contains intremap=nosid? Furthermore you probably want to remove the quiet option there if present. Finally, try with and without nomodeset. (on F25 the grub.cfg can be found at /etc/grub2-efi.cfg - not sure where it is on Ubuntu for this platform.)

@ltosolini: Ubuntu 14.04 definitely won't work - the kernel is way too old; Ubuntu 16.10 appears to have the 4.8 kernel, so that should sort of work.

@ghost

This comment has been minimized.

ghost commented Apr 23, 2017

@roadrunner2 My grub.cfg already contains the command intremap=nosid, since this was on of the first things I did when the first boot succeeded. And I already tried removing the quite option and using nomodeset, without any success. It seems like grub doesn't even start loading the kernel.

I'm going to try another Fedora image now, since I tried to use Fedora Spin KDE Plasma Desktop before. Maybe I won't have any problems regarding the kernel with the normal Fedora Workstation.
I'll keep you updated. Have a nice day!
UPDATE: not working either. grrr...

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 24, 2017

If nothing at all shows up even with quiet off, then this looks more like an issue with the kernel image or initrd, not with any missing drivers. Some things to check:

  • do the sizes of the /boot/vmlinuz-* and /boot/initramfs-* files look kosher? (all similar sizes, vmlinuz around 7M, initramfs around 2M)
  • Is the kernel image unmodified: check (there should be no output in both cases)
    • sudo rpm --verify kernel-core-4.10.10-200.fc25.x86_64
    • cmp /boot/vmlinuz-4.10.10-200.fc25.x86_64 /lib/modules/4.10.10-200.fc25.x86_64/vmlinuz
  • is the initrd sound:
    • sudo cat /boot/initramfs-4.10.10-200.fc25.x86_64.img | cpio -tv (should list some directories, the dsdt, and some microcode)
    • sudo /usr/lib/dracut/skipcpio /boot/initramfs-4.10.10-200.fc25.x86_64.img | gunzip -c | cpio -tv > /tmp/initrd.ls (there should be no errors, and about 2000 entries in the resulting /tmp/initrd.ls)

You could also try adding some output to your grub.conf along the lines of

 menuentry .... {
     ....
     echo loading kernel
     linuxefi /vmlinuz-....
     echo loading ramdisk
     initrdefi /initramfs-....
     echo booting
}
@ghost

This comment has been minimized.

ghost commented Apr 25, 2017

@roadrunner2 Thanks again for your reply. I did what you told me and everything seems to be alright:

  • the sizes of the /boot/vmlinuz-* (6.7M) and /boot/initramfs-* (19.7M) are okay (you meant 20M right?)
  • the kernel image check was successful (no output)
  • sudo cat /boot/initramfs-4.10.10-200.fc25.x86_64.img | cpio -tv gave me this output:
drwxr-xr-x   3 root     root            0 Nov  7 10:59 .
-rw-r--r--   1 root     root            2 Nov  7 10:59 early_cpio
drwxr-xr-x   3 root     root            0 Nov  7 10:59 kernel
drwxr-xr-x   3 root     root            0 Nov  7 10:59 kernel/x86
drwxr-xr-x   2 root     root            0 Nov  7 10:59 kernel/x86/microcode
-rw-r--r--   1 root     root        97280 Nov  7 10:59 kernel/x86/microcode/GenuineIntel.bin
192 blocks
  • sudo /usr/lib/dracut/skipcpio /boot/initramfs-4.10.10-200.fc25.x86_64.img | gunzip -c | cpio -tv > /tmp/initrd.ls gave me a file with 1843 lines -> which you can find here (converted into a .txt file, so you can us the preview function of Dropbox)
  • and after adding the output lines and trying to boot it says
loading kernel
loading ramdisk
booting
□

I've been waiting at this point for about 30min and nothing happens.
So apparently it successfully loads the kernel and the ramdisk, right? So what could go wrong after that, which causes the system to freeze?

@fannullone

This comment has been minimized.

fannullone commented Apr 25, 2017

Sorry guys, I think I am missing a piece of the story.
I followed this guide: https://linuxnewbieguide.org/how-to-install-linux-on-a-macintosh-computer/
using a stock fedora25 64bit image to build a live USB media.
Then I mounted the usb drive on the same mac running macos and edit the grub.cfg adding 'intremap=nosid' and 'nomodset':

mbp:~$ cat /Volumes/ANACONDA/EFI/BOOT/grub.cfg 
set default="1"

function load_video {
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
  insmod all_video
}

load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2

set timeout=60
### END /etc/grub.d/00_header ###

search --no-floppy --set=root -l 'Fedora-WS-Live-25-1-3'

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Start Fedora-Workstation-Live 25' --class fedora --class gnu-linux --class gnu --class os {
	linuxefi /images/pxeboot/vmlinuz root=live:CDLABEL=Fedora-WS-Live-25-1-3 rd.live.image intremap=nosid nomodeset
	initrdefi /images/pxeboot/initrd.img
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This way it is booting fine all the way to initial user selection screen but then I am stuck here because mouse and keyboard are not working.

If I boot this USB drive on another PC it boots fine but I see that it runs kernel 4.8 which I understand is too old for mbp; so what I don't understand now is how to upgrade the kernel if I can not use mouse and keyboard? And also how to do the other operations suggested in this thread if I don't have a workable system!

@fannullone

This comment has been minimized.

fannullone commented Apr 25, 2017

Guys,
when I boot fedora25 from the live USB drive I get the grub menu and if I press 'e' on an entry I can edit that entry.
The problem is when I am done with editing, I have to press either CTRL-x or ESC to move forward but I am not able to find any key combination to get either CTRL or ESC. Any idea?
Thanks!

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 25, 2017

@fannullone Kernel 4.8 should work well enough to get started, so that's not the issue. You get a working keyboard have essentially two options: either plugin in and use an external USB keyboard and mouse, or modify the initrd you're using to boot (/images/pxeboot/initrd.img) to contain the modified DSDT and the applespi and appletb drivers, as explained Keyboard/Touchpad/Touchbar section above.

As to editing grub at boot, that is a definite problem for which I have not found any solution so far either 😞 (ctrl does work for keys, such as ctrl-c, ctrl-a, and ctrl-e, but no idea why not for ctrl-x).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 25, 2017

@B14ckSh4d0w That initrd doesn't look right: it's A) missing the dsdt.aml in the header part (where you see the early_cpio and microcode files), and B) the main part does not contain the applespi or appletb drivers (nor even the spi_px2xx_platform driver). Having said that, that by itself can't be the reason why it's not booting (it would just mean you end up with the keyboard not working). Though, hmm, I do see a /etc/cmdline.d/20-force_drivers.conf in your initrd - if that specifies drivers that aren't actually in your initrd that might be an issue.

@nathanchilton

This comment has been minimized.

nathanchilton commented Apr 29, 2017

I am using a 13,1 and thus cannot see the SSD without a kernel patch, or kernel version 4.11. I found a utility called isorespin.sh which makes it easy to update an Ubuntu/Mint ISO file with a newer kernel. This made it possible for Linux to see the SSD and install onto the MBP. However, I was not able to get the internal keyboard and touchpad to work. I'm probably missing a step.

So, to make things easier I thought I'd try Fedora to be able to follow your method better. How do you patch the installation media so that the Fedora installer can actually see the hard drive?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 30, 2017

@nathanchilton Re-creating the initrd as I describe in "Booting" section above should do the trick, I believe.

@ezdora

This comment has been minimized.

ezdora commented May 2, 2017

Hi, great work!

I have run fedora 26, in "MacBook 12" 2016, and everything work out of the box except:

  • keyboard
  • touchpad
  • audio

With your patches keyboard and touchpad are working.

Is there a way to get audio working?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented May 3, 2017

@ezdora I'm not aware of anybody having gotten internal audio working yet 😞

@ghost

This comment has been minimized.

ghost commented May 4, 2017

@roadrunner2 Hey! Sorry for my long inactivity, but I was really busy the last days. Anyway, I still wasn't able to get it working with any newer kernel. I took a look into the initramfs of the working kernel and it looks exactly the same:

sudo cat /boot/initramfs-4.8.6-300.fc25.x86_64.img | cpio -tv
drwxr-xr-x   3 root     root            0 Nov  7 10:59 .
-rw-r--r--   1 root     root            2 Nov  7 10:59 early_cpio
drwxr-xr-x   3 root     root            0 Nov  7 10:59 kernel
drwxr-xr-x   3 root     root            0 Nov  7 10:59 kernel/x86
drwxr-xr-x   2 root     root            0 Nov  7 10:59 kernel/x86/microcode
-rw-r--r--   1 root     root        97280 Nov  7 10:59 kernel/x86/microcode/GenuineIntel.bin
192 blocks

Also the 4.8.6 initrd (link) isn't that different compared to the 4.10.10 one.

Another thing I've tried is to use the Fedora 26 Alpha .iso (since it worked for @ezdora), but the Live USB isn't even booting. It's just the same as if I would try to boot Fedora 25 with an updated kernel.

So, after all, I will run Fedora in a virtual machine now (as a provisional solution).
But thank you anyway for all the effort you made! I really appreciate that. Have a nice day!

@fannullone

This comment has been minimized.

fannullone commented May 7, 2017

Sorry, I still don't get it, it seems to me a 'chicken and egg problem':
If I boot with Fedora25 and the keyboard/touchpad/touchbar is not working how can I possibly modify the initramfs as described in the 'keyboard/touchpad/touchbar' section?
I don't even think I can perform what described in the 'keyboard/thouchpad/touchbar' section remotely because by default ssh is disabled and of course I can not enable it without keyboard.....

@ManWithCamera

This comment has been minimized.

ManWithCamera commented May 8, 2017

@fannullone, a USB keyboard should work just fine.

I haven't been able to get the internal keyboard/touchpad to work, but it seems that I am the exception.

I wonder if this has anything to do with it:
When patching the DSDT, I do not see this line

DefinitionBlock ("", "DSDT", 2, "APPLE ", "MacBookP", 0x00150001)

which is supposed to be changed to:

DefinitionBlock ("", "DSDT", 2, "APPLE ", "MacBookP", 0x00150002)

Instead, I have this:

DefinitionBlock ("dsdt.aml", "DSDT", 3, "APPLE ", "MacBookP", 0x00130001)

I don't understand what this change is meant to accomplish, so I'm not sure if I should mess with it or not.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented May 10, 2017

@fannullone As @ManWithCamera says, plug in a usb keyboard.

@ManWithCamera I guess you have a different model than I do, but that's ok: the point of this part of the patch is just to bump the version of the dsdt (otherwise it won't override the existing one, so if you left this as is that would explain why your new dstd isn't being used and your keyboard isn't working); i.e. change the 0x00130001 to 0x00130002.

@cworth

This comment has been minimized.

cworth commented May 26, 2017

@roadrunner2 thank you so much for this work. Great.

I have a Macbook 13,3 and I had to remove the the first section covering 13,1 and 13,2 Macs from the patch in order for the hwdb to compile successfully (and thus the patch to work). Helped to read up on evdev and learn the command for triggering a manual hwdb recompile but not sure if that was necessary. I am running Debian Testing and haven't been able to get the amdgpu Pro driver to compile due to changes from the Stable distribution I think, but Xorg is running fine with the ati module and Debian's amdgpu kernel module (except for screen dimming, and the dpi was way off (96). startx -- -dpi 150 seems to make things about the right size.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented May 28, 2017

@cworth Thanks for the report on the hwdb - looks like I was missing an empty line there - sorry about. Fixed now.

I have not tried the amdgpu-pro driver, only the admgpu one in kernel 4.10 - I didn't need change the dpi when using that (though I did change the screen-resolution in gnome's display settings to get things a bit larger).

Lastly, I presume you followed the instructions in the "Screen Brightness Control" section above? And it still doesn't work? Did you verify the modified apple-gmux module is being used? (e.g. check the filename in sudo modinfo apple-gmux, and try explicitly loading your patched apple-gmux with sudo rmmod apple-gmux; sudo insmod ...../apple-gmux.ko).

@cworth

This comment has been minimized.

cworth commented Jun 4, 2017

@roadrunner2 good to know empty line fixes the patch. Just had success adjusting the backlight for apple-gmux. And now, the touchbar buttons work too. I had to reinstall at least once so maybe that fixed it.

@dfb8085

This comment has been minimized.

dfb8085 commented Jun 14, 2017

First I apologize if this is the wrong place but I know nothing about Linux and these commands are greek to me. I have a MacBook Pro 2016 13,2 and I just want to get 16.04 installed with keyboard and touchpad drivers. Can anyone give me step by step instructions on what to do and get it be loaded on a usb stick prior to booting up linux so it will be ready. Thanks in advance

@kjano

This comment has been minimized.

kjano commented Jun 14, 2017

I am still trying to get the brightness working on my MacBook Pro 14 with Ubuntu 17.04 and Kernel 4.11.4 [Update: wget did the trick; works now]. In case you have trouble selecting a working usb wifi adapter: TEW-649UB did the trick for me; see also https://github.com/pvaret/rtl8192cu-fixes . @roadrunner2, in case you would like to update your text nosid seems no longer required from kernel 4.10 on (correct?).

"The touchbar driver is called appletb. It provides basic functionality, enabling the touchbar and switching between modes based on the FN key. Furthermore the touchbar is automatically switched off if no (internal) keyboard, touchpad, or touchbar input is received for 60 seconds; any (internal) keyboard or touchpad input switches it back on." Unfortunately my touchbar stays on, any idea why?

Thanks a lot to all of you and especially to @roadrunner2 and @Dunedan. Audio seems to be the last big issue (for me). Dual screen (USB-C to HDMI) works great.

@kjano

This comment has been minimized.

kjano commented Jun 14, 2017

@dfb8085, what I did was to download the Ubuntu 17.04 ISO (16.04 will work the same way), then use isorespin.sh to change the kernel to 4.11.4 (the command will be isorespin.sh -i [your iso] -k v4.11.4), and finally use unetbootin (available for Linux and Mac) to create a LiveUSB. Next, you have to boot using Mac's option key and then follow @roadrunner2 instructions.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jun 15, 2017

@kjano Thanks for the pointer about intremap=nosid not needed anymore - verified that indeed 4.10 and 4.11 boot fine without it, and updated the doc.

Regarding the touchbar timeout, sorry, that info was a bit out of date - I've updated the README now.

Lastly, since you say you have a new MBP14,* model, could you possibly verify the touchpad has the same ranges as the corresponding 13,* model? To do that please get the latest drivers from repo, add CFLAGS_MODULE=-DDEBUG_TOUCHPAD_RANGES to the make modules command, and rebuild and reload the applespi driver; then move your finger to all edges of the touchpad and you should see the ranges being reported in dmesg; finally if you could report the largest (last) range printed here, I can make any necessary adjustments and send a pull request. TIA.

@chisNaN

This comment has been minimized.

chisNaN commented Jun 29, 2017

Hello @roadrunner2 and @kjano (for ubuntu help and i did not know one could give kernel arg version to isorespin)

I am using ubuntu 17.04 on kernel 4.11.7 now

I am trying the "Keyboard/Touchpad/Touchbar" section

I have done all steps including "add the modules (listed in keyboard.conf) to /etc/initramfs-tools/modules"
and adding the flag CFLAGS_MODULE=-DDEBUG_TOUCHPAD_RANGES

except:

  • installing kernel-devel (because i did not find equivalent on debian)
    and
    sudo mv /boot/initramfs-uname -r.img{,.orig}
    because on my os there is only
    /boot/initrd.img-4.11.7-041107-generic

and i don't really understand how to modify this command only by switching to correct filename because i am used to mv command has a second destination argument. (Thats what i did till now)

Furthermore instead of sudo dracut, i cd into /boot and executed

sudo mkinitramfs -o initramfs-$(uname -r)

which wrote me this file: initramfs-4.11.7-041107-generic
instead of an initrd file (is that ok? by just changing the filename i dont know if th os will recognize this)

Also i would like to notice that after executing the command:

sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi appletb

my touchpad and keyboard still does not work (normal demeanor?)

Now i have maybe a good news concerning the wifi chipset linked to the 2017 macbook 12 version:
I am connected since ~50 min now and the ping are not so high around 30 but sometimes more and yet no disconnection tough i have a very poor internet access here (and generally use my 4g smartphone to download big files)

Thanks in advance for your help and contrib

@chisNaN

This comment has been minimized.

chisNaN commented Jun 29, 2017

eventually KEYBOARD & TRACKPAD WORKS for my config (i have spañish keyboard and it's seems ok for special chars)
so instead of sudo dracut i did:

cd /boot
sudo mv /boot/initrd.img-uname -r{,.orig}
(don't forget the special quote in above command)
sudo mkinitramfs -o initrd.img-$(uname -r)
sudo reboot

and i could login with the keyboard and use trackpad also)))

Screen brightness control works out of the box also on that model

BUT my windows bootcamp partition does not work anymore(((
i use refind
Blinitializelibrary failed 0xc00000bb

@chisNaN

This comment has been minimized.

chisNaN commented Jun 29, 2017

For ubuntu users reading the thread i made a "for NOOB tuto" here

@dfb8085

This comment has been minimized.

dfb8085 commented Jul 8, 2017

The Keyboard and mouse were working good till reboot. I am running a persistent USB and I went through the steps above and all was well till I rebooted the next time and all my work has disappeared. Now that I have to start over is there a way for me to save this to my persistent USB so that it will stay till the 4.11 comes packaged with ubuntu. MacBook Pro 13,2

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 9, 2017

@dfb8085 Sorry to hear you lost your changes. The tutorial above assumes you're installing Linux on the disk. You can certainly modify the USB instead, but the details of that depend very much on the distro you're using: basically you'll need to find the corresponding places on your USB disk where the kernel, ramdisk, modules, etc are stored, and update those locations instead of the regular ones.

I don't know the Ubuntu Install/Live disk layout, so I'm not sure I help you with concrete instructions. You say have a "persistent USB" - does that mean you made it persistent as decribed in these instructions? Or are you using http://www.linuxliveusb.com/? If the latter, then the FAQ there indicates that doesn't work for system updates, so you probably need to modify the base system it's based on.

E.g. looking at the Fedora Live USB I have, I see that the booted kernel image and ramdisk are in images/pxeboot/, so you'd want to update the ramdisk there; the full root filesystem is found at LiveOS/rootfs.img inside LiveOS/squashfs.img, so you'd need to ensure that is mounted and your modifications are made to that. The details for Ubuntu will be different, of course.

@drewjohnson2

This comment has been minimized.

drewjohnson2 commented Jul 25, 2017

@roadrunner2 Are you aware if the 4.12 kernel will fix any of these issues?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 25, 2017

@drewjohnson2 AFAIK 4.12 does not contain anything particularly relevant to this. There are some Thunderbolt and USB-C improvements, but I'm not sure that they do much for us here.

@dylanprins

This comment has been minimized.

dylanprins commented Aug 1, 2017

"it stops working after 10 or 15 or so minutes; turning WiFi off, waiting a several minutes, and then turning it back on generally gets it working again. Maybe a thermal issue?"

Could this be harmfull for my MacBook?

@dylanprins

This comment has been minimized.

dylanprins commented Aug 1, 2017

And what do they mean with: " uname -r "

I mean i suppose that i have to fill in my username, but what do i have to do with "-r"

@dylanprins

This comment has been minimized.

dylanprins commented Aug 1, 2017

@chisNaN please read my comments

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 1, 2017

@dylanprins

Could this be harmfull for my MacBook?

Not sure; but so far I haven't noticed anything.

And what do they mean with: `uname -r`

That's a command that returns the version (release) of the currently running kernel (see man uname) - the backticks (`) cause the relevant part to be replaced with the output of the command. In short, you should type those commands in exactly as shown - don't replace anything. The only places where you need to manually replace something in the commands above is when I wrote something in <>'s (e.g. <kernel-version>).

@dylanprins

This comment has been minimized.

dylanprins commented Aug 1, 2017

@roadrunner2

Alright, thank you, Yeah I'm a complete noob with linux, so even installing a simple driver is a pain in the ass for me. I see that quite a lot of people are struggling with the problem that the bootcamp (Windows) partition won't work anymore, this is what i did to make it al work, first install Windows through bootcamp, but make the partition bigger (the size you want for windows + the size you want for Linux)

Then shrink the volume in Windows with the disk manager

And install Linux on that partition with your bootable USB.

Then just use rEFInd as bootmngr. In this way they don't "fight" with eachother.

@peterychuang

This comment has been minimized.

peterychuang commented Aug 1, 2017

@roadrunner2

I know this probably doesn't affect your machine, but I'm wondering if you may have any thoughts on the problem with the NVMe at boot time (from this comment and downward).

And thanks for the fix of the touchpad init, I'm using it on linux-next right now, and I'll let you know if I find any problems.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 2, 2017

@peterychuang I've seen that thread, but no, don't really have anything to add, except for a question which I'll post there.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 2, 2017

@dylanprins Thanks for that info - I'm sure other readers will find it useful.

@dylanprins

This comment has been minimized.

dylanprins commented Aug 3, 2017

Guess i was wrong.. Windows can't boot anymore, i have the same error as @chisNaN

"Blinitializelibrary failed 0xc00000bb" in rEFInd

Is there somebody who got a working triple boot MacBook pro 2017?

@fleskesvor

This comment has been minimized.

fleskesvor commented Aug 7, 2017

Maybe it's obvious but where should one put the boot loader when installing Linux on a new partition created from within MacOS?

I have a MacBook Pro 2016 model 15'' and I've tried to install KDE Neon with the 4.13-rc3 kernel and Kubuntu with 4.11.4, upgraded using isorespin.

With KDE Neon, I'm getting an error from ubiquity at the end of the install saying it was unable to create a boot loader. I tried placing it on the same partition as KDE Neon, on a separate small parition formatted as both efi and fat32 and even on the same partition as MacOS, but no dice. Starting ubiquity from a terminal and setting the -b option to skip that step, I can successfully install KDE Neon, but of course KDE Neon is nowhere to be seen when I boot the computer. I have rEFInd installed, so maybe I need to configure it to find the install somehow?

With Kubuntu, I didn't encounter any errors during the install, selecting the same partition for both Kubuntu and the boot loader, but after install I only got a black screen and was unable to boot into anything but the MacOS recovery partition (holding Command+R while booting the computer).

Neither live USB was able to boot into Linux without setting intremap=nosid, in spite of both having kernels > 4.10, and I had to attach an external keyboard and mouse to be able to do anything.

I'm definitely doing something wrong, but I don't understand what.

@cstockton

This comment has been minimized.

cstockton commented Aug 8, 2017

@fleskesvor I just installed gnome on my macbook pro 2016 and had the same issue when I first started, if you are still stuck I can post the steps I took to install it. I took a bit different of an approach than what I've seen here or here I think it's a bit simpler and can post them if you want.

@jbadomics

This comment has been minimized.

jbadomics commented Aug 9, 2017

@roadrunner2 With my new MacBookPro14,2, the Ubuntu 16.04.3 installer is not recognizing my hard drive at all, even though I have a nice, empty FAT32-formatted partition ready for it. The USB stick with the installer is mounting as dev/sda, and neither gparted nor fdisk -l recognizes anything about the hard disk, not even the (unreadable) macOS partition. There is no /dev/sdb. Something to do with Apple's new FS? There is space available to the installer - I just can't get the installer to see it.

@cstockton

This comment has been minimized.

cstockton commented Aug 10, 2017

I've gotten ubuntu 17.10 and built the latest 4.13 kern, everything is stable currently but I can't get the amdgpu to power my 4k external display (LG31MU97) using a display port adapter (Starfield tech usbc -> dp).

It seems amds primary activity has been in the 4.12 kernel, I was able to boot into it but I think I may be missing some CONFIG_* options because it made no difference- though the drm is no longer spamming "clock recovery failed." errors it still doesn't power up the 4k monitor. Xrandr detects the resolution and mode, but fetching the edid data for my second monitor shows "too many extension blocks".

I'll pickup some new cables and see if that helps, if anyone has found a specific adapter that works I would love to know what kind. Thanks!

edit: I was able to get the 4k monitor running 4096x2160@60hz even though my monitor complains about the cable. All kinds of errors in dmesg about related to atomic access & buffers.. but it does work at least. I imagine it will be a while before this branch makes it to any stable ppa's, but if anyone knows a maintained one building these let me know.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 11, 2017

@fleskesvor Since these machines are EFI based, the bootloader does not get installed into a partition (or MBR) like for BIOS based ones. Instead, your distros installer should automatically be creating a top-level directory called EFI (exactly like that) on one of the partitions, and placing the appropriate grub files there (usually in an appropriately named subdirectory) - the EFI firmware will look for that directory on all partitions. You don't need to install rEFInd or other EFI boot manager, unless you really want to - Apple's boot manager works just fine (hold down the alt/option key after powering on to get the list of bootable OS's).

As I said, the EFI directory can be on any partition, as long as it's a top-level directory there. Here are two specific (working) examples of layouts:

/dev/sda3 mounted on /boot

/boot
|-- EFI
|   |-- dist1
|   |   |-- grub.efi
|   |   |-- grub.cfg
|   |   |-- ...
|-- vmlinuz
|-- ...
/dev/nvme0n1p5 on /boot
/dev/nmve0n1p4 on /boot/efi

/boot/efi/EFI
          |-- fedora
          |   |-- grubx64.efi
          |   |-- grub.cfg
          |   |-- ...

I'm not familiar with KDE Neon, ubiquity, or Kubuntu, so I can't comment on the specifics of those. But they should recognize this is an EFI machine and do the right thing.

Needing an external USB keyboard and mouse is expected, until you build the applespi driver and load it.

Lastly, regarding still needing intremap=nosid: that's interesting, not sure what's going on there - maybe something special about the kernel used on the Live USB (we've similarly seen issues with Fedora's Live kernel (#23) which appears unable to boot properly (no display), despite everything booting fine once installed).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 11, 2017

@jbadomics There's an issue with recognizing the nvme device on the 13-inch MBP models - see the section "Booting" above. However, Ubuntu 16.04.03 uses an old kernel, IIRC, 4.4, so I think you'll have a bunch of issues with that. At the very least I recommend installing the hardware-enablement stack; better is probably to install 17.04, though.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 11, 2017

@cstockton Thanks for the info! I have yet to experiment with USB-C->DP adapter - I did try USB-C->HDMI but had no luck, though I didn't spend much effort on it.

@fleskesvor

This comment has been minimized.

fleskesvor commented Aug 13, 2017

@cstockton: Thanks for the offer. :) I would definitely appreciate simpler steps to get this working.

@roadrunner2: It seems rEFInd was wiped when I had to use the recovery partition, but holding down Alt works nicely for getting the option to boot my live USB, so I'm fine with that.

I'm not sure how to relate the layouts you drew to what I'm seing when I select the manual install option:

Device               Type  Size           Used
|-/dev/nvme0n1
|--/dev/nvme0n1p1    efi     314 MB       unknown
|--/dev/nvme0n1p2            196687 MB    unknown
|--/dev/nvme0n1p3            650 MB       unknown
|--/dev/nvme0n1p4    efi     3141 MB      unknown
|--free space                134 MB
|--/dev/nvme0n1p5    ext4    299215 MB    unknown
|--free space                134 MB
|-/dev/sda
|--free space                0 MB
|--/dev/sda1         efi     209 MB       209 MB
|--free space                1 MB
|--/dev/sda2         fat32   15789 MB     1940 MB
|--free space                0 MB

The /dev/nvme0n1p5 is the partition I want Linux on. The /dev/nvme0n1p4 is something I messed around with when I couldn't get things to work, and it turned out bigger than intended because the macOS disk utility was fighting me on the size.

The menu for the boot loader wants me to install that on either /dev/nvme0n1, /dev/nvme0n1p1, /dev/nvme0n4, /dev/nvme0n5, /dev/sda, /dev/sda1 or /dev/sda2.

How are you installing Linux if you're not using a live USB? Or are you using a specific kernel that's different from the ones I've used?

EDIT: Are you saying that instead of formatting my Linux partition as ext4, I should instead format it as efi or boot and install both the OS and boot loader on it? I haven't tried that.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 14, 2017

@fleskesvor I forgot to clarify one thing: if you're using Apple's EFI loader then the partition with the /EFI directory must be formatted as FAT or HFS+; if you use rEFInd then it has drivers for ext2/3/4. So in my first example I have rEFInd and /boot is ext4; in my second example I'm using Apple's EFI loader, and hence p4 is formatted at HFS+ and /boot is separate (again ext4).

Now, for your layout: you probably want to install the bootloader then into nvme0n1p4, since that appears to be an efi partition (presumably FAT), and the main OS on nvme0n1p5 (formatted as ext4 or xfs or whatever you want). With this I assume you're not using whole-disk encryption (well, more precisely whole-partition), since you won't have /boot on a separate partition.

Btw., I told MacOS to leave just one large partition (so there were 4 partitions at that point: the main EFI partition p1, MacOS on p2, recovery on p3, and p4 empty) and then let the Linux installer further split that last partition as desired.

@cstockton

This comment has been minimized.

cstockton commented Aug 16, 2017

@fleskesvor Sure, the main thing I did differently was select a newer distro and fix my boot params & upgrade my kernel / configure my machine before I booted out of the installer. For example I originally chose gnome but switched back to lubuntu over the weekend.. a horizontal panel on a 4k screen that can't be moved by default is unforgivable :)

Typically I install ubuntu server and lubuntu core without all the junk, but ubuntu-server isos are just full of bugs from my experience. The gnome & lubuntu 17.10 images worked fine (few small bugs). This one is what I used: http://cdimage.ubuntu.com/lubuntu/releases/17.10 - here is a gist on the steps. Hope ya get it working!

@stefan-langenmaier

This comment has been minimized.

stefan-langenmaier commented Aug 23, 2017

Hi and thanks for this nice writeup. It helped me a lot so far. At the moment I'm stumped with a problem with the Touchpad. I'm on a MacbookPro14,2, running the latest kernel 4.13.0-rc6 and have installed the spi driver. The keyboard and the touchbar are working fine so I assume I got them installed correctly.

The issue is now that clicking on the touchpad is registered but nothing else. That means for example I cannot move the mouse pointer.
Following is a log with evtest:

Input driver version is 1.0.1
Input device ID: bus 0x1c vendor 0x0 product 0x0 version 0x0
Input device name: "Apple SPI Touchpad"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 325 (BTN_TOOL_FINGER)
    Event code 328 (BTN_TOOL_QUINTTAP)
    Event code 330 (BTN_TOUCH)
    Event code 333 (BTN_TOOL_DOUBLETAP)
    Event code 334 (BTN_TOOL_TRIPLETAP)
    Event code 335 (BTN_TOOL_QUADTAP)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min    -6243
      Max     6749
    Event code 1 (ABS_Y)
      Value      0
      Min     -170
      Max     7685
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        5
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max     2048
    Event code 49 (ABS_MT_TOUCH_MINOR)
      Value      0
      Min        0
      Max     2048
    Event code 50 (ABS_MT_WIDTH_MAJOR)
      Value      0
      Min        0
      Max     2048
    Event code 51 (ABS_MT_WIDTH_MINOR)
      Value      0
      Min        0
      Max     2048
    Event code 52 (ABS_MT_ORIENTATION)
      Value      0
      Min   -16384
      Max    16384
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min    -6243
      Max     6749
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min     -170
      Max     7685
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
Properties:
  Property type 0 (INPUT_PROP_POINTER)
  Property type 2 (INPUT_PROP_BUTTONPAD)
Testing ... (interrupt to exit)
Event: time 1503492996.718334, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503492996.718334, -------------- SYN_REPORT ------------
Event: time 1503492996.879580, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503492996.879580, -------------- SYN_REPORT ------------
Event: time 1503492997.114487, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503492997.114487, -------------- SYN_REPORT ------------
Event: time 1503492997.364271, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503492997.364271, -------------- SYN_REPORT ------------
Event: time 1503492997.501204, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503492997.501204, -------------- SYN_REPORT ------------
Event: time 1503492998.088361, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503492998.088361, -------------- SYN_REPORT ------------
Event: time 1503492998.426289, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503492998.426289, -------------- SYN_REPORT ------------
Event: time 1503492998.611674, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503492998.611674, -------------- SYN_REPORT ------------
Event: time 1503492998.732465, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503492998.732465, -------------- SYN_REPORT ------------
Event: time 1503492999.046810, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503492999.046810, -------------- SYN_REPORT ------------
Event: time 1503493000.287577, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493000.287577, -------------- SYN_REPORT ------------
Event: time 1503493000.497668, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493000.497668, -------------- SYN_REPORT ------------
Event: time 1503493000.634500, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493000.634500, -------------- SYN_REPORT ------------
Event: time 1503493000.827672, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493000.827672, -------------- SYN_REPORT ------------
Event: time 1503493004.382180, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493004.382180, -------------- SYN_REPORT ------------
Event: time 1503493004.559694, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493004.559694, -------------- SYN_REPORT ------------
Event: time 1503493005.024971, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493005.024971, -------------- SYN_REPORT ------------
Event: time 1503493005.218714, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493005.218714, -------------- SYN_REPORT ------------
Event: time 1503493005.404096, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493005.404096, -------------- SYN_REPORT ------------
Event: time 1503493005.468864, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493005.468864, -------------- SYN_REPORT ------------
Event: time 1503493005.702607, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493005.702607, -------------- SYN_REPORT ------------
Event: time 1503493005.864193, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493005.864193, -------------- SYN_REPORT ------------
Event: time 1503493006.169090, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1503493006.169090, -------------- SYN_REPORT ------------
Event: time 1503493006.330299, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1503493006.330299, -------------- SYN_REPORT ------------
@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 28, 2017

@stefan-langenmaier Sorry for the delay. my guess is there was an error initializing the touchpad - this would show up in dmesg - look for messages labelled applespi.

On the plus side I have just pushed an update with a number of fixes, including surrounding initializing the touchpad. I recommend pulling the latest code and try again.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 29, 2017

@stefan-langenmaier Btw., if you could report your success or failure with the latest code, either here or on cb22/macbook12-spi-driver#45, that would be much appreciated.

@stefan-langenmaier

This comment has been minimized.

stefan-langenmaier commented Aug 31, 2017

@roadrunner2 No worries! Your latest changes seem to fix the problem. My touchpad is working fine now.

@dfb8085

This comment has been minimized.

dfb8085 commented Sep 4, 2017

So guys I been toying with this for a while. I have read the instructions and seems like kernel 4.11 is pretty much a must have. When and where can I download a distribution that already includes kernel 4.11 in order to bypass some of the extra hoops that one has to jump through. Thanks

@Michael-Jing

This comment has been minimized.

Michael-Jing commented Sep 5, 2017

I have run ubuntu on MacbookPro for almost two years, And I find a very frustrating problem. From time to time I put the computer aside without connecting the power supply, so power will drain out soon since energy saving on Linux is way much worse than on Mac. And After power drain out, I will not be able to boot into the system any way (it may succeed if I try to boot again and again, hundreds of of times. And sometimes I tried to reset SMC or nvram, the result is even worse, the computer will not find the boot record)

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 7, 2017

@dfb8085 Fedora 26 ships with 4.11, and after getting the latest updates it'll put you on 4.12. However, there are issues trying to boot the live images (see also Dunedan/mbp-2016-linux#25) - it works fine after installing, though. Arch is also on 4.11 or 4.12, I believe. I'm sure there are others too.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 7, 2017

@Michael-Jing I'm sorry, I'm not sure I can help - I have never seen that boot issue, either on my (much) older MBP or the 13,3. But it might help if you can describe the behaviour more accurately. You don't say if you're using Apple's efi manager, or rEFInd, or something else. Do get to the grub prompt (assuming you're using grub)? If so, how far does the boot get? If not, do you get to the efi manager's prompt (hold alt/option after powering on if using Apple's efi manager)?

@dylanprins

This comment has been minimized.

dylanprins commented Sep 7, 2017

@roadrunner2
I have a question, everything works fine, but there is one thing I'm very worried about. The fans of my MacBook Pro14,3 never speed up in Ubuntu, so I mean that they never get to higher speeds when the macbook gets hotter. I can get the fans spinning faster by changing the minimum speed of the two fans by editing the "fan1_min & fan2_min" files in /sys/devices/platform/applesmc.768/... manually.

Is this normal? or does it only change the fan speed when the macbook get really f*cking hot?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 10, 2017

@dylanprins: No, that's not normal: on my system they definitely spin up if, say, I'm compiling the kernel. The spin up isn't very aggressive, though, i.e. it will get noticeably warm before the fans increase their speed, though not excessively so IMO. However, some folks have experienced excessive warming too, and some prefer for the fans to kick in earlier - for both there is macfanctld and mbpfan. See the discussion on Dunedan/mbp-2016-linux#13 - basically my experience seems to align with Dunedan's, but you seem to be seeing some more in line with tudorbarascu's.

@chaosbunker

This comment has been minimized.

chaosbunker commented Sep 11, 2017

Thanks for putting this together @roadrunner2

i have been tinkering with my macbookpro13,3 and the first thing that worked was touchpad and keyboard (i used cb22's master because i followed @Dunedan's instructions

while trying to get the rest working i did dkms remove -m applespi/0.1 --all and reinstalled it from you repo according to your instructions. since then keyboard only works but touchpad doesn't

dmesg | grep applespi says this ...

[    1.570133] applespi: loading out-of-tree module taints kernel.
[    1.570144] applespi: module verification failed: signature and/or required key missing - tainting kernel
[    1.581803] applespi: No spi-master device found for device APP000D - waiting for it to be registered
[    1.581804] applespi: acpi-device probe done: APP000D
[    1.756972] applespi: Got spi-master device for device APP000D
[    1.834514] applespi: modeswitch done.
[    1.834626] applespi: spi-device probe done: spi-APP000D:00
[    1.834635] applespi: Added spi device spi-APP000D:00

i hope this is fixable somehow. i got screen brightness and touchbar working finally and don't really feel like reinstalling :-p

edit:
another thing i just realized that i haven't figured out is that i can't adjust the display proportions at all

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 14, 2017

@chaosbunker That's odd: if touchpad initialization had an error, that would've been logged. What do you see in dmesg when you run the following:

sudo rmmod applespi ; sudo modprobe applespi debug=0x01

Regarding display proportions: I'm running wayland and gnome, and was able to change resolutions (I presume that's what you meant) just fine with the display settings.

@ghosalmartin

This comment has been minimized.

ghosalmartin commented Sep 21, 2017

Am guessing audio still doesn't work?

@kjano

This comment has been minimized.

kjano commented Sep 21, 2017

@ghosalmartin to the best of my knowledge it does not. I also played around with HDAJackRetask but without any success. I am using an usb-c audio adapter but this is far from perfect.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 22, 2017

No, audio via the built-in microphone and speakers does not work; and AFAIK nobody has started looking into it yet, either.

@fannullone

This comment has been minimized.

fannullone commented Sep 22, 2017

I managed to install fedora26 on internal disks and it is booting fine (4.12.13-300.fc26.x86_64).
External USB keyboard and mouse are working fine but now I want to get internal keyboard and touchpad to work as well; so I started the procedure at the top of the blog, but I am stack at the following:
sudo mv ...the-attached-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
I don't understand what is ...the-attached-keyboard.conf...
Kindly advice.....
Thanks!

@fannullone

This comment has been minimized.

fannullone commented Sep 23, 2017

I managed to install fedora26 on internal disks and it is booting fine (4.12.13-300.fc26.x86_64).
External USB keyboard and mouse are working fine but now I want to get internal keyboard and touchpad to work as well; so I started the procedure at the top of the blog, but I am stack at the following:
sudo mv ...the-attached-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
I don't understand what is ...the-attached-keyboard.conf...
Kindly advice.....
Thanks!

@fannullone

This comment has been minimized.

fannullone commented Sep 23, 2017

following my previous post....I don't think I am on the right path:

[root@linux macbook12-spi-driver]# find / -name "*keyboard.conf"
find: ‘/proc/6169’: No such file or directory
find: ‘/run/user/1000/gvfs’: Permission denied
/etc/X11/xorg.conf.d/00-keyboard.conf
[root@linux macbook12-spi-driver]# cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
EndSection
[root@linux macbook12-spi-driver]# ll /etc/dracut.conf.d/
total 0
[root@linux macbook12-spi-driver]# mv /etc/X11/xorg.conf.d/00-keyboard.conf /etc/dracut.conf.d/keyboard.conf
[root@linux macbook12-spi-driver]# dracut
/etc/dracut.conf.d/keyboard.conf: line 3: Section: command not found
/etc/dracut.conf.d/keyboard.conf: line 4: Identifier: command not found
/etc/dracut.conf.d/keyboard.conf: line 5: MatchIsKeyboard: command not found
/etc/dracut.conf.d/keyboard.conf: line 6: Option: command not found
/etc/dracut.conf.d/keyboard.conf: line 7: EndSection: command not found
dracut: Will not override existing initramfs (/boot/initramfs-4.12.13-300.fc26.x86_64.img) without --force

I am stuck on this step:
sudo mv ...the-attached-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
I don't understand what is ...the-attached-keyboard.conf...
Kindly advice.....
Thanks!

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 23, 2017

@fannullone Sorry for the confusion: you need to download the keyboard.conf from this gist - I've updated the instructions to hopefully make this clearer.

@fannullone

This comment has been minimized.

fannullone commented Sep 24, 2017

Bingo!! It is all working like a charm :-) Thanks everybody for this great great blog!!

Now the only one thing missing is audio, I hope soon we could get that as well.
Unfortunately I am not able to help on the development side but I am willing to support with testing..... have MBP 13.3

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Sep 24, 2017

@fannullone Regarding audio, it looks like we're getting bluetooth to work (Dunedan/mbp-2016-linux#29), so as a temporary measure with that you can at least stream audio to a BT speaker.

Btw, how did you install Fedora 26? Were you able to boot the live image? I'm asking because several folks have reported issues trying to boot it at Dunedan/mbp-2016-linux#25.

@fannullone

This comment has been minimized.

fannullone commented Sep 25, 2017

I installed Fedora26 on mbp13.3 following these steps:

  • create an extra partition on internal SSD squeezing macos and create the USB live install media following closely: https://linuxnewbieguide.org/how-to-install-linux-on-a-macintosh-computer/
  • connected an external USB media and mouse and booted from in live install media: keyboard, mouse, video and wired ethernet were all working fine right away
  • installed fedora on internal free partition; I didn't use LVM but standard partition even if I don't think this makes any difference
  • rebooted and it came up fine
  • dnf upgrade and reboot
  • then I followed this blog to enable internal keyboard, mouse and brightness control;
  • rebooted and it is all working like a charm :-)
    To recap the following is working fine:
  • internal keyboard and touchpad
  • touchbar
  • internal screen, screen brightness control and external monitor
  • wireless through an USB wireless adapter, internal wireless is not detecting my home network
    Audio in not working.
    So I think I now have all that I need to start using my mac the way I like it:-)
    Looking forward for audio and internal wireless!
@fannullone

This comment has been minimized.

fannullone commented Sep 28, 2017

WRT to audio:
Jabra Evolve 30MS USB headphone is working splendid: hearphone, mike and controls :-)

@mealissa

This comment has been minimized.

mealissa commented Oct 2, 2017

Hello guys,
I can switch tty when i'm in console mode, but whenver i start X11 i'm no longer able o switch tty.
can you guys try to see if this is just in my case or something wrong with the touchbar module

Thank you all

@fannullone

This comment has been minimized.

fannullone commented Oct 5, 2017

Experts,
I am happily running fedora26 4.12.14-300.fc26.x86_64

I just did a dnf upgrade, but while installing the new kernel I noticed this error:

Running scriptlet: kernel-core-4.13.4-200.fc26.x86_64                                                     67/67 
dracut-install: Failed to find module 'applespi'
dracut: FAILED:  /usr/lib/dracut/dracut-install -D /var/tmp/dracut.FGa1kl/initramfs --kerneldir /lib/modules/4.13.4-200.fc26.x86_64/ -m applespi intel_lpss_pci spi_pxa2xx_platform appletb

Is it possible to make so, that when a new kernel is installed, all the modules from this blob are configured automagically.....

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 8, 2017

@mealissa I'm using Wayland and able to switch vt's without issue, so I think your problem is related to your setup. You can verify the keyboard events for the keys are being generated by running "libinput-debug-events --show-keycodes".

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 8, 2017

@fannullone Good point: I just sent a pull request (cb22/macbook12-spi-driver#47) to fix this; you can also re-fetch my clone to get this. Note that the message will still occur, but the initrd will get built a second time after the driver is built, this time including the driver.

@iTechCydia

This comment has been minimized.

iTechCydia commented Oct 8, 2017

Hi, I followed all steps for trackpad/keyboard/touch bar but I only get the Touch Bar to work. I'm on MacBook Pro 14,2 (French keyboard). Btw brightness control works fine out of the box. I'm using Kali Linux (based on Debian)

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 9, 2017

@iTechCydia: Are the modules spi_pxa2xx_platform and intel_lpss_pci loaded? (if your kernel doesn't have them, you'll need to rebuild your kernel with a config containing CONFIG_SPI_PXA2XX=m and CONFIG_MFD_INTEL_LPSS_PCI=m).

If the modules are loaded and it's still not working, can you do the following and provide the output:

sudo rmmod applespi ; sudo modprobe applespi debug=0x51 dyndbg=+p
dmesg | grep apple
@kiwigander

This comment has been minimized.

kiwigander commented Oct 10, 2017

Hi all,
Thank you +++ to roadrunner2 for this gist and to all commenters.
I can't pretend to be a complete n00b as I've been using Linux as my main working OS for almost 15 years, the last 6 or so on Macs. But I'm no computer professional and know just enough to get into more trouble than the average person.
I'm trying to get SWMBO's new MacBook Pro 14,2 set up and have got a working keyboard, touchpad and F-key-touchbar thanks to instructions given above. It's running Ubuntu 17.04 Mint with kernel 4.14.0_rc3 via isorespin.sh (ta, Linuxium). Boot manager is rEFInd.
She'll need to be able to use an external monitor but that remains to be tested.
RIght now the main frustration is wi-fi, which is unusable. The network SSID is recognised, I enter the network password, but after a minute of wheelspinning, I get asked for the password again, and again. . . The modules brcmfmac, brcmutil and cfg80211 are installed and the 43602 firmware is in the firmware folder.
It looks as if one USB-C port is going to have to be wasted on a Wi-fi dongle.
Is there any alternative driving method for the 43602, e.g. one of the older drivers or something with ndiswrapper?

@mealissa

This comment has been minimized.

mealissa commented Oct 10, 2017

@roadrunner2, firstly thanks for your answer. I cheked, everything seems to be fine, i can switch tty using external keyboard but not macbook one.
doing this "xmodmap -e 'keycode 68= XF86Switch_VT_2'" and pressing F2 from mac keyboard allow me to switch to tty2
but xmodmap -e 'keycode 68= F2 F2 F2 F2 F2 F2 XF86Switch_VT_2' only works from external keyboard.
really weird !
the point here is if i use "xmodmap -e 'keycode 68= XF86Switch_VT_2'" i can switch tty by pressing F2, but i want use ctrl+alt+f2 instead.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 11, 2017

@kiwigander: I'm sorry, but I'm not aware of any workaround for the wifi, other than the usb dongle. Feel free to add your voice to the kernel bug, though 😉.

I'd be interested in hearing your experience with the external monitor (is it DMPI, DP, etc, and how well it works).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 11, 2017

@mealissa: I presume running the libinput-debug-events command I mentioned indicates all 3 keys being sent when you type ctrl+alt+f2 on the keyboard? Are you also pressing fn, or are you running the touchbar with mode 0 or 2?

@kiwigander

This comment has been minimized.

kiwigander commented Oct 12, 2017

@roadrunner2: Ta, SWMBO has announced that she doesn't consider the wifi to be a major, as she's happy to carry a wifi dongle (and a USB-A to USB-C adapter). WRT the kernel bug, is there a page somewhere on "Filing a Kernel Bug for Idiots"? It would be very helpful.
Trying the external monitor proved - interesting. Sorry for the lengthy description to follow: brevity is not my strong suit.
TL-DR: External ASUS PB27UQ connected via USB-C=>Display Port works fine, with a catch.

The monitor works great with my late 2014 MBP and her late 2011? MBA.
Now recall that I'm using rEFInd to manage booting on the new MBP 14,2. After installing Ubuntu as I described above, I've got two options for booting it: ("right": boot\vmlinuz-4.10.0-35-generic.efi.signed from 91GiB ext4 volume [that's my root partition IIRC], and "left": EFI\ubuntu\grubx64.efi from EFI).
Prior to testing the external monitor I had settled on the right option as the left would stall for quite a while at Failed to find handle for ACPI object _SB.PCIO.0000 (and .0001 and .0002).
When I connected the external monitor via a USB-C to Display Port cable, the right Ubuntu boot option started OK, but after a couple dozen lines of startup messages, the screen suddenly changed to uninterpretable snow. The snow did change a bit, as if the video system had gone nuts but things were still happening, but it wouldn't settle into anything readable or usable within 10 minutes.
I disconnected the external monitor and rebooted - and the same fault persisted.
I tried rebooting into the left option, which did stall for the usual delay at the usual point, but once it completed, it drove the external monitor just fine.
The right option still goes nuts, so I assume somehow something got corrupted. I'll probably try a reinstallation - perhaps with Mint rather than Ubuntu (as Ubuntu Mate is a bit odd looking after working for years with Mint Mate).
The alternative is to leave SWMBO working in macOS and monitor progress in getting all the MBP gadgetry working in Linux. That's what I did myself originally in 2011 with the MBP when the then-current Ubuntu wouldn't give acceptable video resolution. Her major apps, besides the usual mail and browser, are Scribus, the GIMP, LibreOffice and Moneydance, all available for macOS.

If information from any log file would be useful, please give me detailed instructions.

@mealissa

This comment has been minimized.

mealissa commented Oct 13, 2017

@roadrunner2: with mode 2.

here is the output of xev:

`KeyPress event, serial 34, synthetic NO, window 0x1800001,
root 0x4a6, subw 0x0, time 16269402, (569,956), root:(569,956),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 34, synthetic NO, window 0x1800001,
root 0x4a6, subw 0x0, time 16269612, (569,956), root:(569,956),
state 0x4, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

MappingNotify event, serial 34, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248

KeyRelease event, serial 35, synthetic NO, window 0x1800001,
root 0x4a6, subw 0x0, time 16270003, (569,956), root:(569,956),
state 0xc, keycode 67 (keysym 0x1008fe01, XF86Switch_VT_1), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
`

you can see XF86Switch_VT_1 but just nothing happen!!
if i use external keyboard the line starting with "MappingNotify event... " won't show up.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 13, 2017

@kiwigander Thanks for the info. Interesting about the two options: I guess the "right" one is booting directly into linux (i.e. without a bootloader, which is possible only on (U)EFI machines), rather than starting grub like the "left" option does. I see the "right" kernel is 4.10 - is the "left" one (via grub) also 4.10? In any case, it might help to try a newer kernel (Ubuntu 17.10 appears to have 4.13 - try taking one from there). What those 000[012] ACPI objects are, I have no idea though - don't see any such ones in the 13,* dsdt's nor in 14,1 (don't have one from 14,2). But that may not be the cause of the delay: check the dmesg output and see what's going on before and after the delay.

Regarding the wifi bug, see the section above on Wi-Fi - the link is there.

@fannullone

This comment has been minimized.

fannullone commented Oct 15, 2017

External monitor on my setup: Fedora26 on mbp13.3 works perfect. Can also rotate the external screen.

@kiwigander

This comment has been minimized.

kiwigander commented Oct 16, 2017

@roadrunner2 Sorry for the delay. Thank you for pointing out what I should have seen - the "right" kernel was 4.10. Yet I had respun the installation .iso with a 4.14.0rc3 kernel. At this point I'm admitting defeat, at least temporarily, and SWMBO will try out macOS once I get her data across from her current machine. I reckon that either Ubuntu 18.04 (which I assume will be an LTS version) or the first Mint to be based on it may offer an easier path back to Linux.
For what it's worth, although USB-C to DisplayPort worked for one external monitor, USB-C to Thunderbolt 2 to Mini-DP did not work for a similar (ASUS PB279Q) monitor.

@Johnnie390

This comment has been minimized.

Johnnie390 commented Oct 17, 2017

Hello all,

an interesting and helpful topic this.

I am currently struggling with the following problem(s).

I would like to put Debian Buster as a dual boot option on a macbook pro (14.3 mid 2017, 15 inch 2.9 GHZ). Currently Debian has the 4.12 kernel as default.
Debian installs cleanly, but I cannot get Debian to boot without using nomodeset in the grub boot screen. If I DO NOT use nomodeset, I get the following (consistent) error messages -
... AE_NOT_FOUND (..../psparse-...) ACPI Error: Method parse/execution failed (_PR.CPU4._PDC)
.
.
.
Repeated many times for CPU0-7.

That's it, boot process hangs. See attached photo.

Obviously with the nomodeset setting, I have problems with various things that I would rather avoid...

Has anyone encountered something similiar and found a solution/workaround??

Any tips and/or pointers much appreciated.

Johnnie
proshot_2017_10_15_10_02_51

@nathanielsimonsen

This comment has been minimized.

nathanielsimonsen commented Oct 18, 2017

@roadrunner2 what are the two sound cards called?

@Johnnie390

This comment has been minimized.

Johnnie390 commented Oct 19, 2017

No takers? Nobody else experiencing these problems??

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 20, 2017

@Johnnie390 Those parse errors are normal - I get them too, as well as the failed-to-find-handle and the bcm invalid-platform-data. So those aren't your issue. Can you confirm that the amdgpu driver is the one being used if boot with nomodeset? And what kernel config do you have related to that driver? (grep AMDGPU /boot/config-...).

In short, though, I've not heard of anybody having this issue.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 20, 2017

@nathanielsimonsen Not sure what exactly you're looking for but they show up as card0 and card1 under /proc/asound/. However, I just realized that the card1 directory is empty, so it looks like really only one sound card (/sys/class/sound/ also just shows one card).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Oct 20, 2017

@mealissa Have you tried setting the touchbar mode to 0 or 2? (echo 2 | sudo tee /sys/class/input/input1234/device/fnmode) When doing so, does the MappingNotify event still show up? (Basically I'm wondering if pressing the FN-key is causing issues).

@nathanielsimonsen

This comment has been minimized.

nathanielsimonsen commented Oct 21, 2017

@roadrunner2 I have to use a script on my system (Acer c720) to get linux to recognize my sound card. By default, alsa sees card0 on my system, which is the HDMI port, and enables it as default. The work around is to set card1, which is the PCH device, to the default card. the file goes in /etc/asound.conf

pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 1
}

Again, this is for my chromebook, so I don't know if it will work in your case or even if you've already tried something like this. Also, this issue looks more like it's a hardware problem than software, so I really don't know if this is useful at all. Anyways, I found out how to do this here:
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Set_the_default_sound_card

@rezwits

This comment has been minimized.

rezwits commented Oct 25, 2017

I did a full install on my new MacBook 2017 12":

MacOS High Sierra (update)
Bootcamp Windows 10, shrink volume
reFind (with apfs.efi in drivers x64)
Ubuntu 17.10, added drivers

Everything was smooth until:
Blinitializelibrary failed 0xc00000bb

So I did some reading, and came across the fix, I guess for me at least, I am satisfied.
I came across the fix in a funny way. I was ready to scrap the whole thing for the 2nd time and I said well I'll try to modify the partition map. The reason it's funny is because in life you are told:

Don't Quit, Don't Give up, and If something is broke you don't break it more cause that's not gonna do anything.

Well I was like I quit, I give up, I am just going to "trash" what I have and if it works well then it works. This works:

Open a terminal and start sudo gdisk /dev/nvme0n1 (if it’s not installed, reboot into Linux, try again or install with sudo apt-get install gdisk)
Type p to view the partition table to verify you’re working on the correct disk. If not, type q to quit without saving your changes and try again with another device.
Type x to enter the experts’ menu.
Type n to create an empty protective MBR. Note that gdisk won’t confirm a change; it’ll just show you a new experts’ prompt.
Type w to save your changes. You’ll be asked to confirm this action. Do so.
Reboot into Linux (if not done already)

semi-source: https://www.innoq.com/en/blog/triple-booting-a-mac/

Laters...

@mealissa

This comment has been minimized.

mealissa commented Oct 30, 2017

@roadrunner2 i tried both with 1 and 2, the MappingNotisafy is the same "xf86switch_vt_2" but nothing happens

@mealissa

This comment has been minimized.

mealissa commented Oct 30, 2017

@roadrunner2 here is some test i did trying to make it work!
xmodmap -e 'keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2'
ctrl+alt+f2 can't switch to tty2
xmodmap -e 'keycode 68 = F2 XF86Switch_VT_2 F2 F2 F2 F2 F2'
shift+f2 can't switch to tty2
.
.
.
xmodmap -e 'keycode 68 = XF86Switch_VT_2 F2 F2 F2 F2 F2 F2'
f2 can switch to tty2
this is 100% xorg issue! but no idea how to fix it!!

@drocsid

This comment has been minimized.

drocsid commented Nov 3, 2017

Trying this on ArchLinux here. I created a bootable usb drive using the most recent .iso and hit option at boot and see the option to EFI boot. Then I look and see Arch Linux archisso_x86_64 UEFI CD as the first option above UEFI Shell, EFI Default Loader, mac OS....

I think it's kernel 4.13 . But I get a blank screen. Usb is connected via apple usb / VGA adapter. Not sure how to pass kernel params, maybe from the shell?

@kjano

This comment has been minimized.

kjano commented Nov 4, 2017

@nathanielsimonsen, I followed up on your suggestions (thanks for posting) but it did not help. The HDA Intel / Cirrus Logic Generic card is now set as default but other than that the speakers and headphone jack remain dead.

@alexpol123

This comment has been minimized.

alexpol123 commented Nov 6, 2017

Trying to install the keyboard/trackpad drivers with no luck on backbox linux . I get the following output

ackbox@backbox:~/Desktop/macbook12-spi-dri

ver$ sudo dkms install applespi/0.1

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.8.0-58-generic....(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.8.0-58-generic (x86_64)
Consult /var/lib/dkms/applespi/0.1/build/make.log for more information.

This is the output of the log.

backbox@backbox:~/Desktop$ more /var/lib/dkms/applespi/0.1/build/make.log
DKMS make.log for applespi-0.1 for kernel 4.8.0-58-generic (x86_64)
Mon Nov 6 15:44:09 UTC 2017
make -C /lib/modules/4.8.0-58-generic/build M=/var/lib/dkms/applespi/0.1/build modules
make[1]: Entering directory '/usr/src/linux-headers-4.8.0-58-generic'
CC [M] /var/lib/dkms/applespi/0.1/build/applespi.o
/var/lib/dkms/applespi/0.1/build/applespi.c: In function ‘report_tp_state’:
/var/lib/dkms/applespi/0.1/build/applespi.c:911:30: error: invalid initializer
static ktime_t last_print = 0;
^
scripts/Makefile.build:295: recipe for target '/var/lib/dkms/applespi/0.1/build/applespi.o' failed
make[2]: *** [/var/lib/dkms/applespi/0.1/build/applespi.o] Error 1
Makefile:1491: recipe for target 'module/var/lib/dkms/applespi/0.1/build' failed
make[1]: *** [module/var/lib/dkms/applespi/0.1/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.8.0-58-generic'
Makefile:11: recipe for target 'all' failed
make: *** [all] Error 2

Any Ideas would be greatly appreciated

@drocsid

This comment has been minimized.

drocsid commented Nov 7, 2017

As per my comment above, no luck with ArchLinux Kernel 4.13 on my 2016 mbp 15". I don't see any advice regarding kernel parameters for 4.13, but I think I read above some issues regarding the GPU powering off if not booting macOS. Really a hard time starting up last years mac on linux.

@drocsid

This comment has been minimized.

drocsid commented Nov 7, 2017

Tried booting the fedora 27 beta iso image, and again the screen turns off. Then without any kernel parameter suggestions this contradicts the comments above that If you're booting a 4.11 or later kernel, no special params or patches are needed

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Nov 8, 2017

@drocsid You're most likely running into Dunedan/mbp-2016-linux#25 . We still don't know why that happens.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Nov 8, 2017

@alexpol123 Sorry, haven't tested older kernels in a while. You should be able to fix it by simply removing the assignment, so it reads:

        static ktime_t last_print;

I'll test and push a fix in the near future.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Nov 9, 2017

@alexpol123 If you pull the latest from my repo this is now fixed.

@dtl131

This comment has been minimized.

dtl131 commented Nov 11, 2017

@drocsid

This comment has been minimized.

drocsid commented Nov 15, 2017

No luck with the debian daily debian-testing-amd64-netinst.iso but it did show the splash screen. No luck with debian-mac-testing-amd64-netinst.iso not even recognized by the boot selector. Next up Fedora-Workstation-netinst-x86_64-27-1.6.iso

@drocsid

This comment has been minimized.

drocsid commented Nov 16, 2017

No luck with Fedora-Workstation-netinst-x86_64-27-1.6.iso

@alexpol123

This comment has been minimized.

alexpol123 commented Nov 16, 2017

@roadrunner2 Thanks a lot . Really appreciate it. I will try install it as soon as possible

@drocsid

This comment has been minimized.

drocsid commented Nov 16, 2017

Found the issue regarding my installs. Filevault2 disk encryption.

@lppier

This comment has been minimized.

lppier commented Nov 18, 2017

I'm really cheesed off by the non-working wifi on my macbook pro 2016 15". Is there any resolution for this? :(

@drocsid

This comment has been minimized.

drocsid commented Nov 21, 2017

Is anyone booting linux with Filevault2 configured? I installed rEFInd after switching FV2 off. This worked until I re enabled FV2. I'm not sure but I assume FV2 re-installed the bootloader.

@drocsid

This comment has been minimized.

drocsid commented Nov 27, 2017

Described issues using rEFInd with FV2 on this issue: Dunedan/mbp-2016-linux#45

@fannullone

This comment has been minimized.

fannullone commented Dec 1, 2017

I have been happily running fc26 for a few months now, but fc27 is out there....
Anyone already using it who can share any feedback?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Dec 12, 2017

@fannullone I upgraded to FC27 a week or so ago and haven't encountered any (new) issues.

@fannullone

This comment has been minimized.

fannullone commented Dec 24, 2017

Ok, I upgraded my MBP to FC27: the process was very smooth and everything that was working before is still working.
I utter here my new year wishes to get fixes for what is still not working:

  • bult-in audio
  • wifi
  • suspend/hibernate
@coci

This comment has been minimized.

coci commented Dec 24, 2017

i install ubuntu 17.10 on macbook pro 13,1
and when i use this :
sudo dnf install git kernel-devel dkms

terminal get error message 👍
command not found : dnf
what i do ?

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Dec 29, 2017

@coci Ubuntu is based on Debian, and hence uses dpkg+apt, not rpm+dnf. So try this instead:

sudo apt-get install git linux-headers dkms

Ubuntu also used mkinitramfs instead of dracut, so use the instructions for the former.

@l1k

This comment has been minimized.

l1k commented Dec 31, 2017

@roadrunner2

Could you please test if commit l1k/linux@a695fcd allows backlight brightness control to function if

Thanks!

@sciamano89

This comment has been minimized.

sciamano89 commented Jan 6, 2018

@roadrunner2
Hi there! I just got the latest macbook pro with touchbar, installed on a USB stick linux mint (sylvia 18.3), which came with kernel 4.10.xx). I've been using usb keyboard/mouse/ethernet so far to run linux. I then installed Ukuu to upgrade to the latest stable kernel (4.14.12 I believe), and I was able to follow your instructions up until the line sudo dkms install applespi/0.1 (I skipped the 'boot' section since I'm on 4.14). That command gives me an error: something along the lines of 'bad exit: 2'. The Makefile.log gives me an error saying something about "can't set OCR metadata" (line ~948 of the headers Makefile), saying that I should install libelf-dev, libelf-devel, or elfutils-devel. So I ran apt install libelf-dev (and I even installed something like 'elfutils-dev') but I'm still getting the same error. The make command keeps failing there. I've been looking for a solution all morning, but I'm new to linux and makefiles, so I'm not too sure what the issue could be 🤣
Any help or suggestion is greatly appreciated! Thanks

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jan 14, 2018

@sciamano89 Hmm, I'm sorry, but I have no clue where that OCR error is coming from - that error really doesn't make a lot of sense, so I have to assume it's due to some Linux Mint specific dkms issue. Have you checked farther up the log if there were any other errors, and this OCR error is just some weird secondary error?

@fannullone

This comment has been minimized.

fannullone commented Jan 18, 2018

As the built in speakers are not working, I would like to connect my MBP running fedora27 to my stereo system.
Unfortunately I bought this one: https://www.amazon.it/dp/B072P2ZHNB/
But it doesn't work either.
Any advice for an USB-C adapter to connect to the stereo that will work with linux?

@kjano

This comment has been minimized.

kjano commented Jan 19, 2018

@fannullone, I have this one 'BC Master USB-C External Stereo Sound Adapter' and it works out of the box:

@maxwellfortney

This comment has been minimized.

maxwellfortney commented Jan 24, 2018

Do Bluetooth headsets output audio correctly? as a workaround for the no audio.

@dolohow

This comment has been minimized.

dolohow commented Feb 1, 2018

Do Bluetooth headsets output audio correctly? as a workaround for the no audio.

Yes

@fannullone

This comment has been minimized.

fannullone commented Feb 18, 2018

Is it possible to use the middle-button mouse action which on a standard linux PC performs a paste of the current selection?

@cworth

This comment has been minimized.

cworth commented Feb 19, 2018

On my Macbook Pro 13,3, I turned on debug support for SPI drivers in the kernel (drivers->spi->Debug support fro SPI drivers), just assuming this would be a good idea, and the result was GB's of kernel.log files that eventually filled up my hard drive. Just a heads up for others.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Feb 26, 2018

@fannullone Not sure exactly what you're asking for here, but a three-finger click emulates a middle mouse button click on most setups (and a two-finger click emulates a right mouse button click). If it doesn't on your setup, you'll need to play with libinput, your desktop environment, and/or X11.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Feb 26, 2018

@cworth Thanks for the heads-up.

@arno01

This comment has been minimized.

arno01 commented Mar 3, 2018

Here is yet another howto install Ubuntu on MBP 14,3 https://nixaid.com/linux-on-macbookpro/
The difference is that I am showing how to remaster the original Ubuntu LiveUSB so no unnecessary hassle with connecting external keyboard/mouse, nor UNetbootin/rEFInd/recovery mode are needed and giving some insight on efibootmgr so Ubuntu boots as expected right after installation. Neither I have experienced issues with booting as described in https://github.com/chisNaN/ubuntu-on-macbook12

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Mar 4, 2018

@arno01 Thanks for the pointer - added it to the list.

@kjano

This comment has been minimized.

kjano commented Mar 5, 2018

Btw, any updates or ideas how to get audio working?

@dolohow

This comment has been minimized.

dolohow commented Mar 8, 2018

gmux patch does not apply on 4.15.5, due to this commit c71989fe3730b07ddb65841f4d4166db4c83f060

@fannullone

This comment has been minimized.

fannullone commented Mar 15, 2018

I noticed that starting from kernel 4.15.7.300 the apple-gmux module for screen brightness control is already compiled in the kernel :-)
Good stuff!

@Lostish

This comment has been minimized.

Lostish commented Mar 22, 2018

Linux 4.16.0-041600rc6-generic #201803182230 SMP Mon Mar 19 02:32:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

MacBook Pro 14,1

Bluetooth still not working.
[ 20.959981] Bluetooth: hci0: BCM: Reset failed (-110)
[ 22.975929] Bluetooth: hci0: command 0x0c03 tx timeout

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 2, 2018

@dolohow and @fannullone: Thanks for the apple-gmux notes - I've updated the instructions accordingly now.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 2, 2018

@coolguy1004

This comment has been minimized.

coolguy1004 commented Apr 12, 2018

Hi,
First off, thank you very much for writing up the instructions. I've been using fc27 on my 2017 MBP for a while. However, with the latest kernel update 4.15.15-300, it can no longer boot. The usual "rd.break enforcing=0" does not work as well. It just freezed.

I have to boot into 4.15.14-300 as the work-around.
Anyone seen this behavior?
Thank you

@rafael-azevedo

This comment has been minimized.

rafael-azevedo commented Apr 12, 2018

Hello All,

I am on a macbook 14,1 running fc28. My kernel version is kernel-4.16.1-300.fc28.x86_64. I was able to get keyboard to work in the bios and after booting up, but it will not work after going through the bios into the prompt for disk encryption password. Any ideas of what could be the issue here?

@CaninoDev

This comment has been minimized.

CaninoDev commented Apr 14, 2018

May I suggest the following edit:
Under Initial Installation section, reference Andrey Arapov's instructions on remastering the installation image to have built-in support of the keyboard/mouse at the start. It does require a pre-existing installation of linux, however. I used VirtualBox for such a purpose.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 20, 2018

@rafael-azevedo: That usually means the driver (and associated modules) didn't get included in the initrd/ramdisk - double check that the 3 modules (or their compressed forms) applespi.ko, intel-lpss-pci.ko, and spi_=-pxa2xx-platform.ko are present in the initrd (e.g. using something like sudo /usr/lib/dracut/skipcpio /boot/initramfs-4.16.1-300.fc28.x86_64.img | gunzip -c | cpio -t | grep applespi).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Apr 20, 2018

@coolguy1004 I just booted 4.15.16-300.fc27 without issues (sorry, don't have 4.15.15 anymore).

@anayw2001

This comment has been minimized.

anayw2001 commented May 2, 2018

@roadrunner2 has the wifi situation improved on MacBookPro13,3 from kernel upgrades?

@arno01

This comment has been minimized.

@Anthony25

This comment has been minimized.

Anthony25 commented May 21, 2018

Since xorg 1.20, I have some issues with external screens on a macbook 14,3. USB-c outputs are wired with the AMD gpu, but it used to work ootb with xorg 1.19.

I can see the outputs in xrandr if I play with the reverse PRIME, however xorg just crashes when I enable one of the discrete GPU output.

@fannullone

This comment has been minimized.

fannullone commented May 25, 2018

Hello I have upgrade to fc28 and kernel 4.16.11.300; generally speaking it is working fine with the known issues, but the times it takes to shutdown is veeery long in the order of minutes, at the end the shutdown completes correctly.
It hangs for minutes on a black screen with this messages:
failed to find handle for ACPI object _SB.PCI.UA00
failed to find handle for ACPI object _SB.PCI.UA01
Any idea how to improve it?

@cixil

This comment has been minimized.

cixil commented Jun 2, 2018

Thanks for the great instructions!!

I had installed Fedora 28 on a MacBook Pro 14,1 and everything worked out of the box except for keyboard/trackpad.
Followed the Keyboard/Touchpad/Touchbar section and now everything works! (except sound)

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jun 4, 2018

@fannullone I'm sorry, I don't think I can't help with that: the only time I see a hang on shutdown is when I disable the discrete GPU (the amdgpu driver gets in a tizzy then on shutdown); furthermore I don't see any UA* devices in my DSDT, so I don't know what they are.

@goodwin

This comment has been minimized.

goodwin commented Jun 8, 2018

Sorry for offtopic, but is there anybody who can make and share dump from MacBookPro13,3 with DarwinDumper? I'll be reaaally appreciated.

@simons1990

This comment has been minimized.

simons1990 commented Jun 10, 2018

@goodwin if this helps you with any work related to linux compatiblity, sure I can

@Sebastiaan76

This comment has been minimized.

Sebastiaan76 commented Jun 14, 2018

Just wanting to report that I have Fedora 28 working perfectly on my 2017 Macbook Pro 14,1 using the instructions above. Currently on kernel 4.16.14-300.fc28.x86_64. Had a bit of a scare when I upgraded from 4.16.3 as brcmfmac errored and wifi stopped working, but i realised I forgot to dracut --force the new kernel! Did that and all is well.

FWIW, my wifi ( including 5Ghz ) is working. Although the 5Ghz SSID's don't always show up. I haven't had any drop outs, speeds and latency seem OK and many hours connected without issue on the BCM4350. So the comments about wifi being useless aren't true ( for the 14,1 anyway ).

Is there anyone that has gotten sound to work though?? That's really the only thing that is truly broken

@goodwin

This comment has been minimized.

goodwin commented Jun 14, 2018

@simons1990 this is more related to another topic - hackintosh on non-apple hardware. but this may help other community. again. my exuses for offtopic - will try to not spam there anymore. thank you for any help

@rene-dekkers

This comment has been minimized.

rene-dekkers commented Jun 15, 2018

In Ubuntu 18.04 the installer detects HiDPI and automatically sets scale to 200% (in settings -> Devices -> Displays -> Scale). I had to switch it back to 100% to overcome a glibc error in the ubiquity installer.

@coolguy1004

This comment has been minimized.

coolguy1004 commented Jun 28, 2018

@Sebastiaan76: Would you mind telling me how to make wifi work? I'm on 4.17.2-200.fc28.x86_64, and I only see 2.4GHZ. However, I cannot even connect to it using the internal wifi chipset. It keeps prompting for my password.
Thanks.

@wheelcomplex

This comment has been minimized.

wheelcomplex commented Jul 3, 2018

Thanks. For the WiFi: https://bugzilla.kernel.org/show_bug.cgi?id=193121#c43

"sudo iwconfig wlp2s0 txpower 10dBm" works well (2.4G only) with
the original firmware (Ubuntu 18.04 + v4.17 custom build kernel) on MacBook Pro 2018 with touchbar.
@kubanored

This comment has been minimized.

kubanored commented Jul 4, 2018

Has anyone found a solution for audio drivers ? Is the only driver missing with ubuntu 18.04 on MBP 14.3

@coolguy1004

This comment has been minimized.

coolguy1004 commented Jul 5, 2018

@wheelcomplex: Thank you very much. That works even though the signal is weak. But I take that. I modify the ccode=0 and revreg=0 but that did not work.

@coolguy1004

This comment has been minimized.

coolguy1004 commented Jul 5, 2018

@kubannored: I'm using Fedora 28 and audio does not work as well. I currently use the audio port thru my usbc adapter and that works.

@rwuwon

This comment has been minimized.

rwuwon commented Jul 10, 2018

Hey @roadrunner2, there's a broken link above: #61-libinput-local.hwdb should read #file-61-libinput-local-hwdb (i.e., like this).

I'm currently trying to figure out how to tweak the palm detection/rejection so that a light accidental brush on both ends of the 13,1 touchpad won't trigger a scrolling event as it currently does. Or in other words, two fingers very wide apart (~10cm) will trigger scrolling - I'm guessing the larger touchpad in the 13,3 and 14,3 doesn't have this issue?

It also took me a while to realise I needed to dnf search libinput to notice I needed to install libinput-utils so that I could run sudo libinput measure-touch-size /dev/input/event5.

@kjano

This comment has been minimized.

kjano commented Jul 12, 2018

@roadrunner2 I just reinstalled my system with Ubuntu 18.04 and now the touch bar stays on all the time. I remember that this was discussed somewhere before but cannot find it. Somehow the timeout does not get triggered.

@rwuwon I think I simply used syndaemon for that but I cannot get it working right now and only get an 'No synaptics properties on device 'Apple SPI Touchpad'.' error

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 14, 2018

@rwuwon Thanks for the report - the link is fixed now.

Regarding the touchpad, no, I don't see the accidental scrolling issue much, but instead I get lots of spurious mouse clicks (both single and two-finger, i.e. "left" and "right" click). It's very annoying, and I need to sit down and try to debug this and some point (though I keep hoping somebody else will figure this out...).

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 14, 2018

@kjano Can you open an issue over at https://github.com/roadrunner2/macbook12-spi-driver/issues and include the output from dmesg | grep appletb and the kernel version you're running? TIA.

@NordicOhm

This comment has been minimized.

NordicOhm commented Jul 20, 2018

Hi, i am super new to ubuntu (I just installed it today) And i am trying to get everything to work. So far wifi, screen works but Keyboard and touchbar, track pad have no function on them yet. I tried using the "sudo dnf install git kernel-devel dkms" command into my terminal line after going into root, and i get this. sudo: dnf: command not found
Any idea how to get this to work? I tried googling the question but i couldn't find anything useful... thanks in advance.

@zdamc11

This comment has been minimized.

zdamc11 commented Jul 22, 2018

Hi, i am up to the step 'Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the 61-evdev-local.hwdb and 61-libinput-local.hwdb from this gist):" But i am a bit confused as to what to do here, i downloaded the files into a raw text because thats the only way i saw to download them. I then put them into /usr/lib/udev/hwdb.d and re-ran the command but i don't think this is what you are meant to do. forgive me if this sounds like a stupid questions but it is my first time on linux and im just learing the ropes!

@msieprawski

This comment has been minimized.

msieprawski commented Jul 24, 2018

Hi,
Thanks for this great article I was able to set up my base settings on 2016 Macbook Pro. The only problem which I have right now is that system don't want to wake up after putting it into sleep mode. When I'm trying to wake it up using keyboard, mouse and power button it's just ignoring me. I need to hard reset. Any suggestions? Thanks!

@drewjohnson2

This comment has been minimized.

drewjohnson2 commented Jul 26, 2018

@msieprawski If you check out Dunedan's summary of what's working and what's not working right now it currently still has suspend as not working. So Unfortunately before you close the lid now you'll have to power off your device.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 27, 2018

@NordicOhm Ubuntu uses apt, not dnf - see @coci's question and my answer above.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 27, 2018

@zdamc11 Do not put the downloaded files in /usr/lib/... - just copy them to the correct location in /etc/udev/... using the commands I specified.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Jul 27, 2018

@msieprawski As @drewjohnson2 states, suspend is not well supported currently. Some parts work, but others don't. You can get it to wake up again from the keyboard/touchpad by running the following command after boot (and before you suspend the first time):

echo SPIT | sudo tee /proc/acpi/wakeup > /dev/null

And by default it should wake up when up open the lid again (see LID0 in /proc/acpi/wakeup).

But for example the touchbar won't wake up properly, and USB also has issues.

@johnruttenberg

This comment has been minimized.

johnruttenberg commented Jul 30, 2018

I have a new 2018 Macbook pro 15". This doesn't work. It comes up and is not responsive to the keyboard or mouse. The very same disk works on a 2016 model.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 1, 2018

@johnruttenberg Interesting! I've been wondering what all works and has changed on the latest models. For the keyboard/touchpad, could you please open an issue at https://github.com/cb22/macbook12-spi-driver/issues and provide the output from dmesg | grep applespi and lspci -nn? Also, could you pull the latest driver from my repo (https://github.com/roadrunner2/macbook12-spi-driver/)? (it has one change that should make it recognize the touchpad better on new models, though I don't think that's related to your issue here).

@arcticicestudio

This comment has been minimized.

arcticicestudio commented Aug 6, 2018

@roadrunner2 I 'd really like to help. Trying to get Arch Linux up and running on my (job) MacBook Pro 15,1, but unfortunately I've currently no way to do it. Since their greed for money is still not satisfied and they decided to only use these creepy Thunderbolt 3 connections I've got an "Elgato Thunderbolt 3 Dock" which is currently my only way to connect a Arch Linux LiveUSB stick. After disabling Secure Boot, External Boot_ and FileVault I'm able to boot from the stick, but it ends up in an "thunderbolt error: could not start ICM firmware" followed by a "Waiting 30 seconds for device /dev/disk/by-label/ARCH_201808 ..." and a emergency shell prompt. This is caused due to the fact that the USB stick is powered off (maybe the whole dock) some seconds after it boots. Tried to work from the emergency shell, but the keyboard doesn't work at all.

So I tried to get it working the other way around by

  1. creating a new (FAT) partition from within macOS
  2. making an fresh install using arch-chroot and pacstrap from the arch-install-scripts on my main system and package the whole / file-tree into .tar to preserve all permissions and attributes.
  3. formatting the new partition to ext4 from within macOS using mkfs.ext4 from e2fsprogs (Homebrew) with label arch
  4. mounting the partition using fuse-ext2 and extract the whole Arch / file-tree from the .tar archive into it
  5. installing rEFInd from within macOS
  6. mounting the ESP from within macOS (sudo mount -t msdos /dev/disk0s1 ~/Desktop/esp) to create a manual stanza in the refind.conf to match the partition label arch, kernel boot parameter root=LABEL=arch and initramfs-linux.img and vmlinux-linux file paths (/boot prefix)

After restarting the Mac rEFInd shows up the entry and it start booting, but immediately stops with

ERROR: device 'LABEL=arch' not found. Skipping fsck.
ERROR: Unable to find root device 'LABEL=arch'.

There's no way to use the emergency shell because the keyboard doesn't work and using a external (original Apple) USB keyboard either since the only way to connect is the dock and that....is turned off/not recognized (ICM firmware error).

I've installed Arch hundreds of times on many different systems and devices, but actually I'm clueless how to get this working. Maybe getting a simple Thunderbolt 3 to USB adapter might help, but can also end up in the same error as the dock.

@roadrunner2

This comment has been minimized.

Owner

roadrunner2 commented Aug 10, 2018

@arcticicestudio I don't have any really good insights into your problems. But it looks like some of your issues are related to trying to use a dock - I vaguely recall people having issues with docks, so I would definitely recommend getting a basic USB-C-to-USB-A adapter, which seems to work well for everybody. Next, installing rEFInd isn't really necessary IMO, as Apple's boot manager has been working just fine for me and others. As to the keyboard, yes, you'll definitely need a USB keyboard until we get the driver working on MB15,*. Lastly, regarding not finding the root device, maybe the labeling got messed up? Running blkid (once you get the USB adapter and have your USB-keyboard working) in the emergency shell might give you insights.

@ricknox

This comment has been minimized.

ricknox commented Aug 13, 2018

Is there any movement with Suspend and Resume? This prevents me from using Linux right now.

@pmonty

This comment has been minimized.

pmonty commented Aug 14, 2018

The Wifi issue is it fixable by installing these?

sudo dnf install kernel-devel broadcom-wl akmod-wl akmods
sudo akmods

I installed Fedora on my computer recently and had to do that to get my wireless card recognised. Could it be as simple as doing this on MBP 14,3? I am rather new at this so might be way off. Maybe a combination of these commands with one of the current suggested work arounds could improve or enable 5ghz as well? Really hope Wifi fix is done soon so I can move away from OSX.

@drewjohnson2

This comment has been minimized.

drewjohnson2 commented Aug 16, 2018

@ricknox Not yet. It's tricky!

I've just resorted to powering off my device when I'm done. It's really not that big of a setback.

@JacobBrownAustin

This comment has been minimized.

JacobBrownAustin commented Aug 16, 2018

With roadrunner2/macbook12-spi-driver.git , how can I swap my option and command keys so that I get the command key acting like Alt instead of the option key ?

@JacobBrownAustin

This comment has been minimized.