Arch ARM on Raspberry Pi 4

Arch ARM on Raspberry Pi 4

Raspberry Pi 4 uses an ARMv7 processor according to its /proc/cpuinfo file, although Wikipedia says that it is an ARM Cortex A72, which is an ARMv8 model. The v7 architecture is 32-bit architecture while the v8 is 64-bit. I don't know why they mix these two architectures, but presume that the 32-bit code can run on a 64-bit chip and point out my observations here for your awareness.

To find the Raspberry Pi 4 on the archlinuxarm.org site open Platforms, then ARMv8, the Broadcom, and you will see the Pi4 listed. The firmware for the Pi4 is, however, named

  1. Install the base O/S following the instructions at https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4
  2. Configure accounts
    1. log-in as alarm
    2. change the password
    3. log-in as root
    4. change the password
    5. create an account for yourself, including it in the wheel group or make a sudo group and put it in there.
    6. configure sudo to allow the wheel group using visudo -f /etc/sudoers.d/my.rules
  3. If you are using the Pi with a computer monitor rather than a TV, or a TV that does not require over-scanning, then insert this into /boot/config.txt to get rid of the black border:
    disable_overscan=1

Install common tools

Choose for yourself, but here's what I installed right away:

sudo su                                 ← become root first, or else type sudo before every following command
pacman -Syu
pacman -S vim rsync tmux mlocate
updatedb
pacman -S base-devel unrar unzip subversion git gpm
systemctl enable --now gpm

Install GUI desktop

pacman -S xorg xorg-fonts xorg-drivers xorg-apps xfce4 xfce4-goodies pulseaudio hunspell-en_GB firefox firefox-i18n-en-gb pavucontrol bluez python2-pybluez

In your unprivileged (normal) user account create .xinitrc to start XFCE:

vim ~/.xinitrc

exec startxfce4

X should now start with the startx command.

If you would prefer a graphical log-in then the LXDE Display Manager is a good light-weight choice:

pacman -S lxdm
systemctl enable --now lxdm

Move root file system to a USB hard disk

I have tried several SD card brands with the Pi4 and they are all really slow and give time-out errors when updating the O/S. I found that using an external USB HDD improved the speed tremendously. A USB SSD would be even faster, but those require more power. I don't want to have to upgrade my power supply, so I used a spinning HDD instead of an SSD.

It is fairly quick to do this. Here are the basic steps:

  1. Plug both the SD card and the USB HDD into a desktop computer.
  2. Do not mount the HDD. If it automounts, then you will need to unmount it before formatting.
  3. Format the HDD to have a 4GB swap partition, a 30GB root partition, and the rest you can use for the /home directory or anything else you like. Using fdisk the commands would be roughly like this, assuming your USB HDD is sdX (which it is not, so change to suit your situation):
    fdisk /dev/sdX
    o               ← write a new partition table
    n               ← create a new partition
    p               ← primary partition
    ENTER ENTER
    +4G             ← make a 4GB swap partition
    t               ← change type
    82              ← change to Linux Swap
    n               ← create a new partition
    p               ← primary partition
    ENTER ENTER
    +30G            ← make a 30GB root partition
    n               ← create a new partition
    p               ← primary partition
    ENTER ENTER ENTER (use the rest of the available space)
    t               ← change type
    8e              ← change to Linux LVM
    w               ← write changes and exit
    
  4. Format the swap space.
    mkswap /dev/sdX1
    Remember to replace X with whatever the USB drive letter is, e.g., sdb1.
  5. Format the root space
    mkfs -t ext4 -L PiRoot /dev/sdX2
    Again, replace the X as appropriate in your case.
  6. Mount the root partition, e.g.,:
    mkdir /mnt/usbhdd
    mount /dev/sdX2 /mnt/usbhdd
    Replace X with the actual drive letter.
  7. Mount the SD card, if did not auto-mount when plugged-in, e.g.:
    mkdir /mnt/sdcard
    mount /dev/mmcblkn0p1 /mnt/sdcard
    Replace mmcblkn0p1 with the actual device name, if different, e.g., on my desktop it is /dev/sdl1.
  8. Copy everything from the SD card to the HDD, e.g.,:
    rsync -av /mnt/usbhdd/* /mnt/sdcard/
  9. Change the boot config.txt file on the SD card (the boot kernel etc. must remain on the SD card):
    nano /mnt/sdcard/config.txt
    Change where it says root=/dev/mmcblkn0p2 to root=/dev/sda2 so it uses the HDD for everything other than /boot.
  10. Unmount both.
    umount /mnt/sdcard
    umount /mnt/usbhdd
  11. Plug both into the Pi and boot, see if it works! It should be much faster now.