Skip to content

Instantly share code, notes, and snippets.

@benhubert
Last active April 3, 2025 18:02
Show Gist options
  • Save benhubert/a08846e2247f1d2cfc748b2b156ec17a to your computer and use it in GitHub Desktop.
Save benhubert/a08846e2247f1d2cfc748b2b156ec17a to your computer and use it in GitHub Desktop.
Chat Sheet for ArchlinuxARM installation on Raspberry Pi 3

ArchlinuxARM Cheat Sheet

Default credentials:

  • alarm / alarm
  • root / root

Basic setup with btrfs

The following setup requires qemu-arm-static and arch-chroot to be installed on the system where the SD card is prepared. So, start with installing these tools:

yay -S qemu-user-static-bin arch-install-scripts

All the following commands require root permissions, so it might be a good idea to start with sudo -s.

  1. Find your sdcard with lsblk and start fdisk to partition the SD card:

     fdisk /dev/sdX
    
  2. At the fdisk prompt, delete old partitions and create a new one:

    • Type o. This will clear out any partitions on the drive.
    • Type p to list partitions. There should be no partitions left.
    • Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
    • Type t, then c to set the first partition to type W95 FAT32 (LBA).
    • 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.
  3. Create and mount the boot partition:

     mkfs.vfat /dev/sdX1
     mkdir boot
     mount /dev/sdX1 boot
    
  4. Create and mount the root partition:

     mkfs.btrfs /dev/sdX2
     mkdir root
     mount /dev/sdX2 root
     btrfs subvolume create root/root
    
  5. Download and extract the root filesystem:

     wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-3-latest.tar.gz
     bsdtar -xpf ArchLinuxARM-rpi-3-latest.tar.gz -C root/root
     sync
    

(ignore the "Failed to set file flags" messages)

  1. Move boot files to the first partition:

     mv root/root/boot/* boot/
     sync
     umount boot root
    
  2. chroot to the SD card and update the system:

     mount -o subvol=root,autodefrag,ssd /dev/sdX2 root
     mount /dev/sdX1 root/boot
     cp /usr/bin/qemu-arm-static root/usr/bin
     arch-chroot root /bin/bash
    

    Continue with the steps below and exit chroot afterwards using:

     exit
     umount root/boot root
    
  3. Initialize and update the system:

     pacman-key --init
     pacman-key --populate archlinuxarm
     pacman -Syu
    
  4. Install btrfs driver and register the btrfs partition as root:

     pacman -S btrfs-progs uboot-tools
    

    Add the following options to the bootargs line in /boot/boot.txt:

     rootflags=subvol=root,autodefrag,ssd
    

    Recompile the boot configuration:

     cd /boot
     ./mkscr
    
  5. I usually use ansible to install all the rest. This requires python 2:

    pacman -S python2
    

Reduce requirements for video output

echo "gpu_mem=16" >> /boot/config.txt
echo "hdmi_safe=1" >> /boot/config.txt

Disable wifi

echo "dtoverlay=pi3-disable-wifi" >> /boot/config.txt

Configure a fixed IP

Write the following lines to /etc/systemd/network/20-wired.network

[Match]
Name=enp1s0

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
DNS=10.1.10.1
#DNS=8.8.8.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment