Create: 2022-06-24, Update: 2023-05-27
This post is a step-by-step guide of installing Arch Linux on Raspberry Pi.
The post is based on the guide on Arch Linux ARM official website. What separate this post and the official guide is that, it only focuses on the new Raspberry Pi 4 model and a 64-bit OS. Readers following this guide does not need to make decision about whether a command is for your machine. You can braindeadly copy and paste and everything should work.
Be careful, most of the commands here require root permission. You can
either switch to a super user (if you know what you are doing), or you
An SD card is a must to boot into your Pi, since making the Pi boots from USB requires extra tinkering.
This is not true for installing Raspberry Pi OS, (formerly called Raspbian), the official OS can be booted from USB.
Since the Pi requires a boot partition of FAT32, we have to manually make a boot partition.
The following is directly from the Arch Linux ARM website.
Connect your SD card to your machine, I am on an Artix Linux machine and using a 128GB sandisk extreme pro.
According to this gist, If you are on a Mac, be careful that the built-in SD card slot may not be able to perform partitioning. An external SD card reader is needed. I did try on my M1 MacBook Pro, but not only the built-in SD card reader didn't work, the external one also did not work. It gave an error related to missing i386 library. This may be because of the ARM nature of Apple silicon.
After you have connected your SD card.
Find out your device using
Assume my device is at /dev/sdb. Use fdisk.
These steps are directly from the official guide.
Type o. This will purge any partitions on the drive.
Type p to list partitions. To check if any partition is still present.
To create the boot partition: Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +512M for the last sector.
Type t, then c to set the first partition to type W95 FAT32 (LBA).
To create the root partition: Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
Write the partition table and exit by typing w.
In the original guide, the size for the boot partition is 200M, but since I have a lot of space, I allocated 512M in case something is wrong. Normally, 200M is quite over-kill. However, I notice that some guides floating on the Internet, especially those of content farms, use 100M for boot partition. Do NOT do this. 100M is not enough for Arch Linux ARM.
In a whatever directory, (I personally create a folder called raspberrypi), create a boot and a root directory. These are for mounting the SD card.
Some people prefers mounting the SD card in /mnt, I normally would do that to any other devices. However, since the SD card of Pi is likely to be a single use case. Creating directories in /mnt does not feel right to me.
mount /dev/sdb1 ./boot
mount /dev/sdb2 ./root
The extract command,
bsdtar must be prefixed with
sudo or run by
root, otherwise, your image is not usable.
bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root
The sync command takes a lot of time, be patient. (This is just for safety only, if you are bold enough, you can skip the sync command.)
mv ./root/boot/* ./boot
sed -i 's/mmcblk0/mmcblk1/g' ./root/etc/fstab
You can also open the fstab with a text editor and change "mmcblk0" to "mmcblk1".
umount boot root
If you are plugging an ethernet cable into your Pi. You can check out the ip of the Pi in your router interface.
The default password for user "alarm" is "alarm", for "root" is "root".
You can ssh into your Pi and start setting up things as a headless machine.
But if you are using Wifi, things get a bit complicated.
To connect to Wifi, we need to have
which have already been installed in the image. (For a braindead
solution, you can find a way to install networkmanager.)
You can't do it in a headless way. Plug in the monitor and keyboard. And boot into your Pi.
wpa_passphrase "ssid" "passpharse" > /etc/wpa_supplicant/wpa_supplicant.conf
In /etc/wpa/wpa, the network session is
already generated by the previous command. Add other lines on top if
you want to use
wpa_supplicant command to connect to Wifi. You can
omit this part if you only use service daemon.
# Giving configuration update rights to wpa_cli
# AP scanning
# ISO/IEC alpha2 country code in which the device is operating
# network section generated by wpa_passphrase
The default init system for Arch Linux ARM is systemd. Start the
systemctl enable wpa_supplicant
systemctl enable dhcpcd
The service will automatically start.
To check if you have connected to the Internet, check if the wlan0 part has an ip address.
In case you want to have a static local ip for the ease of connecting from other machine.
In /etc/dhcpcd.conf, add these to the bottom and restart the
static domain_name_servers=192.168.0.1 18.104.22.168
systemctl restart dhcpcd
After all, you can unplug you monitor and keyboard and use the Pi as a headless machine.
If you don't bother to check the ip of your Pi every time you want to
connect to it. (Every restart may change the local ip.) You can setup
avahi, for more, see Arch Wiki.
Install the keychain.
pacman-key --populate archlinuxarm
Update the package repo. Always use -Syyu on your first update to force the update of the repo database.
You can also set up parallel downloads for pacman to speed up package updates.
In /etc/pacman.conf, uncomment this.
ParallelDownloads = 5
I have a very fast Internet, I always set it to 10.
Installing Arch Linux ARM on a Raspberry Pi is not difficult, but there are always some little things that fuck up the installation or usage. A lot of them comes from the ownership issue when copying or extracting from the image.
For example, the
sudo command in the Pi may be broken. Giving an
error like "/usr/bin/sudo must be owned by uid 0 and have the setuid
This can be easily fixed using:
chmod 4755 /usr/bin/sudo
If you encounter an error, don't panic. Copy and paste the error to the search engine, some other guys might have faced the same frustration with you a long time ago, and had the balls to ask on the Internet.
Most of the error can be fixed by a simple search. Re-read my post detailedly to see if anything is missing. I am not a Linux wizard, if I can do it, you can do it.