mike chambers | about

Creating an ArchLinux install USB stick on macOS

Friday, October 30, 2020

I have been wanting to learn a bit more about Linux, and see if it could maybe work for me as a day to day machine for general development and usage. I have some old laptops laying around that I’m not currently using, so I figured I would spend the weekend and install Linux one of them. I decided on ArchLinux as it seems to be well regarded and is bare bones, built for people who want to learn how things actually work, and want to freedom and flexibility to build and configure the exact system they want.

There is a ton of information online around working with ArchLinux. In my case, I am installing on an old MacBook Air, which can present some unique challenges. There is information on installing ArchLinux onto Macs, but some of it is years old. I decided to document my process in case anyone else wants to do something similar on Mac hardware.

The first step, which I’ll cover here, is creating an ArchLinux USB installation stick. We will use this to boot into ArchLinux and do a complete install. This post will cover how to create a bootable ArchLinux USB stick on macOS (in my case Catalina 10.15.7). All commands below are run from the Terminal.

Download ISO

First we need to download the ArchLinux installation ISO. You can grab it in a number of ways from the ArchLinux download page. In my case, I downloaded via HTTPS from a mirror in the US. My download file is:

archlinux-2020.10.01-x86_64.iso

Confirm Download File Checksum

Next, we will confirm the checksum for the file. This is optional, but ensures that the ISO was not modified by a third party. This is particularly important if downloading from a mirror. Again, this is optional, but in my case, I am doing all of this to learn more about Linux in general, so decided to go through the steps.

First, you need to download the PGP signature from the download page where you grabbed the ISO. In my case, this was a file named:

archlinux-2020.10.01-x86_64.iso.sig

Next, we will use gpg to check the file checksum:

gpg --keyserver-options auto-key-retrieve --verify archlinux-2020.10.01-x86_64.iso.sig

If you don’t have gpg installed, you can install it via brew:

brew install gpg

This may take a while depending on how long it has been since you last ran brew.

When I ran the gpg command, I got the following error:

gpg: Can't check signature: No public key

This just means you need to manually get the public key for the developer who signed the build. From the downloads page where we got the ISO, find the “PGP fingerprint” for the build. In my case that was:

PGP fingerprint: 0x9741E8AC

Next, go to the developer page, and find the developer with the matching PGP fingerprint and copy their email address (for my release it was pierre@archlinux.de). Now run the following command:

gpg --locate-keys pierre@archlinux.de

This will download the public key for the developer. You can now check the ISO signature:

gpg --keyserver-options auto-key-retrieve --verify archlinux-2020.10.01-x86_64.iso.sig

You should see output similar to:

gpg: assuming signed data in 'archlinux-2020.10.01-x86_64.iso'
gpg: Signature made Thu Oct  1 08:23:32 2020 PDT
gpg:                using RSA key 4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC
gpg: Good signature from "Pierre Schmitz <pierre@archlinux.de>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 4AA4 767B BC9C 4B1D 18AE  28B7 7F2D 434B 9741 E8AC

Don’t worry about the WARNING (more info here). We are just looking for the “Good signature” message.

At this point, we can be confident the ISO hasn’t been manipulated, and are ready to create the installation USB.

Create installation USB

I am following the Mac specific instructions for creating an install USB from here.

Insert the USB storage which you will copy the ISO to. It needs to be large enough for the ISO (1 gig should be fine).

First, lets find the USB drive you just inserted. From the terminal run:

diskutil list

This will output information on all of the drives on your system. For my system it output:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         774.0 GB   disk0s2
   3:                  Apple_HFS Install macOS Catalina  226.1 GB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +774.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD - Data     400.4 GB   disk1s1
   2:                APFS Volume Preboot                 81.6 MB    disk1s2
   3:                APFS Volume Recovery                529.0 MB   disk1s3
   4:                APFS Volume VM                      8.6 GB     disk1s4
   5:                APFS Volume Macintosh HD            11.3 GB    disk1s5

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +8.5 GB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS InstallESD              8.1 GB     disk2s2

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *8.2 GB     disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                  Apple_HFS Install macOS Mojave    7.8 GB     disk3s2

Find the USB storage you want to use, it will probably be something like:

/dev/disk3 (external, physical)

You can also confirm by looking at the name and size. In my case, it was /dev/disk3 (replace the commands below with the path for your USB storage).

Next, we need to unmount the USB stick so we can write to it:

diskutil unmountDisk /dev/disk3

Now, we can copy the ISO to the USB using dd:

dd if=archlinux-2020.10.01-x86_64.iso of=/dev/rdisk3 bs=1m

Note, replace /dev/rdisk3 with the path to your USB. Also note the ‘r’ before disk3. That tells dd to write in raw mode, which is much faster.

If you get a permission denied error, then just run via sudo

sudo dd if=archlinux-2020.10.01-x86_64.iso of=/dev/rdisk3 bs=1m

This may take a minute or two, and not give feedback. Just be patient until it completes. When its done, you should see something like:

681+0 records in
681+0 records out
714080256 bytes transferred in 139.040078 secs (5135787 bytes/sec)

You may get a message saying the disk is not readable, just ignore it. You now have a bootable USB which will boot into ArchLinux, which you can use to do a complete install.

To boot into ArchLinux installation, shutdown the machine you want to install on, insert the USB, and start the Mac while holding down the OPTION key. This will give you an optional of what to boot into (including macOS). Simply select the ArchLinux image (may say EFI Boot), and then follow instructions (I may post more on those steps in a future post).

twitter github flickr behance