Arch Linux Installation on a Macbook
DRAFT
I was able to get Arch Linux up and fully running on a 2017 MacBook (12”) without pulling all of my hair out.
I’ll try to be as descriptive as possible, but please note this can’t (and shouldn’t be) a step by step guide to what I did. 90% of what I tried failed (better success rate than usual) so I can’t guarantee things I attempted but omit here didn’t have an impact (i).
Important limitations I’ve hit and haven’t solved:
Suspend/hibernate doesn’t work. Not great for a laptop.
Imagination.
Launching X11 server causes
tty’s to display a colorful glitchy patch in the top right hand corner
Important links upfront:
Official Documentation
https://wiki.archlinux.org/index.php/mac
https://wiki.archlinux.org/index.php/installation_guide
Helpful General Mac installation
http://www.brycethuilot.com/Installing-Arch/
Requirements:
Flash drive with arch linux installed on it (ii)
An external keyboard
Some way to get ethernet,
e.g., an ethernet to USB adapter
A way to have all three of the above plugged in at once - e.g., some
sort of USB-C to three USB2.0/3.0 hub
Patience and an understanding you may screw up your Mac
installation (so make a backup)
Roughly, the steps I took
- Add a new partition at the end of your drive using Mac’s Disk Utility
- I kept getting warnings and errors when repartitioning - to see the changes totally take effect, I had the restart after partitioning
- I also wasn’t able to add more than one partition at a time (iii)
- Install refind (iv)
- Refind is used as a boot manager
- Information and full install instructions can be found here http://www.rodsbooks.com/refind/installing.html#installsh, summarized below
- Before you can install refind, you need to disable SIP (System Integrity Protection) on your Mac
- Reboot, holding Command-R before the computer boots
- Open the terminal and run
csrutil disable
- Download the binaries from the above website, go into that folder, and run refind-install
- Format the new partition you made in Part 1.
- Reboot, holding ALT on boot to launch from your boot drive.
fdisk -l
- find the disk/partition you created in Step 1
- Note, from Mac OS this disk showed up as nvme0n1p3, but from arch, this showed
mkfs.ext4 /dev/nvmeXXXnXXXpXXX
- BE VERY CAREFUL - you don’t want to reformat your Mac OS partition!
mount /dev/nvmeXXXnXXXpXXX /mnt
- mount the new partition to your live USB session
- Reboot, holding ALT on boot to launch from your boot drive.
- Confirm that you can connect to the internet and then install!
- ping 8.8.4.4 to make sure you have internet, then proceed with install
pacstrap /mnt base
pacstrap /mnt base-devel
- Follow the rest of the install directions in https://wiki.archlinux.org/index.php/Installation_guide#Configure_the_system
- This starts with genfstab
- Then arch-chroot for you to begin configuration
- Follow the rest of the suggestions :)
- You can do this later, but it might make it easier to set up Refind from the Linux side now
- A description is here: https://wiki.archlinux.org/index.php/REFInd#Configuration
- I don’t think you need to run
refind-install
from linux - try skipping it - But I still had to run the following
pacman -Syu refind-efi
- install refind on arch linux (while you’re still chrooted in)
mkrlconf
cat /boot/refind_linux.conf
- just to make sure the configuration makes sense
- edit it if you need to change the partition of your linux installation or pass boot parameters (iv)
- Get the Mac keyboard up and running!
- Prerequisite: linux-headers
pacman -Syu linux-headers
pacman -Syu dkms
git clone https://github.com/cb22/macbook12-spi-driver.git /usr/src/applespi-0.1
cd /usr/src/applespi-0.1
dkms install -m applespi -v 0.1
- It might take a reboot before the keyboard is recognized, I’m not sure
- Prerequisite: linux-headers
- Get wifi working!
- I’m a little iffy on the exact steps, but this might work if you cross your fingers long enough (you might need to bash your head against your keyboard for a few minutes/hours, but it will work eventually!)
pacman -Syu NetworkManager nmcli
- install both NetworkManager and nmcli
NetworkManager
- NetworkManager must be launched before nmcli is launched
nmcli dev wifi password
- Connect!
- Remove the annoying 1min30 delay on boot as arch searches for ethernet
- I was able to find the solution here: https://bbs.archlinux.org/viewtopic.php?id=213363
- User Trilby pointed out you can see the order interfaces are launched
systemd-analyze critical-chain
- User loqs pointed out how to solve the
- cp /usr/lib/systemd/system/systemd-user-sessions.service /etc/systemd/system/systemd-user-sessions.service
- vim /etc/systemd/system/systemd-user-sessions.service
- change
After=...
line to:After=remote-fs.target nss-user-lookup.target
- change
- Keyboard backlight
- Information on changing the keyboard backlight can be found at https://wiki.archlinux.org/index.php/mac#Keyboard_Backlight
- On my installation, the path was: /sys/class/leds/spi\:\:kbd_backlight_brightness/
- Screen Backlight/Brightness
- Information on changing the keyboard backlight can be found at https://wiki.archlinux.org/index.php/backlight
- On my installation, the path was: /sys/class/backlight/intel_backlight/
(i) On a Mac, the easiest way to create the bootable flash drive is with dd
, see https://wiki.archlinux.org/index.php/USB_flash_installation_media#In_macOS
(Please be very careful that you select the correct destination! You don’t want to overwrite the wrong
drive!)
(ii) And presumably, hearing about the first four times I partitioned my drive may not be
necessary.
(iii) This is probably not critical at this stage, but, given the recommendations for a
MacOS, I shrunk the Mac OS partition a second time, by 128MB https://wiki.archlinux.org/index.php/mac#Option_1:_EFI
which I later formatted to raw.
(iv) This will change the way your computer boots - from now on,
you’ll have to explicitly select Mac OS before you can boot into it. Do not panic if you don’t see your
Mac OS immediately when the ReFind manager launches - hit to refresh the list of available drives
(v)
https://wiki.archlinux.org/index.php/REFInd or
rodsbooks