2024-04-05 21:47:57 +02:00
---
title: Arch Linux on Raspberry Pi 5
2024-07-30 00:12:12 +02:00
tags: article guide arch linux arm raspberry pi5 nvme
2024-04-05 21:47:57 +02:00
created: 2024-04-05T18:26:55Z
published: true
---
If you already have Raspberry Pi OS running on an SD card and you want to switch to Arch Linux ARM booting from an NVMe drive with the `linux-rpi-16k` kernel, this post is for you.
## Activate NVMe
Run `lsblk` . Does it show the NVMe device `/dev/nvme0n1` ? If not, we need to append this to `/boot/firmware/config.txt` at the end:
```
dtparam=nvme
dtparam=pciex1_gen=3
```
Changes in `config.txt` need to be followed up by a reboot to see the changes.
## Wipe the NVMe SSD
Make sure you don't have any important data remaining on your SSD.
```shell
sudo umount /dev/nvme0n1p?
sudo wipefs --all --force /dev/nvme0n1p?
sudo wipefs --all --force /dev/nvme0n1
sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1024 count=1
```
## Clone the boot volume to your NVMe SSD
```shell
git clone https://github.com/geerlingguy/rpi-clone.git
cd rpi-clone
sudo cp rpi-clone rpi-clone-setup /usr/local/sbin
sudo rpi-clone nvme0n1
```
You could now boot from your NVMe SSD if all you need is Raspberry Pi OS.
This is a good timing to check if your NVMe drive works at all.
Otherwise, continue to download Arch Linux ARM.
## Clear both partitions
```shell
sudo mount /dev/nvme0n1p2 --mkdir /nvme
sudo rm -rf /nvme/*
sudo mount /dev/nvme0n1p1 --mkdir /nvme/boot
sudo rm -rf /nvme/boot/*
```
## Install Arch Linux
```shell
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
sudo apt install libarchive-tools
sudo bsdtar -xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C /nvme/
```
## Install linux-rpi-16k
For the following kernel download, change the URL to the [latest version ](https://archlinuxarm.org/packages/aarch64/linux-rpi-16k ).
```shell
wget http://mirror.archlinuxarm.org/aarch64/core/linux-rpi-16k-6.6.23-1-aarch64.pkg.tar.xz
sudo rm -rf /nvme/boot/*
sudo tar xf linux-rpi-16k-6.6.23-1-aarch64.pkg.tar.xz -C /nvme/boot/
```
## Update `/etc/fstab`
Get the `PARTUUID` from running `blkid` and edit your `/nvme/etc/fstab` accordingly:
```
PARTUUID=0b322c87-01 /boot vfat defaults 0 2
PARTUUID-0b322c87-02 / ext4 defaults,noatime 0 1
```
## Activate NVMe boot again
Add this to the end of `/nvme/boot/config.txt` :
```
dtparam=nvme
dtparam=pciex1_gen=3
```
## Update root device
Edit the `root` parameter in `/nvme/boot/cmdline.txt` :
```
root=/dev/nvme0n1p2 rw rootwait console=serial0,115200 console=tty1 fsck.repair=yes
```
## Unmount
```shell
sync
sudo umount -R /nvme
```
## Boot from NVMe
The password for `alarm` is `alarm` . You can `su -` with the password `root` to get root access.
## Repair your installation
```shell
pacman-key --init
pacman-key --populate archlinuxarm
pacman -R linux-aarch64 uboot-raspberrypi
pacman -Syu --overwrite "/boot/*" linux-rpi-16k
```
This will modify your boot config files, so you need to verify their contents again.
## Fix IPv6 connectivity
To avoid IPv6 connectivity problems later, install `networkmanager` and enable the service:
```shell
pacman -S networkmanager
systemctl enable NetworkManager
```
Now you can `reboot` .
2024-04-10 21:14:42 +02:00
## My configuration
```
OS: Arch Linux ARM aarch64
Host: Raspberry Pi 5 Model B Rev 1.0
Kernel: 6.6.25-1-rpi-16k
Packages: 251 (pacman)
Shell: fish 3.7.1
CPU: ARMv8 rev 1 (v8l) (4) @ 2.80 GHz
Memory: 191.64 MiB / 7.86 GiB (2%)
Disk (/): 3.19 GiB / 476.44 GiB (1%) - btrfs
Local IP (end0): 192.168.0.2/24 *
Locale: en_US.UTF-8
```
2024-04-05 21:47:57 +02:00
## Thank you
The information in this post is based on these amazing people:
- [Jeff Geerling ](https://jeffgeerling.com/ ) for the `rpi-clone` fork and showing how to boot from NVMe
- [Sven Kiljan ](https://kiljan.org/ ) for the steps to replace `uboot` with `linux-rpi`