[How-To] Install Arch on Raspberry Pi 5b

Guides written by the community, for the community, and only guides!

[How-To] Install Arch on Raspberry Pi 5b

Postby apokalypz » Sat Nov 04, 2023 7:36 pm

Notes:
- This method does not use premade filesystem images. It uses, more or less, the same method as the official ArchLinux Wiki.
- You MUST execute these procedures from a machine with an aarch64 Arch installation that can mount the SD card for the Raspberry Pi 5b filesystem (usually via a USB SD card reader).
- You must be root to execute these procedures. [code]su -[/code]
- You must have 'arch-install-scripts' and 'dosfstools' installed.
- This guide creates a f2fs filesystem for the root partition, thus you must also have 'f2fs-tools' installed as well. You can substitute ext4 (or maybe even btrfs, I haven't tested.).
- This guide uses the raspberry pi kernel 'linux-rpi' as opposed to the generic mainline kernel 'linux-aarch64'. I don't believe the mainline kernel has all the Raspberry Pi 5b enablement bits in it yet (though I could be wrong... I haven't tested it.)

Procedures:
1. Plug SD card into a machine running aarch64 Arch Linux Arm. (Usually via a USB SD card reader)

2. [code]fdisk /dev/sdx[/code] Where sdx is the SD card you will be writing to.
a. Type 'p' to verify this actually is the SD card you intend to write to! (We will be repartitioning/formatting this device, wiping everything from it.)
b. Type 'g' to create a new gpt partition table on the card.
c. Type 'n' to create a new partition.
d. Press 'Enter' to accept the partition number 1.
e. Type in the first sector the partition should start on. (I usually choose '65536' which represents 32MiB which is the largest sized write block I have heard an SD card use to date. Aligning to write blocks is supposed to be the most efficient way to partition a SD or eMMC.)
f. Type '+256M' for it to make the partition 256MiB in size.
g. Type 't' to set the partition type.
h. Type 'Enter' to accept the target partition 1.
i. Type '1' to set the partition type to 'EFI System'
j. Type 'n' to create a new partition
k. Type 'Enter' to accept the partition number 2.
l. Type 'Enter' to accept the default first sector the partition will start on.
m. Type 'Enter' to accept the default last sector.
n. Type 'w' to write the changes to the card.

3. Now we need to format our new partitions.
a. [code]mkfs.vfat -n BOOT -F32 /dev/sdx1[/code] To format the boot partition. Replace '/dev/sdx1' with the first partition of your SD card.
b. [code]mkfs.f2fs -l ROOT -O extra_attr,inode_checksum,sb_checksum,compression /dev/sdx2[/code] To format the root partition as f2fs. You may change the filesystem to any other filesystem type supported by the raspberry pi kernel. Replace '/dev/sdx2' with the second partition of your SD card.
c. [code]mkdir root[/code] To create the mount point for the new root partition we will be installing Arch to.
d. [code]mount -o compress_algorithm=zstd:1,compress_chksum,atgc,gc_merge,lazytime /dev/sdx2 root[/code] to mount the root partition.
e. [code]chattr -R +c root[/code] To enable compression on the root filesystem. (Note: F2FS will still allocate the uncompressed size for each file, so files won't appear smaller. This is purely for bandwidth savings and lowering write cycles.)
f. [code]mkdir root/boot[/code] To create the mount point for the boot partition.
g. [code]mount /dev/sdx1 root/boot[/code] To mount the boot partition.

4. Now the fun part, we get to install Arch to the root filesystem and the bootloader and kernel to the boot filesystem.
a. [code]pacstrap -K root base linux-rpi linux-firmware raspberrypi-bootloader firmware-raspberrypi archlinuxarm-keyring f2fs-tools dosfstools iwd openssh[/code] To install the necessary packages to boot Arch. 'iwd' is for WiFi, you may substitute this with your desired WiFi setup utility. I access my Raspberry Pi remotely, so I use 'openssh', you can omit it if you don't need ssh. Feel free to add any other packages you think you'll need.
b. [code]echo 'LABEL=BOOT /boot vfat defaults 0 0' >> root/etc/fstab[/code] To mount the boot partition on startup.
c. [code]echo 'LABEL=ROOT / f2fs defaults,compress_algorithm=zstd:1,compress_chksum,atgc,gc_merge,lazytime 0 0'[/code] To remount the root partition with the desired settings at bootup. You may also skip this and instead place the mount options in the kernel command line (root/boot/cmdline.text) as 'rootflags=<mount-options-go-here>'.
d. [code]arch-chroot root[/code] To chroot into the new installation.

5. I'm going to be lazy and just say follow the instructions from the official Arch Linux Wiki. Start at "3.3 Time", disregard "3.6 Initramfs" and stop after "3.7 Root Password":make_clickable_callback(MAGIC_URL_FULL, '
', 'https://wiki.archlinux.org/title/Installation_guide#Time', '', ' class="postlink"')

6. [code]exit[/code] To leave the chroot.

7. [code]sync && umount root/boot && umount root[/code] To unmount the SD card.

8. Plug the SD card into your shiny new Raspberry Pi 5. Plug in the HDMI, keyboard/mouse, and power. (If you dont want to plug in a monitor/keyboard/mouse, let me know if you want me to do a How-To to have the raspberry pi automatically connect to your WiFi so you can access it via SSH.)

9. Follow the instructions for setting up your user and the software environment from:make_clickable_callback(MAGIC_URL_FULL, '
', 'https://wiki.archlinux.org/title/General_recommendations', '', ' class="postlink"')
apokalypz
 
Posts: 41
Joined: Sun Apr 06, 2014 6:13 pm

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby graysky » Sun Nov 05, 2023 7:15 am

Have you tried taking the uSD card from an up-to-date RPi4B and putting it your RPi5?
graysky
Developer
 
Posts: 1731
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby apokalypz » Sun Nov 05, 2023 7:41 pm

[quote]Have you tried taking the uSD card from an up-to-date RPi4B and putting it your RPi5?[/quote]

I have not. Assuming the Pi 4B card has the linux-rpi kernel and bootloader, I don't see why it wouldn't boot.
apokalypz
 
Posts: 41
Joined: Sun Apr 06, 2014 6:13 pm

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby graysky » Sun Nov 05, 2023 8:18 pm

That is my thought too but always like to confirm.
graysky
Developer
 
Posts: 1731
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby solskogen » Mon Nov 06, 2023 11:49 am

I can confirm. That works.

Getting xorg to work, on the otherhand is another beast.
solskogen
 
Posts: 161
Joined: Mon Nov 18, 2013 10:41 am

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby solskogen » Mon Nov 06, 2023 12:28 pm

add the following to xorg.conf

Section "OutputClass"
Identifier "vc4"
MatchDriver "vc4"
Driver "modesetting"
Option "PrimaryGPU" "true"
EndSection

Then it will work (this is what Raspberry Pi OS (bookworm) does)
solskogen
 
Posts: 161
Joined: Mon Nov 18, 2013 10:41 am

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby blacklight » Fri Nov 10, 2023 4:53 pm

[quote]I have not. Assuming the Pi 4B card has the linux-rpi kernel and bootloader, I don't see why it wouldn't boot.[/quote]

Unlike the previous iteratios, the RPi5 is quite strict about its aarm64 requirements.

I have tried both with an SD card and a live USB with an armhf image, and in both the cases it fails to boot.

So keep in mind that old SD installations will work only as long as they are aarch64.
blacklight
 
Posts: 3
Joined: Tue Nov 21, 2017 11:35 pm

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby h4v0c » Mon Nov 20, 2023 1:59 pm

apokalypz: Thank you, this worked perfectly for me on my RPi5!

Have a question though: Do we have an updated video driver for aarch64 yet?
h4v0c
 
Posts: 2
Joined: Mon Nov 20, 2023 1:55 pm

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby graysky » Mon Nov 20, 2023 3:25 pm

Probably not for a few months anyway:make_clickable_callback(MAGIC_URL_FULL, ' ', 'https://www.phoronix.com/review/raspberry-pi-5-graphics', '', ' class="postlink"')

Use linux-rpi if you're running a RPi
graysky
Developer
 
Posts: 1731
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: [How-To] Install Arch on Raspberry Pi 5b

Postby h4v0c » Mon Nov 20, 2023 4:44 pm

Thank you graysky, I am using linux-rpi on my Pi 5

Works great except for gpu accel, so Hyprland won't load, but Sway is working just fine.
h4v0c
 
Posts: 2
Joined: Mon Nov 20, 2023 1:55 pm

Next

Return to Community Guides

Who is online

Users browsing this forum: No registered users and 1 guest