Other posts in this series:
- Part 1: Base Installation
- Part 2: Adding an Unprivileged User
- Part 3: XOrg and the i3 Window Manager
- Part 4: DPI and Terminal Font
- Part 5: Configuring the Keyboard
- Part 6: Configuring the Touchpad
- Part 7: Getting Comfortable
Create a Partition
This is easiest done with OSX in the Disk Utility app. Create a new partition. I did 60GB. You’ll wind up deleting it later, so it does not matter how you format it.
Create the Bootable USB Stick
Download the latest Arch Linux ISO and and follow this guide to turn it in to a bootable USB stick. Hold down the option key while rebooting to boot from it. When prompted, choose “Arch Linux archiso x86_64 UEFI CD”.
Keyboard Layout and Font
You’ll be dropped in to a zsh shell as root. If needed, to change the keyboard layout, run something like:
You’ll also probably want to change the font given the high pixel density of the Retina display:
Wifi for Installation
First you’ll need to get a copy of Broadcom’s wireless firmware on a USB stick. If you happen to have docker running, this post explains one way to do that.
I’ll assume you have a USB stick containing the all of the firmware files (*.fw) inside the /b43 directory. Insert the USB stick, and use lsblk to identify which device has been assigned to it:
Use the size to match it up. For me it’s /dev/sdc1. (Be sure to always check, as these can change between boots.) Mount the disk under /mnt, copy the firmware to /lib/firmware, and unmount it:
mount /dev/sdc1 /mnt cp -r /mnt/b43 /lib/firmware/b43 umount /mnt
Then reload the b43 module:
modprobe -rv b43 # unload modprobe -v b43 # load
You should now be able to use wifi-menu to configure your wifi network:
After selecting the network, wifi-menu will prompt you for a name for the new profile. I generally accept what it suggests.
Try pinging something. Your network connection should now be working.
Pacman Mirror List
The /etc/pacman.d/mirrorlist contains a list of all mirror sites that pacman (Arch’s package manager) can query when installing packages.
Each server entry is preceeded by a comment identifying the country and score. Lower scores are better. Cut and paste some of better (lower) scoring servers from your country and put them on the top of the list.
Format and Pacstrap
Make sure you know what you are doing here. Most importantly, make 100% sure you know the device file corresponding to the partition onto which you intend to install Arch Linux. If you guess wrong, you will lose data that you probably wanted to keep.
Again, use the lsblk command. Identify the device file by its size. For example, in my case, that is /dev/sda3:
Format the Arch partition using ext4:
mkfs -t ext4 /dev/sda3
Mount it and run pacstrap to install the base packages. The base group contains the essentials, base-devel contains developer tools, and wpa_supplicant is required for wifi:
mount /dev/sda3 /mnt pacstrap /dev/sda3 base base-devel wpa_supplicant
Generate an fstab so that the new partition is mounted on boot:
genfstab -p /mnt >> /mnt/etc/fstab
Set your computer’s hostname, for instance, “macbook”:
echo macbook > /mnt/etc/hostname
And the local timezone, e.g.:
arch-chroot /mnt ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Uncomment needed locales in /etc/locale.gen (on my machine, I uncomment en_US.UTF-8 and en_US.ISO-8559-1) and generate them:
arch-chroot /mnt locale-gen
And set the system-wide locale to your preference in /etc/locale.conf:
echo LANG=en_US.UTF-8 > /mnt/etc/locale.conf
Wifi for Post Installation
Again, you’ll need to mount your USB stick with the Broadcom firmware on it so we can copy it. However, the new Arch partitition is already mounted at /mnt, so we’ll neet to create a temporary mount point for it:
mkdir /fw mount /dev/sdc1 /fw cp -r /fw/b43 /mnt/lib/firmware
Then, configure systemd to start it automatically. Recall the name of the profile you set up with wifi-menu. In my case, that is wlp4s0-Chad. You can see it here:
Copy that file to the new partition:
cp /etc/netctl /mnt/etc/netctl
And configure systemd to start it on boot:
arch-chroot /mnt netctl enable wlp4s0-Chad.
Disclaimer: I don’t fully understand what is going on here, but through some hours of studying, trial and error, this is what has worked the cleanest for me.
Create a RAM disk for booting. This will generate /boot/initramfs-linux.img:
arch-chroot /mnt mkinitcpio -p linux
Create a temporary mount point and mount your EFI partition. The EFI partition should be the first partition on your disk and will be exactly 200MB. Use lsblk to identify it:
In my case, it is /etc/sda1. Mount it:
mkdir /efi mount /dev/sda1 /efi
gummiboot --path=/efi install
And then create a loader file for Arch. Assuming /dev/sda3 is your Arch partition:
UUID=`blkid -s PARTUUID -o value /dev/sda3` cat <<-END > /efi/loader/entries/arch.conf title Arch Linux linux /vmlinuz-linux initrd /initramfs-linux.img options root=PARTUUID=$UUID END
The paths to /vmlinuz-linux and /initramfs-linux.img refer to the EFI partition, so you will need to copy them from /mnt/boot:
cp /mnt/boot/* /efi
With that you should be able to reboot into a fresh Arch Linux install. You may have to hold down option while booting so that you can select the new partition.