-dnl -*- html -*-
-define(__title, `Arch GNU/Linux on MacBook Air 2013')dnl
-define(__pub, 2016-11-01T12:00:00Z)dnl
-define(__upd, 2020-03-27T12:00:00Z)dnl
-define(__id, 1)dnl
-include(header.html)dnl
-
-<p>This post summarizes how I install and dual-boot Arch GNU/Linux
-with Full-Disk Encryption alongside macOS. It is not meant to be a
-replacement for the
-<a href="https://wiki.archlinux.org/index.php/installation%5Fguide">Installation
-Guide</a> or the former
-<a href="https://csdietz.github.io/arch-beginner-guide/">Beginner's
-Guide</a>. Rather, it mostly serves as a small summary with a few
-useful notes about the gotchas.</p>
-
-<p>So, make sure you understand what you type into your terminal. If
-you don't, checking out the Arch wiki should probably be your first
-step.</p>
-
-<p><em>Note:</em> you will need internet access throughout the
-installation and the MacBook Air's WiFi doesn't work out of the box on
-Arch. I recommend using an Ethernet-USB adapter or your phone's USB
-Tethering feature (if it does support it).</p>
-
-<h2>Shrinking the macOS partition</h2>
-<p>The first step I take is resizing the HFS+ macOS partition to make
-room for the new GNU/Linux installation. There are plenty of
-tutorials on how to do this using macOS's Disk Utility, so do that and
-then come back!</p>
-
-<h2>Creating a bootable Arch Installer USB</h2>
-<p>There are different ways of creating a bootable Arch USB, all
-documented on the
-<a href="https://wiki.archlinux.org/index.php/USB%5Fflash%5Finstallation%5Fmedia">USB
-flash installation media</a> page on the Arch wiki, but the simplest
-one is using <code>dd</code> if you already have access to another
-UNIX system.</p>
-
-<p><strong class="warn">Warning:</strong> make sure you backup the
-data on your flash drive, as <code>dd</code> will irrevocably destroy
-all data on it.</p>
-
-<p>Use <code>lsblk</code> to find the name (block device) of your USB drive, then
-run <code>dd</code> (as root) as shown below:</p>
-
-<pre>
-dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync
-</pre>
-
-<p>Replace <code>/path/to/archlinux.iso</code> with the path to the
-Arch image you have downloaded, and <code>/dev/sdx</code> with your
-drive.</p>
-
-<h2>Booting up from the USB</h2>
-<p>After creating the install USB, reboot your laptop and hold the alt
-key and boot from the USB.</p>
-
-<p>When booting is complete and you're presented with the prompt, it's
-a good time to make sure you're connected to the internet (see the
-<em>note</em> at the top of this post).</p>
-
-<p>Use <code>ping</code> to verify that you have established a
-connection:</p>
-
-<pre>
-ping archlinux.org
-</pre>
-
-<h2>Updating the system clock</h2>
-<p>Once you're connected to the internet, make sure the system clock
-is accurate:</p>
-
-<pre>
-timedatectl set-ntp true # start and enable systemd-timesyncd
-</pre>
-
-<p>You can check the service status using <code>timedatectl
-status</code>.</p>
-
-<h2>Partitioning</h2>
-<p>I won't dive into partitioning and instead, I will refer you to the
-<a href="https://wiki.archlinux.org/index.php/Partitioning">Partitioning</a>
-page of Arch wiki. Of the available partitioning tools, I personally
-prefer <code>cfdisk</code>.</p>
-
-<h2>Setting up LVM & LUKS</h2>
-<p>I use an
-<a href="https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting%5Fan%5Fentire%5Fsystem#LVM%5Fon%5FLUKS">LVM
-on LUKS</a> setup, where I set up LVM on top of the encrypted
-partition.</p>
-
-<p>First, let's set up the underlying encrypted partition:</p>
-
-<pre>
-cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 \
- --iter-time 5000 --use-urandom -y luksFormat /dev/sdaX
-</pre>
-
-<p>where <code>/dev/sdaX</code> is the partition you created in the
-last step (e.g. <code>/dev/sda4</code>). For more information about
-the <code>cryptsetup</code> options, see the
-<a href="https://wiki.archlinux.org/index.php/Dm-crypt/Device%5Fencryption#Encryption%5Foptions%5Ffor%5FLUKS%5Fmode">LUKS
-encryption options</a>.</p>
-
-<p>Then we open the container:</p>
-
-<pre>
-cryptsetup open --type luks /dev/sdaX lvm
-</pre>
-
-<p>Now it's time to use lvm and prepare the logical volume(s):</p>
-
-<pre>
-pvcreate /dev/mapper/lvm vgcreate vg /dev/mapper/lvm
-lvcreate --extents +100%FREE -n root vg
-</pre>
-
-<p>This will create a physical volume on the mapping we just opened,
-create a volume group named <code>vg</code> on the physical volume,
-and create a logical volume named <code>root</code> that spans the
-entire volume group. More complex setups are possible thanks to the
-great flexibility of lvm.</p>
-
-<p>We now format the logical volume with <code>ext4</code>:</p>
-
-<pre>
-mkfs.ext4 /dev/mapper/vg-root
-</pre>
-
-<h2>Installing the base system</h2>
-<p>Let's mount the logical volume, make a directory for the mount
-point of the boot partition, and mount the boot partition
-(<code>/dev/sda1</code>):</p>
-
-<pre>
-mount /dev/mapper/vg-root /mnt
-mkdir /mnt/boot
-mount /dev/sda1 /mnt/boot
-</pre>
-
-<p>Finally, let's install the base system (and optionally
-<code>base-devel</code>):</p>
-
-<pre>
-pacstrap /mnt base base-devel
-</pre>
-
-<h2>Configuring the system</h2>
-<p>Let's generate the fstab:</p>
-
-<pre>
-genfstab -U /mnt >> /mnt/etc/fstab
-</pre>
-
-<p>Use your favorite terminal-based editor, edit the fstab file and
-add the <code>discard</code> option for the root partition to enable
-TRIM on the SSD.</p>
-
-<p>Now we change root into our newly installed system and will
-configure it. Adjust these according to your own setup.</p>
-
-<pre>
-arch-chroot /mnt /bin/bash
-passwd # set the root password
-echo myhostname > /etc/hostname # set the hostname
-ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime # time zone
-hwclock --systohc --utc # write system clock to hardware clock (UTC)
-useradd -m -G wheel -s /bin/bash myuser # create myuser
-passwd myuser # set the password for myuser
-echo "myuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/myuser
-# uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen
-locale-gen
-echo LANG=en_US.UTF-8 > /etc/locale.conf
-export LANG=en_US.UTF-8
-</pre>
-
-<p>Then adjust the initramfs hooks in
-<code>/etc/mkinitcpio.conf</code> and enable the
-<code>encrypt</code> and <code>lvm2</code> hooks, and make sure
-<code>keyboard</code> is available before <code>encrypt</code> so you
-can actually type in the LUKS password when booting. Your
-<code>HOOKS</code> line should look similar to this:</p>
-
-<pre>
-HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)
-</pre>
-
-<p>After adjusting the hooks, build the initramfs:</p>
-
-<pre>
-mkinitcpio -p linux
-</pre>
-
-<p>Create the <code>/boot/loader/loader.conf</code> with the following
-content (adjust the timeout to your liking):</p>
-
-<pre>
-default arch timeout 3
-</pre>
-
-<p>Then create the entry for Arch:</p>
-
-<pre>
-mkdir -p /boot/loader/entries
-touch /boot/loader/entries/arch.conf
-</pre>
-
-<p>Now edit <code>/boot/loader/entries/arch.conf</code> to specify the
-Arch entry:</p>
-
-<pre>
-title Arch GNU/Linux
-linux /vmlinuz-linux
-initrd /intel-ucode.img
-initrd /initramfs-linux.img
-options cryptdevice=/dev/sdaX:vg:allow-discards root=/dev/mapper/vg-root rw
-</pre>
-
-<p>Again, <code>/dev/sdaX</code> is the partition you created in the
-partitioning step earlier as the underlying encrypted partition.</p>
-
-<p>Finally, install the bootloader, exit the chroot, umount and
-reboot!</p>
-
-<pre>
-bootctl install
-exit
-umount -R /mnt
-reboot
-</pre>
-
-<h2>Post-installation recommendations</h2>
-<p>Congratulations! You now have a minimal Arch installation.</p>
-
-<p>At this point, I usually install my favorite AUR helper,
-<a href="https://aur.archlinux.org/packages/pacaur/">pacaur</a>, then
-I install the
-<a href="https://aur.archlinux.org/packages/mba6x%5Fbl-dkms/">mba6x_bl-dkms</a>
-backlight driver to fix the post suspend/resume issue where there's no
-brightness after waking up from suspend, and the only available
-brightness would be 100%.</p>
-
-<pre>
-pacaur -S linux-headers dkms # linux-headers is required for dkms
-pacaur -S broadcom-wl-dkms
-pacaur -S mba6x_bl-dkms
-</pre>
-
-<p>Then, I'd like to install</p>
-<ul>
-<li>input, graphics, and sound drivers,</li>
-<li>a desktop environment (I prefer Xfce or LXQt),</li>
-<li>a display manager for login screen (lightdm or sddm), and</li>
-<li>a network manager (NetworkManager or ConnMan).</li>
-</ul>
-
-<p>Check out the
-<a href="https://wiki.archlinux.org/index.php/General%5Frecommendations">General
-recommendations</a> for more details.</p>
-
-<h2>References</h2>
-<p>Here are some resources I've come across each with lots of useful
-bits and pieces, about installing Arch on a MacBook:</p>
-
-<ul>
-<li><a href="https://github.com/pandeiro/arch-on-air">pandeiro/arch-on-air</a></li>
-<li><a href="https://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/">Arch Linux on MacBook Pro Retina 2014 with DM-Crypt, LVM and suspend to disk</a></li>
-<li><a href="https://www.frankshin.com/2014/installing-archlinux-on-macbook-air-2013/">Installing Archlinux on Macbook Air 2013</a></li>
-<li><a href="http://panks.me/posts/2013/06/arch-linux-installation-with-os-x-on-macbook-air-dual-boot/">Arch Linux Installation with OS X on Macbook Air (Dual Boot)</a></li>
-<li><a href="https://alexeyzabelin.com/arch-on-mac">Installing Arch Linux on a MacBook Air 2013</a></li>
-<li><a href="https://medium.com/phils-thought-bubble-of-recent-stuff/arch-linux-running-on-my-macbook-2ea525ebefe3">Arch Linux running on my MacBook</a></li>
-<li><a href="http://codylittlewood.com/arch-linux-on-macbook-pro-installation/">Dual boot Arch Linux on MacBook Pro Installation</a></li>
-</ul>
-
-define(__copy, `2016, 2019, 2020')dnl
-include(footer.html)dnl