| README.md | ||
Installing Arch Linux on a 2017 Macbook Air
Install instructions for Macbook Air OSX and Arch side by side
Getting Started
Before starting you should have some knowledge of partitioning and Arch Linux. Also, I'd like to note that, more than likely, the wireless card in your Macbook Air will not be detected by the Arch boot disk (or most other distros). With that being said, you will need a USB-to-Ethernet adapter. I like this one.
Items needed for install:
- Internet connection
- USB-to-Ethernet Adapter
- USB flash drive for the bootable .dmg (covered later)
Install Instructions
- You will first need to resize your MacOS partition. You can do this using the Mac Disk Utility. If you are using APFS(Encrypted), you will be required to reinstall MacOS first, since the encrypted file system will not allow a resize.
- Turn off System Integrity Protection (SIP).
- Restart your MacOS
- Before it starts, press and hold
Command+R - Select
Terminalfrom theUtilitymenu - In the terminal, enter
csrutil disable - You should see a message similar to
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect. - Reboot your machine
- Download and install rEFInd.
- Download the zip
- Extract to a folder
- In
Terminalenter the directory that was extracted - Run the command
sudo ./refind-install
- Download the current Arch Linux iso.
- Convert
archlinux-20xx.xx.xx-x86_64.isoto.dmgformat.
hdiutil convert -format UDRW -o archlinux-20xx.xx.xx-x86_64.iso arch-converted.dmg
- Write the
arch-converted.dmgto a USB flash drive.
- In a terminal, enter
diskutil list - Identify your USB drive. In my case it was
/dev/disk2 - Once you have identified the disk, enter
diskutil unmountDisk /dev/disk2(replace disk2 with your USB drive) - Once unmounted, enter
sudo dd if=arch-converted.dmg of=/dev/rdisk2 bs=1m(use anrbefore disk to access the raw drive)
- Boot to USB drive.
- Power down your Macbook
- Insert your USB-to-Ethernet Adapter
- Power on, press and hold the
Alt/Optionkey - On the UEFI selection menu, select your boot USB drive
- Verify network connectivity.
- Verify adapter appears and has connetivity. Enter
ip addr - If DHCP has not started on the NIC enter
systemctl start dhcpcd@INTERFACE, whereINTERFACEis the NIC name. - Ping Google to verify internet connection. Enter
ping 8.8.8.8
- List devices and format unused partition.
- Enter
fdisk -lto list the disks - Enter
sgdisk -n 0:0:0 -t 0:8300 -c 0:"data" /dev/sda3(This assumes the partition you created is on devicesdaand is partition3) - Inform OS of partition changes by entering
partprobe /dev/sda(If device is notsda, enter correct device name) - Make the filesystem format using
mkfs.ext4 /dev/sda3
- Mount the newly created partition.
mount /dev/sda3 /mnt
- Create a swap file.
- Create the file:
dd if=/dev/zero of=/mnt/swapfile bs=1M count=2048(Change count to how big you would like it. I have it set to be 2GB) - Change permissions on the file:
chmod 600 /mnt/swapfile - Inform OS to use as swap:
mkswap /mnt/swapfile
- Perform initial install of Arch to mounted volume.
pacstrap /mnt base base-devel grub-efi-x86_64 linux-headers broadcom-wl-dkms wpa_supplicant dialog vim git reflector
- Generate the
/etc/fstab.
genfstab -pU /mnt >> /mnt/etc/fstabecho 'tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0' >> /mnt/etc/fstabecho '/swapfile none swap defaults 0 0' >> /mnt/etc/fstab
- Enter the fresh installed Arch system.
arch-chroot /mnt /bin/bash
- Initialize the
pacman-key.
pacman-key --initpacman-key --populate archlinux
- Update timezone information.
rm /etc/localtimeln -s /usr/share/zoneinfo/America/Chicago /etc/localtimehwclock --systohc --utc
- Set hostname.
echo MYHOSTNAME > /etc/hostname
- Set your locale.
sed -i 's:#en_US.UTF-8 UTF-8:en_US.UTF-8 UTF-8:g' /etc/locale.genlocale-genecho LANG=en_US.UTF-8 >> /etc/locale.confecho LANGUAGE=en_US.UTF-8 >> /etc/locale.confecho LC_ALL=en_US.UTF-8 >> /etc/locale.conf
- Set
rootuser password.
passwd
- Allow
wheelgroup insudoersfile.
sed -i '/%wheel ALL=(ALL) ALL/c\%wheel ALL=(ALL) ALL' /etc/sudoers
- Add user and set password.
useradd -m -g users -G wheel $MYUSERNAMEpasswd $MYUSERNAME
- Add
ext4to/etc/mkinitcpio.conf.
sed -i '/^MODULES=/c\MODULES=(ext4)' /etc/mkinitcpio.conf
- Regenerate the initrd image.
mkinitcpio -p linux
- Edit
/etc/default/grub
- Modify line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet libata.force=1:noncq" - Add line:
GRUB_DISABLE_SUBMENU=y
- Make
grub.cfgand standaloneboot.efifile.
grub-mkconfig -o boot/grub/grub.cfggrub-mkstandalone -o arch.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
- Mount EFI partition and create. (assuming partition /dev/sda1)
mkdir -p /mnt/EFImount /dev/sda1 /mnt/EFImkdir -p /mnt/EFI/archcp /arch.efi /mnt/EFI/arch/arch.efi
- Exit chroot and reboot.
exitreboot
- You should now be greeted with the rEFInd boot loader, and see an option for your Arch Linux partition.
Change F1-F12 Keys to Not Require FN Keypress
To set this temporarily (in your current session only), use the following command:
echo "2" | sudo tee /sys/module/hid_apple/parameters/fnmode
To set this permanently (starts on next boot), use the following command:
echo "options hid_apple fnmode=2" | sudo tee /etc/modprobe.d/hid_apple.conf
Install Yay AUR Helper and Pacman Wrapper (https://github.com/Jguer/yay)
-
Create a directory for the yay PKGBUILD files and enter it.
mkdir ~/yaycd ~/yay -
Download yay PKGBUILD from AUR.
wget --no-check-certificate https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay --output-document=./PKGBUILD -
Run
makepkgto build and install yay.makepkg -si -
You can now install packages from the Arch User Repository using a similar command:
yay -S google-chrome
Shutdown Messages
-
If you receive a message similar to
A stop job is running for Session c2 of user xx, you can decrease the timeout from 90 seconds (default) in the following config file:/etc/systemd/system.confUncomment and change time on line:
DefaultTimeoutStartSec=10sUncomment and change time on line:
DefaultTimeoutStopSec=10s -
If you receive a bunch of messages similar to
Failed to remount '/oldroot/sys/fs/cgroup/pids'orRemounting '/oldroot/sys/fs/cgroup/pids', you can hide these by addingshutdowntoHOOKSin the/etc/mkinitcpio.conffile. Then rebuild theinitrdimage.sudo mkinitcpio -p linux