Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu on Apple Macbook Pro 16-inch (2019)

Acknowledgements

This gist is just a compilation of the hard work that others have put in. I'm not a software developer, so if there are any mistakes or better ways of doing things, I'd appreciate any suggestions. Here's a list of the real heroes who made this possible:

Kernel Patches: aunali (https://github.com/aunali1/)

T2 security chip bypass to allow access to the SSD, keyboard, and trackpad: MCMrARM (https://github.com/MCMrARM)

Audio: kevineinarsson (https://github.com/kevineinarsson)

The Arch Linux guide which I basically stole to make this one: TRBP (https://github.com/TRPB)

What doesn't work

Wifi: Catalina is weird, so currently no one has firgured out what it's using to make WiFi work. It's either that or reverse engineer something. As a workaround, I use a USB WiFi adapter (TP-Link N150 USB) that works out of the box with most linux kernels and distros.

Sound via the speakers is a little weird. It technically works, but some apps don't seem to know how to connect. Although if you use the testing feature, you can hear the nice lady saying "Front!" "Left center", etc etc. Youtube in the browser gets sound, but sometimes VLC doesn't. Headphones through the jack or bluetooth audio seems to work OK, although I haven't fully tested out sound.

External GPU's: while other Thunderbolt 3 devices work well, including the OWC thunderbolt 3 dock, external GPU's seem to have some trouble. The eGPU is recognized and authorized, but the drivers don't load, despite what Ubuntu widgets are telling you. Even if you manually install nVidia drivers (sudo apt install nvidia etc), the driver seems to install, but using nvidia-smi complains about no drivers.

GDM3, the standard/usual/normal windows manager for Ubuntu. I'm not sure if it's a true bug or an incompatiblity with Apple's hardware. As a fix, I installed plasma (sddm). Basically you'll need to install kubuntu. Plenty of google help out there on that.

Hardware Prerequisites

You'll need at least the following hardware:

At least enough USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A:

  1. A USB drive with Ubuntu on it
  2. A USB keyboard
  3. A USB Mouse

Optional: USB to Ethernet adapter, compatible USB Wifi or USB tethering on a phone

General notes

I strongly recommend against deleting OSX entirely even if you'll never use it, it is required for locating the WiFi firmware during install and can be valuable for determining which hardware you have.

If you want to triple boot, I'd recommend installing Windows 10 before Linux, via bootcamp. If it isn't obvious, you'll need to create a partition using Disk Utility in MacOS to make room another OS partition. You'll actually want to partition drive and not just add another logical volume. Google it, if you need help with this. It's pretty well documented. NOTE: The following steps will mess up Windows boot (the install is safe). There's a fix for that at the end.

  1. Download Ubuntu 20.04 (focal fossa)

As of this writing, 20.04 is the only Ubuntu version out there that uses kernel 5.4, which is when the linux kernel gained the ability to access the internal Apple NVME SSD.

Download from here: http://www.cdimage.ubuntu.com/daily-live/current/focal-desktop-amd64.iso

  1. Use your favorite program to write the ISO to a USB stick (Balena etcher for Mac, etc).

Installation

You'll need to use a USB keyboard for the installation

Insert the USB stick and boot the laptop holding down the "option" key to seelct the USB for boot (it'll be an orange EFI disk. Choose the far right one, if there are multiple.)

The text will be tiny, but choose the second option (try Ubuntu without installing (Safe graphics).

I don't know what the issue is, but grub and/or Ubuntu really don't like this laptop. Therefore, we're going to install Ubuntu WITHOUT a bootloader. To do this, open up a terminal and type sudo ubiquity -b Proceed to install as normal and make sure you're installing to the empty partition you made and not MacOS or Windows.

On reboot, your laptop should boot directly into MacOS as there's no way to boot into linux at this point. Download REFIND from sourceforge and install it the standard way.

REFIND: https://sourceforge.net/projects/refind/

Installation Instructions: https://www.rodsbooks.com/refind/installing.html

Reboot. You should be able to select Ubuntu now via REFIND. Boot into Ubuntu.

Keyboard/touchpad

  1. Install macbook12-spi-driver-dkms:

You need the MBP15 branch:

https://github.com/roadrunner2/macbook12-spi-driver/tree/mbp15

Download and install according to the directions.

  1. Get MCMrArm's bridge driver and install it:

Note: Since Ubuntu 20.04 is still in developlment, the exact kernel version could change depending on when you downloaded th ISO, you'll need that to know where to copy the driver.

git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git
cd mbp2018-bridge-drv
make
sudo cp bce.ko /usr/lib/modules/[whatever kernel version, eg: linux-5.4.22-18-056000-generic]/kernel/drivers/pci/bce.ko

You'll need to remember to rebuild the module every time you update the kernel), I'm looking for a way to automate this

Have it load on boot: sudo nano /etc/modules Add the following:

bce

Reboot.

The touchbar should light up. You can push the fn key to switch from F1-F12 to the audio/visual controls. The keyboard backlight works intermittently for me and I can't pin down what makes it come alive.

You can now disconnect your external keyboard and use the laptop's touchpad.

The touchpad will only have very basic functionality. We'll need to apply some kernel patches (see below).

WiFi (currently not working. Here for reference if using the 2018 MBP's running Mojave)

Boot into OSX and run the following in terminal: ioreg -l | grep C-4364

It will show something like:


    | |   |         |       "images" = {"C-4364__s-B2/kauai-X3.txcb"={"imagetype"="TxCap","required"=No,"imagename"="C-4364__s-B2/kauai-X3.txcb"},"C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"={"imagetype"="NVRAM","required"=Yes,"imagename"="C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"},"C-4364__s-B2/kauai-X3.clmb"={"imagetype"="Regulatory","required"=Yes,"imagename"="C-4364__s-B2/kauai-X3.clmb"},"C-4364__s-B2/kauai.trx"={"imagetype"="Firmware","required"=Yes,"imagename"="C-4364__s-B2/kauai.trx"}}

It'll be different depending on your exact model.

There are three files to note down. A .trx (for me: C-4364__s-B2/kauai.trx), a .clmb (for me: C-4364__s-B2/kauai-X3.clmb and a .txt (for me: C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt

These refer to files on OSX in /usr/share/firmware/wifi. Copy the trx, clmb and txt somewhere you can easily access them when you boot back into linux (e.g. your home directory if you want to mount the HSF partition in linux, a usb stick, etc)

Boot back into linux and place the files in the following locations:

Copy the trx to /lib/firmware/brcm/brcmfmac4364-pcie.bin (e.g. sudo cp kauai.trx /lib/firmware/brcm/brcmfmac4364-pcie.bin The clmb to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob (e.g. sudo cp kauai-X3.clmb /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob) The txt to something like /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt. You will need to replace 15,1 with your model number. (e.g. sudo cp P-kauai-X3_M-HRPN_V-u__m-7.5.txt /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt) Use networkmanager and iwd:

sudo pacman -S networkmanager iwd sudo systemctl start NetworkManager.service sudo systemctl enable NetworkManager.service If you're on kde also install plasma-nm

Configure networkmanager to use iwd. Create /etc/NetworkManager/NetworkManager.conf and add:

[device] wifi.backend=iwd Restart the NetworkManager service and you should have wifi working.

Touchbar

If you've installed the mbp15 branch of @roadrunner2's spi driver as outlined above you just need to load the modules:

modprobe apple-ib-tb
modprobe apple-ib-als

If you want the touchbar to display F* keys by default, sudo /etc/modprobe.d/apple-tb.conf and add

options apple-ib-tb fnmode=2

Audio

MCMrARM's gist here was the basis: https://gist.github.com/MCMrARM/c357291e4e5c18894bea10665dcebffb

For the MBP 16-inch version: https://gist.github.com/kevineinarsson/8e5e92664f97508277fefef1b8015fba

Download the five files, copy them as instructed, and reboot.

Suspend

As of 20/09/2019 you have to choose between audio and suspend though this will likely change when MCMrARM updates the bridge driver.

Install the suspend branch of the bce module: git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git cd mbp2018-bridge-drv git checkout suspend make cp bce.ko /usr/lib/modules/extramodules-mbp/bce.ko modprobe bce Blacklist applesmc /etc/modprobe.d/applesmc.conf

blacklist applesmc Add pcie_ports=compat as a kernel parameter. Edit /etc/default/grub and add it to GRUB_CMDLINE_LINUX_DEFAULT e.g. GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet pcie_ports=compat" then run grub-mkconfig -o /boot/grub/grub.cfg and reboot.

Currently (20/09/2019) the touchbar driver crashes on resume and the thunderbolt driver causes suspend to take 30+ seconds and resume to take several minutes. This is fixed by automaitcally unloading the problematic modules on suspend and reloading them on resume.

Create /lib/systemd/system-sleep/rmmod.sh and add:

#!/bin/sh if [ "${1}" == "pre" ]; then rmmod thunderbolt rmmod apple_ib_tb elif [ "${1}" == "post" ]; then modprobe apple_ib_tb modprobe thunderbolt fi and make the file executable:

sudo chmod +x /lib/systemd/system-sleep/rmmod.sh

DisplayPort over USB-C

Works out of the box with a compatible adapter

Compiling a new kernel with patches to complete (almost) the functionality of your MBP

This part is largely lifted from a StackOverflow post by Aiden Yeomin Nam:

https://stackoverflow.com/questions/51669724/install-rt-linux-patch-for-ubuntu

  1. Make a working directory

$ mkdir ~/kernel && cd ~/kernel

  1. Download kernel and patches

Download the kernel (currently 5.6-rc6) from https://www.kernel.org/. You can get it below:

(kernel) https://git.kernel.org/torvalds/t/linux-5.6-rc6.tar.gz

Note the version of the kernel. I used linux-5.6-rc6.tar.gz

Move the zip file to ~/kernel

cd ~/Download

mv linux-5.6-rc6.tar.gz ~/kernel/.

Download aunali's patches

https://github.com/aunali1/linux-mbp-arch

Download and unzip the patches

cd linux-mbp-arch-master

Delete everything that does NOT have the *.patch extension.

  1. Extract kernel sources and add aunali's patches

Extract kernel sources

cd ~/kernel

tar xvzf linux-5.6-rc6.tar.gz

Patch the kernel

cd linux-5.6-rc6

for i in /home/[YOUR USERNAME]/Downloads/linux-mbp-arch-master/*.patch; do patch -p1 --verbose < $i; done

  1. Install required packages

For using menuconfig GUI, libncurses-dev is required. flex and bison will be needed when you compile the kernel.

For using gui

sudo apt install libncurses-dev libssl-dev

For compiling kernel

sudo apt install flex bison

  1. Configure the kernel

make menuconfig

and enter the menuconfig GUI.

I don't change anything, because I don't know what I'm doing. Feel free to change whatever you want for your needs

Select "SAVE" and keep hitting "EXIT" to exit the GUI and back out to the command line.

  1. Compile the kernel
make -j8
sudo make modules_install -j8
sudo make install -j8

Your computer will churn for an hour or more compiling the kernel. Grab a beer or cofeee, depeding on the time of day.

  1. Make kernel images lighter

By not fiddling with the menuconfig GUI, the resulting initrd.img file in /boot is going to be almost 1TB instead of ~90MB!!! You can trim this down by:

Strip unneeded symbols of object files

sudo find . -name *.ko -exec strip --strip-unneeded {} +

then update initramfs

sudo update-initramfs -u

  1. Verify the new kernel is present

Make sure that initrd.img-5.6.0-rc6, vmlinuz-5.6.0-rc6, and config-5.6.0-rc6 are generated in /boot

ls
  1. Reboot and verify

sudo reboot

After the reboot

uname -r

Now you can check your new kernel version:

5.6.0-rc6 should be the result.

You now have an almost fully functioning Ubuntu installation working on a Macbook Pro 16-inch. Enjoy!

Fixing bootcamp/Windows

If you had installed Windows 10 via bootcamp prior to intalling Ubuntu, you may have noticed that Windows no longer boots. Fear not! Windows is still there, but for some reason, bootcamp installs Windows 10 in hybrid legacy/GPT mode instead of the regular UEFI. Here's the fix:

  1. Boot into linux

  2. Open a terminal and type sudo gdisk /dev/nvme0n1

  3. Push x for expert mode

  4. Press n to create a protective MBR

  5. Press w to write the partition and y to confirm

  6. If you're not automatically exited from gdisk, then type q to exit

Reboot and hold down the option key to choose the boot drive. Pick Windows and confirm it loads properly. If so, you'll need to reboot back into MacOS and reinstall rEFInd. This should resolve any weird boot behavior (ie, no more win10, resetting MacOS password, etc).

Using the integrated GPU to save battery life

You'll need to spoof the Macbook Pro into thinking it's booting into MacOS when it's really booting into Linux (this also works for Windows!). Follow the directions here:

https://github.com/0xbb/apple_set_os.efi/

@ceinem

This comment has been minimized.

Copy link

@ceinem ceinem commented Apr 13, 2020

Hi, thanks for the amazing Write-Up.
I'm trying to follow it with my macbookpro16,1
I'm currently at the point where I installed ubuntu and rEFInd, I can boot Ubuntu and it takes me to the Login page, but after entering my password, I get a black screen and after a few seconds the computer reboots.

Do you by any chance have any advice?
Also rEFInd is messing with my Mac partition, it also has severe issues with booting, often failing and rebooting :/

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Apr 14, 2020

I'm sorry, I don't have a clue as to your problem. I do know that the Gnome display manager (gdm3) has some bugs, so I switched to plasma (sddm). The LiveUSB works more or less OK? (obviously without keyboard and trackpad). You could try booting into the terminal from refind (this link is a start, but not exactly an answer: https://askubuntu.com/questions/389006/how-do-i-boot-to-console-with-refind). From there you might be able to download and compile a new kernel. Perhaps that could help. Kernel 5.6.3 was recently released, but I haven't compiled that one yet. As for refind and the MacOS partition, it has something (not sure what) with the way linux starts up and shuts down. If you can shut down down linux normally, everything seems to be OK. Otherwise, I also have to reboot into MacOS recovery mode and enter my password in again. I've also had to reset the NVRAM (cmd + option + P + R) and reinstall refind a couple times. There's a discord for Linux on Macs. Arch is better supported since the guys that wrote the patches and drivers did it with Arch in mind. I'm not a programmer or developer, and somehow managed to get Ubuntu on my machine, adapting their stuff. I'll find the discord invite and post it when I find it. Sorry, I couldn't be more help!

Edit: Discord link - https://discord.gg/XJmjnM

@Lokdex

This comment has been minimized.

Copy link

@Lokdex Lokdex commented Apr 20, 2020

Hey, for me everything works fine if you just go and follow the steps. In terms of refind, a fix for it is pressing option like you did for installing Linux, then boot into macOS and everything is ok. Once in MacOS, just reinstall refind. Next time you boot up refind appears and you can boot into Mac OS again with no problems at all.

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Apr 21, 2020

I've rebooted between MacOS, Windows 10, and Ubuntu a few times now without any problems either for the past couple of weeks. No need to keep reinstalling refind, either! Now if I could only get external GPU's working...

@Lokdex

This comment has been minimized.

Copy link

@Lokdex Lokdex commented Apr 21, 2020

Oh it sure does boot back and forth with no problem at all. The problem arises when you have to force shut it down. For example, if you get a kernel panic and you have to press the power button, then if you boot again and try to get into macOS it dies

@Arvind-Srinivasan

This comment has been minimized.

Copy link

@Arvind-Srinivasan Arvind-Srinivasan commented Apr 26, 2020

Is there by any chance an iso available with all the fixes bundled in?

@ceinem

This comment has been minimized.

Copy link

@ceinem ceinem commented Apr 26, 2020

There's a ready made iso for Fedora but to my knowledge not of ubuntu

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Apr 26, 2020

I tried making an iso myself, but I couldn't get it to work. Every time I tried using various tools like isorespin(?) it never worked. Not sure why it's so hard (or why there's a dearth of tools) for rolling your own Ubuntu.

@marcosfad

This comment has been minimized.

Copy link

@marcosfad marcosfad commented Apr 27, 2020

Hi, I've just finished compiling an ISO with all fixed. I've also created a Repository for the Kernel with the fixes for MBP (I've worked from what @mikeeq did. Feel free to give it a try.
https://github.com/marcosfad/mbp-ubuntu/releases

@henkf

This comment has been minimized.

Copy link

@henkf henkf commented Apr 30, 2020

@ceinem, what kernel are you booting? I had the blank screen occur when I tested the modifications on top of xubuntu 20.04's default kernel (5.4.xx). I am now using 5.6.0 with the patches and modules applied as described above, and everything works as described.

Thanks, @gbrow004 for the comprehensive writeup!

@ceinem

This comment has been minimized.

Copy link

@ceinem ceinem commented Apr 30, 2020

@henkf, at the moment I'm using the mbp-fedora iso with v5.6.5 which works fine. I'll give ubuntu another shot when I have time for it.

@rongsted

This comment has been minimized.

Copy link

@rongsted rongsted commented May 1, 2020

Hi I’m also installing Ubuntu 20.04 on My Mac. I want to learn Linux
First I made two new partitions on My drive a swap (doubler size of My ram) and an Ubuntu on 50GB
I installed a dualboot by downloading rEFInd boot manager and following the guidelines. I had to disable the T2 chip before I could install the dualboot. And I booted into the USB and it worked. I was SO happy!!!
So now I will try to follow your comprehensive list!!!
I will update ASAP

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented May 4, 2020

Hi, I've just finished compiling an ISO with all fixed. I've also created a Repository for the Kernel with the fixes for MBP (I've worked from what @mikeeq did. Feel free to give it a try.
https://github.com/marcosfad/mbp-ubuntu/releases

Did you use the official 20.04 release, as opposed to the dailies/betas?

@marcosfad

This comment has been minimized.

Copy link

@marcosfad marcosfad commented May 5, 2020

I build it from scratch. It is a minimal desktop installation. On my MBP 16,1 is working fine and I don’t have to use refind. You can check the code and even compile your own version with the code. You can modify the software installed by modifying the files/chroot_build.sh file.

@cristianmiranda

This comment has been minimized.

Copy link

@cristianmiranda cristianmiranda commented May 7, 2020

Hi! Has anyone been able to spoof macos (either using refind or custom efi) to be able to use the integrated Intel GPU?
I have another MacBook (without T2 chip) and I was able to do it, but not on the new one. I think I was able to see the Intel card only once on the first boot though (I checked using lspci command).
Any help is highly appreciated.

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented May 7, 2020

Hi! Has anyone been able to spoof macos (either using refind or custom efi) to be able to use the integrated Intel GPU?
I have another MacBook (without T2 chip) and I was able to do it, but not on the new one. I think I was able to see the Intel card only once on the first boot though (I checked using lspci command).
Any help is highly appreciated.

Yes, I'll update the guide.

https://github.com/0xbb/apple_set_os.efi/

@alexttyip

This comment has been minimized.

Copy link

@alexttyip alexttyip commented May 7, 2020

Hey, installation of ubuntu itself went fine, however, drivers for keyboard/trackpad/touchbar isn't working. Is it just me or is anyone else experiencing this? Many thanks.

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented May 7, 2020

Try using the insmod command to load the bce.ko driver. Something like "insmod /usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko" which should manually load the driver. If that doesn't work, try deleting usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko and recompiling it and the copying it back over. The way I wrote the guide doesn't account for a recompile, which is necessary after updating the kernel. If it DID work when manuallyt loading the driver, maybe the /etc/modules file has been deprecated or something.

@cristianmiranda

This comment has been minimized.

Copy link

@cristianmiranda cristianmiranda commented May 7, 2020

Hi! Has anyone been able to spoof macos (either using refind or custom efi) to be able to use the integrated Intel GPU?
I have another MacBook (without T2 chip) and I was able to do it, but not on the new one. I think I was able to see the Intel card only once on the first boot though (I checked using lspci command).
Any help is highly appreciated.

Yes, I'll update the guide.

https://github.com/0xbb/apple_set_os.efi/

Ok, apparently with refind I can see the Intel board. Now the only question is, can we switch to the integrated gpu somehow? Maybe with https://github.com/0xbb/gpu-switch ?
Thanks for replying so fast!

@alexttyip

This comment has been minimized.

Copy link

@alexttyip alexttyip commented May 8, 2020

Try using the insmod command to load the bce.ko driver. Something like "insmod /usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko" which should manually load the driver. If that doesn't work, try deleting usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko and recompiling it and the copying it back over. The way I wrote the guide doesn't account for a recompile, which is necessary after updating the kernel. If it DID work when manuallyt loading the driver, maybe the /etc/modules file has been deprecated or something.

Thanks for the reply, I've tried what you said but with no success. I'm on the official 20.04 release with 5.4.0-29 linux kernel if that makes a difference...

@cristianmiranda

This comment has been minimized.

Copy link

@cristianmiranda cristianmiranda commented May 9, 2020

Hi! Has anyone been able to spoof macos (either using refind or custom efi) to be able to use the integrated Intel GPU?
I have another MacBook (without T2 chip) and I was able to do it, but not on the new one. I think I was able to see the Intel card only once on the first boot though (I checked using lspci command).
Any help is highly appreciated.

Yes, I'll update the guide.

https://github.com/0xbb/apple_set_os.efi/

@gbrow004 This is just a summary of things I've tried so far (hopefully it'll help other having problems using linux with dual GPU mbps):

  • I'm on MBP 15,3 2018 with T2 chip.
  1. Using rEFInd I can spoof macos and the integrated Intel GPU becomes powered on and visible, alongside with the ATI dedicated GPU.
[cmiranda@localhost ~]$ lspci \| grep "VGA"
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Vega 12 [Radeon Pro Vega 20] (rev c0)
04:00.1 Non-VGA unclassified device: Apple Inc. T2 Bridge Controller (rev 01)
04:00.2 Non-VGA unclassified device: Apple Inc. T2 Secure Enclave Processor (rev 01)
  1. Since I booted using rEFInd, amdgpu is not in charge anymore (or at least that seems to be the case), but I don't have full control of the graphics either (as you can see on the following output). I cannot control brightness for instance and power consumption if off the charts (same as overheating):
[cmiranda@localhost ~]$ glxinfo \| grep "OpenGL renderer"
OpenGL renderer string: llvmpipe (LLVM 10.0.0, 256 bits)

[cmiranda@localhost ~]$ xrandr -q
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*
   
[cmiranda@localhost ~]$ xrandr --listproviders
Providers: number : 0
  1. I cannot mount efivars anymore (not sure why) so I cannot use https://github.com/0xbb/gpu-switch to switch to the integrated GPU (see mikeeq/mbp-fedora#17 (comment)).

  2. As you can see on dmesg logs I get this:

[    0.115080] You have booted with nomodeset. This means your GPU drivers are DISABLED

So I edited grub and removed nomodeset. After it boots it seems that graphics are better, I see brightness controls but after a few seconds the whole system freezes :/

More logs: https://paste.gg/p/anonymous/5510a39de482465a80c0baef65d3b68f

NOTE: I have a MBP 2016 (no T2 chip) and I was able to make it work like this:

  1. blacklist amdgpu
  2. spoof macos using refind (or a custom EFI)
  3. modprobe amdgpu
  4. turn off amdgpu using vgaswitcheroo

I hope this summary helps anyone else trying to make this work 🤞

@kami83

This comment has been minimized.

Copy link

@kami83 kami83 commented Jun 21, 2020

Hi, thanks a lot. Really nice guide. I am also waiting for a solution with the wifi. But i have got another problem with Secure Boot.

I am trying to run refind with shim or Preloader on my Macbook Pro 2020. Without Secure Boot it is no Problem to boot the refind an just use this bootloader to start Catalina/Windows and Linux. But if i activate in the Recovery Mode Secure Boot with Middle Security Mode it always crashes and i have to reset the Bootloader to the MacOS Volume.

I have now tested different versions of shim-signed with Microsoft CER and the Linux Foundation Preloader with Hashtool. But at all times it doesn't start the shim or Preloader when Secure Boot is activated. I also disabled SIP with the csrutil and i tested my "bless" command with the Windows Bootloader bootmgrfw.efi. (bless --mount /Volumes/ESP --setboot --file /Volumes/ESP/EFI/refind/shimx64.efi --shortform). If i use the bless cmd with the bootmgrfw.efi instead of shimx64.efi it works fine and Windows is booting. But shim or Preloader never works. Maybe you can help me with this. I tested the Ubuntu, Arch and Fedora and shim-signed-0.2 efi file. None of this files works.

Thanks a lot.

Cu kami

@swinder0161

This comment has been minimized.

Copy link

@swinder0161 swinder0161 commented Jul 31, 2020

Hi, This is detailed guide and as others I could get it right in the first attempt. Thanks a lot.
I am curious to know about wifi, any progress on that? Is someone checking that out and any approximate time when it can work or maybe next ubuntu release can make it work?

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Jul 31, 2020

Hi, thanks a lot. Really nice guide. I am also waiting for a solution with the wifi. But i have got another problem with Secure Boot.

I am trying to run refind with shim or Preloader on my Macbook Pro 2020. Without Secure Boot it is no Problem to boot the refind an just use this bootloader to start Catalina/Windows and Linux. But if i activate in the Recovery Mode Secure Boot with Middle Security Mode it always crashes and i have to reset the Bootloader to the MacOS Volume.

I have now tested different versions of shim-signed with Microsoft CER and the Linux Foundation Preloader with Hashtool. But at all times it doesn't start the shim or Preloader when Secure Boot is activated. I also disabled SIP with the csrutil and i tested my "bless" command with the Windows Bootloader bootmgrfw.efi. (bless --mount /Volumes/ESP --setboot --file /Volumes/ESP/EFI/refind/shimx64.efi --shortform). If i use the bless cmd with the bootmgrfw.efi instead of shimx64.efi it works fine and Windows is booting. But shim or Preloader never works. Maybe you can help me with this. I tested the Ubuntu, Arch and Fedora and shim-signed-0.2 efi file. None of this files works.

Thanks a lot.

Cu kami

I'm afraid this outside of my knowledge. I disable secure boot when booting into linux, which I realize is risky and not ideal. I gave up trying to to get shim to work. Sorry!

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Jul 31, 2020

Hi, This is detailed guide and as others I could get it right in the first attempt. Thanks a lot.
I am curious to know about wifi, any progress on that? Is someone checking that out and any approximate time when it can work or maybe next ubuntu release can make it work?

Yes, work is slowly being made on getting the WiFi to work. There's a linux on mbp 2018+ discord and people there are working on it. I'll definitely update the guide when progress is made.

@swinder0161

This comment has been minimized.

Copy link

@swinder0161 swinder0161 commented Jul 31, 2020

Hi, This is detailed guide and as others I could get it right in the first attempt. Thanks a lot.
I am curious to know about wifi, any progress on that? Is someone checking that out and any approximate time when it can work or maybe next ubuntu release can make it work?

Yes, work is slowly being made on getting the WiFi to work. There's a linux on mbp 2018+ discord and people there are working on it. I'll definitely update the guide when progress is made.

Oh, that was a quick reply. Looking at the speed of response, I am more confident that it will come up sooner or later. Thanks for keeping the conversations and thread alive. Really helps us all.

@swinder0161

This comment has been minimized.

Copy link

@swinder0161 swinder0161 commented Jul 31, 2020

if possible please add me to discord group swinder0161#6215 Will be happy to connect with you @gbrow004

I can give my contribution to R&D of the same.

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Aug 1, 2020

@Neverlandrunner

This comment has been minimized.

Copy link

@Neverlandrunner Neverlandrunner commented Oct 24, 2020

@gbrow004
Hi, thanks for the comprehensive walkthrough. I followed the installation steps and installed Ubuntu WITHOUT the grub2 bootloader. It was successful. I then installed rEFInd after reboot, which was successful too. However, when it is rebooted again, rEFInd could not find Ubuntu and there are only two icons. Were there any other steps that I may have missed after the installation? I appreciate it very much if you could provide some suggestions on how should I move forward.
Thank you!

@trickpattyFH20

This comment has been minimized.

Copy link

@trickpattyFH20 trickpattyFH20 commented Dec 21, 2020

Try using the insmod command to load the bce.ko driver. Something like "insmod /usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko" which should manually load the driver. If that doesn't work, try deleting usr/lib/modules/5.6.6/kernel/drivers/pci/bce.ko and recompiling it and the copying it back over. The way I wrote the guide doesn't account for a recompile, which is necessary after updating the kernel. If it DID work when manuallyt loading the driver, maybe the /etc/modules file has been deprecated or something.

Thanks for the reply, I've tried what you said but with no success. I'm on the official 20.04 release with 5.4.0-29 linux kernel if that makes a difference...

@alexttyip I was having the same issue and fixed it by doing this:
sudo depmod

Apparently it refreshes the dependency paths:
https://stackoverflow.com/questions/34800731/module-not-found-when-i-do-a-modprobe

@parispm88

This comment has been minimized.

Copy link

@parispm88 parispm88 commented Jan 24, 2021

@gbrow004
Hi, thanks for the comprehensive walkthrough. I followed the installation steps and installed Ubuntu WITHOUT the grub2 bootloader. It was successful. I then installed rEFInd after reboot, which was successful too. However, when it is rebooted again, rEFInd could not find Ubuntu and there are only two icons. Were there any other steps that I may have missed after the installation? I appreciate it very much if you could provide some suggestions on how should I move forward.
Thank you!

@Neverlandrunner

Did you happen to figure out a solution to this?

@zfortier

This comment has been minimized.

Copy link

@zfortier zfortier commented Mar 2, 2021

@parispm88 you might have better luck sticking with grub. rEFInd seems to complex, it behaves mysteriously sometimes (which can be good when it unexpectedly does what you want, but not so good otherwise...).

@fetushito

This comment has been minimized.

Copy link

@fetushito fetushito commented Jul 13, 2021

I tried really hard to compile the kernel. I used multiple version but none of them compiles.. All isues are around applesmc.c file. Looks like the patch is not getting correctly applied. I am currently running 5.8.0-59-generic, is this version somehow not compatible with the patches?

All kernel versions compile like a charm with no patches applied...

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Jul 14, 2021

@fetushito This guide is becoming out of date and nearly deprecated. I'd suggest trying a much newer kernel version. The latest Ubuntu Desktop (21.04) has kernel 5.11.0 so it already has a quite a few patches included. I'm not sure, but I also think something changed in the kernel regarding WiFi, so that might not work, although that was always a difficult task for the MBP16 in linux. Aunali's patches aren't available for this exact kernel version, but the 5.11.20 might work: https://github.com/aunali1/linux-mbp-arch/releases

@fetushito

This comment has been minimized.

Copy link

@fetushito fetushito commented Jul 15, 2021

Thanks @gbrow004 - Your suggestion worked quite nicely. The only thing I noticed is that the bluetooth has stopped working after migrating to 21.04. There is no power in the world that can fix those issues. Any pointers on where to find a good set of instructions for that?

@gbrow004

This comment has been minimized.

Copy link
Owner Author

@gbrow004 gbrow004 commented Jul 15, 2021

@fetushito I'm afraid I don't have any good suggestions. Bluetooth and wifi have always been finicky or tricky things to get working well. If you haven't already, try checking out marcosfad's github page. He's been rolling the minimal install of ubuntu with all the patches and workarounds: https://github.com/marcosfad/mbp-ubuntu He also has just the kernels for download too: https://github.com/marcosfad/mbp-ubuntu-kernel/releases The 5.10 kernel might have better success?

@fddemora

This comment has been minimized.

Copy link

@fddemora fddemora commented Jul 16, 2021

Well there goes my plan to switch to linux later.

@fetushito

This comment has been minimized.

Copy link

@fetushito fetushito commented Jul 18, 2021

Hi! Has anyone been able to spoof macos (either using refind or custom efi) to be able to use the integrated Intel GPU?
I have another MacBook (without T2 chip) and I was able to do it, but not on the new one. I think I was able to see the Intel card only once on the first boot though (I checked using lspci command).
Any help is highly appreciated.

Yes, I'll update the guide.
https://github.com/0xbb/apple_set_os.efi/

@gbrow004 This is just a summary of things I've tried so far (hopefully it'll help other having problems using linux with dual GPU mbps):

* I'm on MBP 15,3 2018 with T2 chip.


1. Using rEFInd I can spoof macos and the integrated Intel GPU becomes powered on and visible, alongside with the ATI dedicated GPU.
[cmiranda@localhost ~]$ lspci \| grep "VGA"
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Vega 12 [Radeon Pro Vega 20] (rev c0)
04:00.1 Non-VGA unclassified device: Apple Inc. T2 Bridge Controller (rev 01)
04:00.2 Non-VGA unclassified device: Apple Inc. T2 Secure Enclave Processor (rev 01)
1. Since I booted using rEFInd, amdgpu is not in charge anymore (or at least that seems to be the case), but I don't have full control of the graphics either (as you can see on the following output). I cannot control brightness for instance and power consumption if off the charts (same as overheating):
[cmiranda@localhost ~]$ glxinfo \| grep "OpenGL renderer"
OpenGL renderer string: llvmpipe (LLVM 10.0.0, 256 bits)

[cmiranda@localhost ~]$ xrandr -q
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*
   
[cmiranda@localhost ~]$ xrandr --listproviders
Providers: number : 0
1. I cannot mount efivars anymore (not sure why) so I cannot use https://github.com/0xbb/gpu-switch to switch to the integrated GPU (see [mikeeq/mbp-fedora#17](https://github.com/mikeeq/mbp-fedora/issues/17) (comment)).

2. As you can see on `dmesg` logs I get this:
[    0.115080] You have booted with nomodeset. This means your GPU drivers are DISABLED

So I edited grub and removed nomodeset. After it boots it seems that graphics are better, I see brightness controls but after a few seconds the whole system freezes :/

More logs: https://paste.gg/p/anonymous/5510a39de482465a80c0baef65d3b68f

NOTE: I have a MBP 2016 (no T2 chip) and I was able to make it work like this:

1. blacklist amdgpu

2. spoof macos using refind (or a custom EFI)

3. modprobe amdgpu

4. turn off amdgpu using vgaswitcheroo

I hope this summary helps anyone else trying to make this work crossed_fingers

Were you successful in booting with the iGPU? Currently going through the same journey and I end up with the CPU as the graphics processor, which of course makes things worse temperature-wise. No success on the MBP 16,1 as of yet.

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Aug 14, 2021

Checkout wiki.t2linux.org

@Epicsurgeon

This comment has been minimized.

Copy link

@Epicsurgeon Epicsurgeon commented Sep 4, 2021

Hi! I have followed the guide and installed ubuntu without grub bootloader and refind. After these steps I cannot boot to either macos (powers off after choosing macos) or ubuntu (shows grub command line)

@Epicsurgeon

This comment has been minimized.

Copy link

@Epicsurgeon Epicsurgeon commented Sep 4, 2021

Macbook pro 13 2020 intel

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Sep 4, 2021

Hi! I have followed the guide and installed ubuntu without grub bootloader and refind. After these steps I cannot boot to either macos (powers off after choosing macos) or ubuntu (shows grub command line)

Ubuntu needs grub. Refind faces issues.

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Sep 4, 2021

Macbook pro 13 2020 intel

Follow the guide on wiki.t2linux.org

It's updated

You may contact them on their discord too.

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Sep 4, 2021

@Epicsurgeon, I guess you used an official iso from Ubuntu.com. You have to use a customized iso at the moment.

@Epicsurgeon

This comment has been minimized.

Copy link

@Epicsurgeon Epicsurgeon commented Sep 4, 2021

Do you have link to this customized ubuntu iso? The link in this gist is dead and the wiki page does not mention the t2 chip

@marcosfad

This comment has been minimized.

Copy link

@marcosfad marcosfad commented Sep 4, 2021

Hi @Epicsurgeon, take a look in https://wiki.t2linux.org/distributions/ubuntu/installation/.
I'm preparing a new release with a newer kernel, but at the moment the best option is the one with the 5.7 kernel.
https://github.com/marcosfad/mbp-ubuntu

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Sep 5, 2021

@Epicsurgeon, follow the roadmap on https://wiki.t2linux.org/roadmap/ after you install Ubuntu from the link @marcosfad sent you.

@thematrixdev

This comment has been minimized.

Copy link

@thematrixdev thematrixdev commented Sep 16, 2021

@Epicsurgeon I have tried installing Ubuntu onto the same MBP-2020 a month ago but no luck. May I know if you have installed it successfully?

@AdityaGarg8

This comment has been minimized.

Copy link

@AdityaGarg8 AdityaGarg8 commented Sep 16, 2021

@thematrixdev, on our discord we have many successful cases who have installed Ubuntu on mbp 2020. You may contact the t2linux team on their discord. Link is there on https://wiki.t2linux.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment