Installing Arch Linux on Raspberry Pi
This is an expanded version of This Script which is better for advanced users
Setup
[edit]Unfortunately installing Arch Linux isn't as easy as Raspbian or Kali. We need a linux environment and start by partitioning the Micro SD card
fdisk /dev/sdX
- First Partition +150M type 'c' for W95 FAT32 (LBA)
- Second Partition the rest and defaults are fine
- Write to disk with 'w'
Next we need to format the drives
mkfs.vfat /dev/sdx1 mkfs.ext4 /dev/sdx2
Let's move to our working dir and mount the partitions
cd /mnt/ mkdir boot/ mkdir root/ mount /dev/sdx1 boot/ mount /dev/sdx2 root/
Depending upon which version of Raspberry Pi your target system is, you'll need to make a choice:
# Raspberry Pi 4 or 3 Aarch64 (64bit) wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz # Raspberry Pi 4 - ARMv7 (32bit) wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz # Raspberry Pi 3 and 2 - ARMv7 (32bit) wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz # Raspberry Pi 1 and 0 - ARMv6 wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
Now to unpack onto the SD Card
bsdtar -xpf ArchLinuxARM-rpi-$version-latest.tar.gz -C root sync
Just one last thing here, this is also the best time to make edits to config.txt
mv root/boot/* boot nano boot/config.txt unmount boot root
First Boot
[edit]Default User Info:
alarm - alarm root - root
If you have ethernet connected, you are good to go out of the box practically. For Wireless connectivity, it's pretty simple. Find and connect to your wireless and make a simple name for it in wifi-menu
wifi-menu netctl enable wlan0-home
Let's initialize pacman and get up to date. SSH is usually started, so once connected you can manage from there.
sed -i 's/#Color/Color/' /etc/pacman.conf pacman-key --init pacman-key --populate archlinuxarm pacman -Syu sudo
Localization and hostname
rm /etc/localtime ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime echo 'newhostname' > /etc/hostname
Modify sudoers and create a new user and cleanup the old one.
nano /etc/sudoers # Uncomment %wheel ALL=(ALL) ALL useradd -m -G wheel -s /bin/bash newuser passwd newuser passwd userdel alarm #May need to reboot and login with newuser first if a process is being used
Stuff We Need
[edit]Now that we're up and running, it's time to get the important stuff
Yay
[edit]The latest and greatest, now that Yaourt is on the outs
pacman -S git base-devel go git clone https://aur.archlinux.org/yay.git cd yay makepkg -si
Graphical Environment
[edit]Xorg
[edit]You need all this, I assure you, then choose XFCE or LXDE
pacman -S xorg xf86-video-fbturbo xf86-video-fbturbo-git xorg-xinit
XFCE
[edit]XFCE is my usual go-to, it's light and configurable and gets the job done.
pacman -S xfce4 xfce4-goodies
LXDE
[edit]LXDE is one I'm intrigued on trying out
pacman -S lxde
SDDM/LDDE
[edit]SDDM is the best login manager, basically
pacman -S sddm #or lxde systemctl enable sddm
Let's create a default config and modify it
sudo sh -c "sddm --example-config > /etc/sddm.conf" sudo nano /etc/sddm.conf
We'll modify autologin for our user and desktop. Available session types are in /usr/share/xsessions/
[autologin] Session=xfce.desktop User=user
And finally, let's ensure stuff starts appropriately
echo 'exec startlxde' > ~/.xinitrc echo 'exec startxfce' > ~/.xinitrc
Bugs and Fixes
[edit]Pacman has been finicky on AArch64 for some reason, traced it down to
systemctl stop systemctl-resolved.service
Manjaro
[edit]And just in case you want all of the Arch and none of the pain, there's Manjaro Pi4 XFCE
References
[edit]- Arch Linux ARM RPi4, RPi 3, RPi 2, RPi 1
- Wikipedia
- Helpful guide from github
- ArchlinuxArm Repo (mirror)