Skip to content

Instantly share code, notes, and snippets.

@GrumpyChunks
Last active February 2, 2024 13:37
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GrumpyChunks/11c912f40faaa6a5a3e8ee1afa40096f to your computer and use it in GitHub Desktop.
Save GrumpyChunks/11c912f40faaa6a5a3e8ee1afa40096f to your computer and use it in GitHub Desktop.
Arch Linux Installation on a mid-2015 MacBook Pro

Install Arch Linux on a mid-2015 MacBook Pro

This is based upon the LearnLinux.tv guide and this OdinsPlasmaRifle's gist

Assumptions

  • /dev/sda1 will be our EFI partition
  • /dev/sda2 will be an encryprted LVM ext4 filesystem

Installation Steps

Optionally, remove any previous EFI entries

efibootmgr
efibootmgr -b <number> -B

Configure networking using iwctl

iwctl device list
iwctl station <device> get-networks
iwctl station <device> connect <ssid>

Confirm we have networking

ip addr show

Edit Mirror list (optional) and update repo index

vim /etc/pacman.d/mirrorlist
pacman -Syyy

Indentify correct drive

fdisk -l

Partition as follows

gdisk /dev/sda
  • EFI : 500 MB, type EF00, sda1
  • root : remainder of space, type 8E00, sda2

Format partitions, set up encryption

mkfs.fat -F32 /dev/sda1
cryptsetup luksFormat /dev/sda2
cryptsetup open --type=luks /dev/sda2 lvm
pvcreate --dataalignment 1m /dev/mapper/lvm
vgcreate volgroup0 /dev/mapper/lvm
lvcreate -l 100%FREE volgroup0 -n lv_root
modprobe dm_mod
vgscan
vgchange -ay
mkfs.ext4 /dev/volgroup0/lv_root

Mount the filesystems and prepare for install

mount /dev/volgroup0/lv_root /mnt
mkdir /mnt/boot
mkdir /mnt/etc
genfstab -U -p /mnt > /mnt/etc/fstab
mount /dev/sda1 /mnt/boot

Start the install

pacstrap -i /mnt base
arch-chroot /mnt
pacman -S linux-lts linux-lts-headers vim base-devel openssh networkmanager wpa_supplicant wireless_tools netctl lvm2
systemctl enable sshd
systemctl enable NetworkManager

Allow the system to boot with an encrypted install

vim /etc/mkinitcpio.conf

Locate the "HOOKS" line (52 in my case), move "keyboard" and add "encrypt lvm2", as follows

HOOKS=(base udev autodetect modconf block keyboard encrypt lvm2 filesystems fsck)
mkinitcpio -p linux-lts

Locale and hostname

vim /etc/locale.gen

Uncomment en_GB.UTF-8

locale-gen
vim /etc/hostname

Add the hostname, e.g. fred

vim /etc/hosts

Add the localhost entry, e.g. 127.0.1.1 fred.domain fred

Users

passwd
useradd -m -g users -G wheel grumpychunks
passwd grumpychunks

pacman -S sudo
EDITOR=vim visudo

uncomment %wheel ALL=(ALL) ALL

Making the system bootable

pacman -S efibootmgr dosfstools mtools intel-ucode
bootctl --path=/boot install
vim /boot/loader/loader.conf
default arch.conf
timeout 4
console-mode auto
editor no
vim /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux-lts
initrd /intel-ucode.img
initrd /initramfs-linux-lts.img
options cryptdevice=UUID=<uuid>:cryptlvm root=/dev/volgroup0/lv_root quiet rw nomodeset

...whilst still editing in vim, we need to replace with the UUID of /dev/sda2, run the vim command

:read ! blkid /dev/sda2

Note that once the basic system is complete I found the system locked up within seconds of rebooting. I found that the addition of nomodeset as a kernel option seemed to resolve this on the MacBook Pro. However, later in the installation process, I was unable to start xorg for my desktop environment because of this, but removing the kernel option didn't cause the system to lock up again. I've yet to understand the exact cause of this, but for now this work around should help.

mkinitcpio -p linux-lts

Check the three entries in /boot/loader/entries/arch.conf exist in the /boot directory

Finalising the install

exit
umount -a
poweroff

Using poweroff is preferable to reboot, as this gives us opportunity to easily remove the installation media.

Post Installation

Networking

Connect to wifi using the following command. If run with root privileges, the connection will persist reboots.

sudo nmcli device wifi connect <ssid> password <password>

Other Software

This is where the rest of the set up is hugely subjective, but I decided to go with a KDE Plasma desktop environment on this installation. The steps to achieve this are very simple

sudo pacman -S xorg plasma-meta kde-applications
sudo systemctl enable sddm
reboot

Troubleshooting

If things go wrong during the install, you've probably missed a step above, or the Arch installer has changed slightly. To begin investigation, you need to boot from the install media, then replay the following commands (from above) to get yourself back to a workable position to start investigating the problem.

iwctl station <device> get-networks
iwctl station <device> connect <ssid>
cryptsetup open --type=luks /dev/sda2 lvm
mount /dev/volgroup0/lv_root /mnt
mount /dev/sda1 /mnt/boot
arch-chroot /mnt

Useful Links

https://wiki.archlinux.org/index.php/Installation_guide
https://wiki.archlinux.org/index.php/MacBookPro11,x
https://aur.archlinux.org/packages/linux-macbook/
https://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/
https://blog.jeaye.com/2016/06/29/encrypted-arch-linux/
https://www.lewis8s.codes/apple/linux/archlinux/macbookpro/2020/01/18/how-to-install-arch-linux-on-macbook.html
https://gist.github.com/ellipticaldoor/793606049f18dfb57e9c24d6fbe0efe4

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