Last year I decided to install the latest Arch Linux ISO onto my 2015 Retina MacBook Pro. While the installation was relatively painless configuring the system utilities and configuring the retina screen was not.
The Arch wiki has loads of information if you get stuck. It also includes loads of other helpful guides written by other authors which may help you fix a problem. Some that I used are: 1 and 2. What you need for this tutorial are:
- A USB thumb drive.
- Access to another computer to use
ddon, such as: OSX, Linux any unix.
- Access to WiFi (lots of other guides say WiFi does not work out of the box but as of January 2020 I assume the kernel module for WiFi card has been included??) or an Apple Thunderbolt to Gigabit Ethernet adapter.
Download the latest ISO from Arch Linux. Use
dd like this:
dd if=archlinux.iso of=/dev/sdx bs=4M status=progress && sync
status=progress option was added in Coreutils 2.81 so check you’re using an up-to date version of Coreutils before trying this command. Also dd overwrites anything on the drive. Plug your USB drive into your Macbook and restart your computer. While the computer restarts hold down
ALT on the keyboard to bring up Apple’s EFI bootloader. Once Linux has booted you’ll be at the shell, this is where you’re going to setup your disks. Only having Arch installed is not recommended because Apple release firmware updates via the OSX App store, these could contain crucial bug fixes or security patches so it’s important.
Create the partitions, this can be done in OSX with the disk utility wizard, this guide though uses
Enter fdisk -l at the shell to list all the disks. Remember the number your disk uses. Setup these partitions:
/dev/sda5 [100MB] Apple HFS/HSF+ "Apple boot" /dev/sda6 [250MB] ext4 "boot" /dev/sda7 [rest of SSD space] ext4 "/ root file system"
This file system layout assumes you’re installing Arch Linux along side OSX. Installing OSX, Arch and Windows is left as an exercise for you to figure out. Now format the partitions with
mfks.ext4 /dev/sda6 && mkfs.ext4 /dev/sda7 && mount /dev/sda7 /mnt && mount /dev/sda6 /mnt/boot `
The next step sets up pacman, Arch Linux’s package manager, Pacman is similar to Debian’s/Ubuntu’s
apt-get. Read the man page to find out more information.
chroot are used to ‘chroot’ into the new OS.
pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
Obviously fstab is used to mount the disks. On bootup, the
mount commands reads the fstab files and mounts the disks.
Use your favourite editor (I use vim) to edit the fstab created above.
/dev/sda7 / ext4 defaults,noatime,discard,data=writeback 0 1 /dev/sda6 /boot ext4 defaults,stripe=4 0 2
noatime are used to lengthen the SSD’s life cycle.
noatime does not write write the time and date it was accessed, this reduced the wear and tear on an SSD.
arch-chroot /mnt /bin/bash echo your_host > /etc/hostname passwd passwd your_username ln -s /usr/share/zoneinfo/Europe/London /etc/localtime hwclock --systohc --utc pacman -S sudo
The user created in the code block above has to be added to the sudoers. On Linux all sudoers are part of the wheel group. So simply add your user to the wheel group (done above) and write to this file:
echo '%wheel ALL=(ALL) ALL ' >> /etc/sudoers.d/10-grant-wheel-group
This commands in this section are the same no matter where you live, what language you speak or the keyboard you are using, the arguments do change though.
A comment in this file beginning with
#, uncomment the local you use.
locale-gen echo LANG=en_GB.UTF8 > /etc/locale.conf
The locale you’re using needs to defined as a variable in bash so other programs launched at the shell can read it. Some windows manager like i3WM do not startup if this variable is not defined.
Setup the initramfs (if you have setup an encrypted volume include this here):
mkinitcpio -p linux
EFI Setup using grub
The standard version of GRUB (1) does not have EFI included, instead GRUB_EFI has to be installed.
pacman -S grub-efi-x86_64
Edit GRUB’s global config file:
Special parameters have to be passed to the kernel to get the Macbook Pro to boot Linux. GRUB passes these parameters to the kernel.
GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libta.force=1:nocq"
And on a seperate line add
to fix the grub menu on startup
grub-mkconfig -o /boot/grub/grub.cfg grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
Exit Linux and copy the boot.efi created above. Or alternatively upload the file using git to Bitbucket as they offer free private repos.
git init git add boot.efi git commit -m 'boot.efi' git push -u origin master exit reboot
Boot into OSX, remember to hold down ALT to bring up the EFI bootloader. Use git to clone the repo you pushed the boot.efi file to.
git clone repo_name
Setup the following directory structure:
cd /Volumes/disks05 mkdir System mach_kernel cd System mkdir Library mkdir CoreServices cd CoreServices vim SystemVersion.plist <xml version="1.0" encoding="utf-8"?> <plist version="1.0"> <dict> <key>ProductBuildVersion</key> <string></string> <key>ProductName</key> <string>Linux</string> <key>ProductVersion</key> <string>Arch Linux</string> </dict> </plist>
Make the boot disk loadable
sudo bless --device disk0s5 --setBoot
Apple has included system integrity Projection on OSX. To disable this restart OSX and load up the last EFI option displayed in the Apple bootloader. Navigate to Terminal and type:
Setting up X, i3wm and power management
pacman -S xorg-server xorg-server-utils pacman -S xf86-video-intel pacman -S powertop
Calibrate powertop using:
powertop --calibrate && powertop --auto-tune && sudo service powertop.service restart
Now install i3 (my favourite wm):
pacman -S i3 dmenu echo "exec i3" >> ~/.xinitrc startx