Jason Thomas

I like to make stuff

January 24, 2018 @ 18:54

Setting up Arch Linux on a Raspberry Pi3

I wanted to set up a minimal Linux distro on my Raspberry Pi, so I learned to install the Arch Linux ARM distro.

The Arch wiki, as they say, is pretty thorough. However I don't want to sift through it if I don't need to, so here's some notes on the process for my benefit (and maybe yours too).


To install Arch on the Pi, do all the steps here. Most will require permissions, so I was root user.

You can check the card with cfdisk to see a prettier version of what's going on (prettier compared to fdisk).

Once you can turn the Pi on and see it via HDMI, then it's time to set up wifi.

There are other methods for connecting to wifi. Those include using netctl, which I had no luck with. I have used wpa_supplicant and dhcpcd.

So do the following and replace the words in CAPS:

wpa_passphrase WIFI_SSID KEY > /etc/wpa_supplicant/wpa_supplicant.conf

The wireless interface should be called wlan0. If it's not, I suppose you should use ip addr to see what it is.

Run this as root:

#!/usr/bin/env bash

ip link set dev wlan0 up
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlan0

The middle line arguments: -B run in background, -i interface, -c config, with your wifi details. I got these instructions from the Arch wiki.

You can run the bash file when you load your system (for when you need to download files, etc).

Make sure it works:

ping 8.8.8.8

If it's Christmas time, packets may be slow to arrive.

With the bash script, sometimes dhcpcd will set a lock. I've found that removing any .lease files helps, here:

/var/lib/dhcpcd/...

Then you can reboot your pi and the bash script should work fine.

With wifi working, you should update package list and upgrade packages, in one command:

pacman -Syu

Once your wifi is set up, you will be able to connect via other devices on the same network using the local inet address.

On the pi, do:

ip addr

That will show you the local IP address.

Assuming your Rasp Pi user name is alarm, do:

ssh alarm@ip_address

Now, you should be able to turn off the screen an interact with the Raspberry Pi via the terminal you are running SSH.

Nice-to-have stuff

I need to run gcc, and I want to use Make to compile my stuff. The easiest way to get those is to do:

pacman -S base-devel

Here's some other things I installed on my Raspberry Pi, to make my life easier:

git sudo vim

vim may seem superfluous for someone who cares about having a minimal system, but I get frustrated using vi.

I used git, gcc and Make to compile the helpful project, WiringPi. WiringPi is useful if you want to use your pins, and handles threading for you. For whatever reason, it needs permissions, so installing sudo is a good idea for this.

Did I really need to do all this?

Not really. My intention is to create a robot that runs on battery power, so having a minimal distro made sense.

I could have used Raspbian, but it comes with a lot of stuff that I don't need or won't use. I like the philosophy of Arch - give me what I absolutely need, and let me do the rest.

As to whether it does use less power, or not, I don't know because I haven't compared it. This was, in truth, just a really good excuse to try out using Arch!

log in