Notes to install Ubuntu 26.04 LTS on my 2016 MacBook Pro 13 inch (MacBookPro13,2).
Everything except the TouchID (Fingerprint), Suspend and Hibernation seems to work for me.
- Rob Hills's original Gist
- Alma's Gist - Ubuntu LTS on MacBook Pro 2017 (A1707 - this is forked from.
A lot of online info about running Ubuntu on MBP indicated that you needed to build drivers and install them just to get the basics running. For Ubuntu 26.04 LTS and my MBP A1706, this was not the case. Things that worked for me with the standard Ubuntu 26.04 LTS Live USB and after initial installation included:
- The basic keyboard (not the Touchbar with Esc and Function keys though) - imperitive to get an ESC key working if using
vi; - The touchpad;
- My Dell WD-15 USB-C Docking Station Wired Connection to the Network, USB-Sound, etc. Power/Sleep button does not work.
- My Belkin USB-C to 1G Ethernet
- Bluetooth. Connected external Bluetooth keyboard and Apple mouse 2.
- USB External Storage Devices
- Wifi: It was partly functional, but not usable. Only 2.4Ghz access points shown and you had to be very close to the Access Point to connect;
- Touchbar;
- Sound;
- Camera;
- Clamshell mode (* External Display Port Monitors before GNOME Desktop has started, BT Keyboard to enter LUKS password)
- Suspend (Can not resume many hardware); 2016 version seems to work with following method: https://ubuntuforums.org/showthread.php?t=2492426 But, 2017 version seems doesn't work.
- Hibernation (When I execute
systemctl hibernate, it seems shutting down); - TouchID (It seems diffucult. There might have possibility. Please see this: Dunedan/mbp-2016-linux#71 (comment));
-
Create your bootable Ubuntu USB stick
-
If you are using Apple Password Manager (Passwords.App) or Keychain (or some other Application that either doesn't work or you don't have a license for on Ubuntu) then you might want to download them first. KeePassXC works on both Mac and Ubuntu and is free.
- Passwords.app can be found in the Application Menu (if you are using a more modern MacOS).
- You can export the passwords as a CSV and then import the CSV into KeePass
- Older MacOS may have the Keychain Application in Applications/Utilities Menu
- If Keychain is not in Applications/Utilities then open a terminal window and run
open /System/Library/CoreServices/Applications/Keychain\ Access.app
- Passwords.app can be found in the Application Menu (if you are using a more modern MacOS).
-
Take a backup (using Time Machine)
-
Using macOS Recovery make a backup using Disk Utility
- You can use APFS on Ubunutu so don't worry about converting your backups to FAT32 or other disk format.
- I made a clone of my Internal disk by Restoring a disk image to a disk using Disk Utility on one disk
- I made an rsync copy of my Internal disk to a second disk which I'd partitioned up ( the rsync was made from the Recovery OS, I mounted the disk using Disk Utility, then closed disk utility and opened a terminal window).
rsync -a <SOURCE> <DESTINATION>
-
I tested to see that I could boot from my cloned Internal Disk.
-
Finally follow the steps to Erase All Content and Settings - Sign out of iTunes, iCloud, iMessage. Use Disk Utility to erase your Mac and then re-install the latest MacOS from Recovery.
-
Using Disk Utility Add a second partition ( this will be where you install Linux ). You can resize the second partition to be as big as possible. Give the partition a name and format it
-
Boot Ubuntu from the USB stick (Press the power on button and then hold the Option (alt) key down, to select which volume to boot from) and as soon as GNOME starts, click on the top left hand bar, and search for gparted
- Delete the large partition you created above (leave the partition in place, just set it to unformated)
- Restart your laptop and boot from the USB stick (if you continue with the installation, without restarting you won't get the option to install Ubuntu alongside another Operating System
-
Encrypt your data - I used ZFS Encryption.
-
Make sure you keep MacOS and the Macbook EFI partition.
-
If you end up deleteing the whole disk, but then need to get the Touchbar working, then you will need to Install macOS from the Network and start again
If your Mac tries to start up from its built-in Recovery system but can’t, it should automatically show a spinning globe as it tries to start up from Recovery over the internet. Or you can force Internet Recovery by pressing either of the following combinations at startup, instead of Command-R. (Each combination also affects the version of macOS offered when reinstalling macOS from Recovery.)
- Option-Command-R (Gives you the latest supported MacOS on your system)
- Shift-Option-Command-R (Gives you the original MacOS that your system had)
The following notes mostly document what worked to get Wifi, Touchbar, Camera, and Sound working.
The Macbook's EFI partition needs to be kept. Please see the following comment for more information. https://gist.github.com/roadrunner2/1289542a748d9a104e7baec6a92f9cd7?permalink_comment_id=4937505#gistcomment-4937505
I downloaded the configuration file and copied it to /usr/lib/firmware/brcm/brcmfmac43602-pcie.txt.
Andy Holst's example configuration file final iteration here was ideal and required a little tweaking for my system.
I made the following changes to Andy Holst's /usr/lib/firmware/brcm/brcmfmac43602-pcie.txt
macaddr=00:90:4c:0d:f5:30
ccode=GB
- macaddr - set to the mac address of my WiFi card (I got it with the command
ip addr) - ccode - I just simply set it to ALL, (ALL (Channel 1-14), US, EU etc.)
Become the superuser
sudo su
Ubuntu 26.04 uses dracut, but you can still add the new modules to the list to be loaded
cat <<EOF | tee -a /etc/initramfs-tools/modules
# drivers for keyboard+touchpad
applespi
apple_ib_tb
intel_lpss_pci
spi_pxa2xx_platform
EOF
Build and install drivers from the source code.
apt install dkms
cd {your preferred source download folder}
git clone https://github.com/almas/macbook12-spi-driver
cd macbook12-spi-driver
git checkout touchbar-driver-hid-driver
ln -s `pwd` /usr/src/applespi-0.1
Add the following lines to the Makefile (line 3)
CFLAGS_apple-ibridge.o = -Wno-error=incompatible-pointer-types
CFLAGS_apple-ib-tb.o = -Wno-error=incompatible-pointer-types
CFLAGS_apple-ib-als.o = -Wno-error=incompatible-pointer-types
In apple-ibridge.c comment out the owner line on line 901 so it (and the surrounding lines look like)
static struct acpi_driver appleib_driver = {
.name = "apple-ibridge",
.class = "topcase", /* ? */
/*.owner = THIS_MODULE, */
.ids = appleib_acpi_match,
.ops = {
.add = appleib_probe,
.remove = appleib_remove,
},
.drv = {
.pm = &appleib_pm,
},
};
Now continue with the install
dkms install applespi/0.1 --force
Test the drivers by loading them and their dependencies
modprobe intel_lpss_pci spi_pxa2xx_platform applespi apple_ib_tb
An empty output indicates success
Reboot
At this point of the process, my touchbar was not working. More Googling led me to someone else logging this as [an issue on RoadRunner2's Driver repository[(roadrunner2/macbook12-spi-driver#42] and in the discussion I found a workaround. The following commands:
echo '1-3' | sudo tee /sys/bus/usb/drivers/usb/unbind
echo '1-3' | sudo tee /sys/bus/usb/drivers/usb/bind
still didn't get my touchbar working, but once I'd added the following startup script, it did work.
To save having to run these commands each time I start the computer, I needed to create a "macbook-quirks.service" and have it start up with the computer:
sudo su
cat <<EOF | tee /etc/systemd/system/macbook-quirks.service
[Unit]
Description=Re-enable MacBook 14,3 TouchBar
Before=display-manager.service
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 2
ExecStart=/bin/sh -c "echo '1-3' > /sys/bus/usb/drivers/usb/unbind"
ExecStart=/bin/sh -c "echo '1-3' > /sys/bus/usb/drivers/usb/bind"
RemainAfterExit=yes
TimeoutSec=0
[Install]
WantedBy=multi-user.target
EOF
Now enable with systemctl enable macbook-quirks.service and reboot to check.
My MBP now boots up with the Touchbar working
From the discussion in the link above, it appears this may be due to a bug in Linux and the usbmuxd system so hopefully will be able to remove the workaround in the future, so keep an eye on the relevant issue discussion.
I didn't do this, but I've left it in, so if you want the Function keys to appear by default (instead of the brightness and sound keys), then you need to pass some parameters to the apple_ib_tb module. 'modinfo apple_ib_tb' lists the parameters and what they do.
sudo su
cat <<EOF | tee /etc/modprobe.d/apple_ib_tb.conf
options apple_ib_tb fnmode=2 # Default to Function Keys, Fn key toggles to "special"
options apple_ib_tb idle_timeout=60 # Turn off the Touchbar after 60 seconds.
EOF
After reloading the module with the following command, the Function keys will be shown by default.
sudo modprobe -r apple_ib_tb
sudo modprobe apple_ib_tb
I found the resolution from the Rade0nFighter's answer from the following QA: https://askubuntu.com/questions/1475091/sound-macbook-pro-ubuntu-22-04
sudo su
apt install wget make gcc linux-headers-generic
git clone https://github.com/davidjo/snd_hda_macbookpro.git
cd snd_hda_macbookpro/
bash install.cirrus.driver.sh
# It will give you instructions to install package linux-source-XXXXX. Install it.
apt install linux-source-XXXXX
# Then re-run install script.
bash install.cirrus.driver.sh
bash dkms.sh
reboot
Now the sound should work.
I also have some USB speakers connected. In order to get them to work, I used alsamixer pressing F6 I selected them, and turned the volume up.
Execute the following command and reboot.
echo "options uvcvideo quirks=0x100" > /etc/modprobe.d/uvcvideo.conf
Now the camera should work too.
I have two external monitors connected using USB-C to Display Port cables, and a Bluetooth keyboard. When connected, there isn't enough space on my desk to keep the Macbook Open, so I close the lid and store it vertically. Once the system is booted and the Ubuntu Desktop has started, the Monitors display the Login Page and the Bluetooth Keyboard works ( I can enter my users' password using it ). The problem is I need to be able to see the boot sequence / LUKS password prompt on the external monitors and use the Bluetooth Keyboard to enter the password.
You need to get the Monitor to work during the Grub Stage. (Also, with ZFS there is a 30 second timeout before the system starts booting) You then need to get the Monitor to display during initramfs stage of the boot.
Edit the file /etc/default/grub
Under GRUB_TIMEOUT add the line (to disable the 30 second wait during ZFS boot)
GRUB_RECORDFAIL_TIMEOUT=0
Next modify the GRUB_CMDLINE_LINUX_DEFAULT to enable the DP-1 adapter at boot (ls /sys/class/drm/ shows the adapter names - take the card suffix off first).
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=DP-1:e"
The first paragraph should now look like
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_RECORDFAIL_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=DP-1:e"
GRUB_CMDLINE_LINUX=""
Run the command update-grub to update the Grub Boot Loader
Create the following file /etc/dracut.conf.d/50-uvcvideo.conf
add_drivers+=" uvcvideo i915 "
Rebuild initramfs by running the command sudo dracut --regenerate-all --force --hostonly
This wasn't as easy as it should be. For some reason, Ubuntu doesn't start dbus (which the bluez bluetooth daemon requires) until after the filesystem has been decrypted. I don't know the implications of moving to before then, but I've not had any issues that I'm aware of by doing so. You need to make sure that your keyboard (and mouse) is already connected to the Macbook Pro when using GNOME, as the configuration files in /var/bluetooth/ are copied into initramfs when you enable the bluetooth module.
Modify the systemctl scripts
sudo cp /usr/lib/systemd/system/dbus.socket /etc/systemd/system/
sudo cp /usr/lib/systemd/system/dbus.service /etc/systemd/system/
Modify the After line so it starts after plymouth-start.service e.g.
Wants=sysinit.target
#After=sysinit.target basic.target
After=plymouth-start.service
Next run systemctl daemon-reload so systemctl uses the new versions.
Add the following file to /etc/dracut.conf.d/52-dbus.conf
add_dracutmodules+=" dbus "
install_items+=" /etc/systemd/system/dbus.service /etc/systemd/system/dbus.socket "
You could rebuild initramfs now but you need to do it later on.
(Rebuild initramfs by running the command sudo dracut --regenerate-all --force --hostonly )
Add the following file to /etc/dracut.conf.d/51-bluetooth.conf
add_dracutmodules+=" bluetooth "
add_drivers+=" hci_uart "
Now rebuild initramfs by running the command sudo dracut --regenerate-all --force --hostonly
You can check the contents of your initramfs by running the command sudo lsinitrd
Install the two packages apfs-dkms and libfsapfs-utils
You can use the command fsapfsinfo to examine a filesystem, and apfsmount to mount it.
My USB drive appears as /dev/sda
lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 200M 0 part
├─sda2 8:2 0 931.4G 0 part
└─sda3 8:3 0 931.4G 0 part
sda2 is the APFS container partition ( and sda3 is an ext3 partition although not relevant here )
fsapfsinfo /dev/sda2
fsapfsinfo 20240429
Apple File System (APFS) information:
Container information:
Identifier : dc48a52c-cf06-4bba-b4c4-b5f08b4c761e
Number of volumes : 1
Unable to print container information.
I can mount it read-only at /mnt using the following command
mount -o cknodes,vol=1,ro /dev/sda2 /mnt
Mounting the Encrypted ZFS filesystems after breaking the boot sequence (grub / initramfs / startup script)
I broke my installation on multiple occassions, so knowing how to fix it is handy.
Insert the USB stick and press the Option key when pressing the power button on the MacBookPro Select and boot from the USB stick. Once the Ubuntu Desktop starts up, open up a terminal window.
sudo -s
lsblk
lsblk shows the largest partition on nvme0n1p6 so that is the encrypted pool
zpool import
# lists the pools
zpool import rpool -N -f -R /mnt rpool
cryptsetup luksOpen /dev/zvol/rpool/keystore zfskey
# Enter password to open the keystore
mkdir -p /mnt/keystore
mount /dev/mapper/zfskey /mnt/keystore
zfs load-key rpool -L file:///mnt/keystore/system.key
zfs mount -a
zpool import bpool -R /mnt boot
mount --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev/pts /mnt/dev/pts
chroot /mnt /bin/bash
Make changes, then
exit # leave the chrooted environment
umount -r /mnt
zpool export bpool
zpool export rpool
# I couldn't fully unmount rpool at this point as it was "busy" so my only option was to reboot
reboot
The system failed to get to the LUKS crypt page on reboot as the rpool pool could not be imported, and dropped me to the initramfs prompt. I was able to force import the zpool and then reboot
zpool import
zpool import -f rpool
reboot
- How to sync ICloud Calander to Ubuntu
- Apple Music (UK) - If you have an account you can sign in, and it will play
- https://gist.github.com/rob-hills/9134b7352ee7471c4d4f4fbd6454c4b9
- https://gist.github.com/roadrunner2/1289542a748d9a104e7baec6a92f9cd7
- https://github.com/Dunedan/mbp-2016-linux
- Asahi Linux Apple Partitioning Cheatsheet
- Kernel Command Line Parameters - for Grub Configuration
- Video Mode Options for Grub Configuration
- Mount Ubuntu ZFS Partitions
- How to Mount an Encrypted ZFS filesystem from the Ubuntu Live CD
There were no real changes between installing Ubuntu 25.10 and Ubuntu 26.04 LTS
I did do a full re-install of Ubuntu rather than upgrading. It gave me a chance to test out these instructions, and correct a few errors.