Raspberry Pi - Arch Linux Install Notes

From Wiki³

Image SD Card

Download and image your SD Card with the image located at Arch Linux ARM.

Linux

dd bs=1M if=/path/to/archlinux-hf-2013-07-22.img of=/dev/sdX

Windows

Download and install Win32DiskImager.

Initial Boot & Configuration

System Update

First we need to update the system to make sure everything is current. Login to the system using the root account with the default password of root and run pacman to update the system. After this it is safe to reboot to enact the changes.

pacman -Syu

systemctl reboot

Now that the system is up to date we can install packer and update the RPi firmware/kernel to the latest version. In addition to this we will be installing arm-mem which are ARM-accelerated versions of selected functions from string.h. Then again reboot the machine to enact the changes.

pacman -S packer arm-mem-git linux-headers-raspberrypi-latest linux-raspberrypi-latest vim

systemctl reboot

Configuration

Upon login you should be able to see that you are now running the latest available kernel version. I now take the time to setup the actual system itself as if you just rebooted into a fresh Arch Linux installation.

Hostname

Begin by setting the hostname. I will be using the hostname archey.

hostnamectl set-hostname archey

Timezone

Set the timezone. For me this is US/Pacific.

timedatectl set-timezone US/Pacific

Locale

Setup the appropriate locale. First edit the /etc/locale.gen file and un-comment the lines that correspond to your language selection. Generate the needed locales, set you keymap and finally set the with the system.

vim /etc/locale.gen

Iconen_US ISO-8859-1 en_US.UTF-8

locale-gen

localectl set-keymap us

localectl set-locale LANG="en_US.UTF-8"

Time/Date Syncing

Finally we can install and enable ntp. This is not required but as the RPi does not have a hardware clock it is useful to use a time syncing service.

pacman -S ntp

systemctl enable ntpd

User Management

With the system configuration out of the way it is time to create a user account, install sudo, give the user full access to sudo and then log off the root account. I will be using the username kyau for the extent of this write-up.

useradd -m -g users -s /bin/bash kyau

pacman -S sudo

visudo

Iconkyau ALL=(ALL) ALL


At this point you can again safely shutdown the RPi. Once you see only the red LED lit you can safely pull the power.

systemctl poweroff


Parition Management & Cloning

Partition Management

At this point remove the SD Card from your RPi and plug it into another Linux machine. Given that we used a pre-made image to install Arch Linux onto our SD Card, it came with pre-defined partitions that are not sized to your entire SD Card. To fix this we will be making a backup of the install, then resizing the partition and finally re-formatting it with a different filesystem than before for better SD Card performance.

Backup Current Installation

First mount the SD Card to a temporary directory, then copy over (with permissions) the entire contents of the partition to a temporary folder.

sudo mkdir -p {/mnt/rpi,/mnt/rpi-backup/rpi,/mnt/rpi-backup/boot}

sudo mount /dev/sdc5 /mnt/rpi

cd /mnt/rpi

sudo cp -a * /mnt/rpi-backup/rpi/

When finished unmount the partition before continuing.

cd && sudo unmount /mnt/rpi

Expanding the Linux Partition

Use the fdisk command to display all of your devices to locate the newly inserted SD Card. Once you locate the device node (it should look similar to below) go ahead and open it up in fdisk.

sudo fdisk -l

Icon   Device Boot Start End Blocks Id System /dev/sdc1 2048 186367 92160 c W95 FAT32 (LBA) /dev/sdc2 186368 3667967 1740800 5 Extended /dev/sdc5 188416 3667967 1739776 83 Linux

sudo fdisk /dev/sdc