Installing Arch Linux ARM on Raspberry Pi’s
Intro
Who is this guide for?
This Guide is written for people who have worked with Linux before and know their way around the console (can use nano to edit files and so on) and need some guidance to setup an Arch Linux ARM Server.
What is the Idea behind this guide?
There are many, many guides about installing various operating systems on the Pi out there. This one will try to point you to wikis and articles which will answer the most questions and get you to the point where you know where you can find documentation about problems you are experiencing yourself. As a sideeffect articles linked here should stay updated so you should not run into outdated information.
Why Arch Linux ARM?
There are innumerable blogs and articles about what OS is the best for the Pi. All with different outcome. Thankfully, as a long time arch user, I did not have to bother to look at other available distributions. Here are the reasons why I personally would always recommend Arch:
Arch Linux follows the philosophy of simplicity. You get exactly what you need, nothing more. This suits the Pi very well, since you have to work with ‘limited’ resources.
Chances are you will also learn a lot more about Linux in general if you work with Arch since you have to configure and setup a lot yourself. This is often viewed as a drawback of Arch, but lines up perfectly with the original idea of the Pi. Taken from the Raspberry Pi FAQ:
We want to see it being used by kids all over the world to learn programming.
Granted, programming might be a bit different then wrestling with Arch but close enough.
Additionally the Arch Linux wiki is very, very good and if something fails there is usually a quick solution found in the forums with Google.
Installation
SD Card Preparation
This part is fairly straight forward and you can simply follow the installation instructions for ARMv6 (rpi 1) or ARMv7 (rpi 2) on archlinuxarm.org. It is important that you follow the instructions to the point (tar is not the same as bsdtar and does behave differently).
If you don’t have access to an *nix environment you either have to build your own or (much easier) boot up a linux machine via livecd / virtualbox to follow the instructions since there are no provided images anymore.
If you insert your SD-Card into your Pi now and power it up, you can log into your brand new arch system locally or via ssh to configure it further.
Pacman (packet management)
After login in you are greeted by the standard bash shell. If you need a refresher on how to use Pacman or maybe it is your first time using Arch, have a look at Pacman - An Introduction and the slightly more advanced pacman#Usage.
Following the Beginners Guide
Even after my third Arch Installation I still use the Beginners’ Guide to make sure I don’t forget an essential step. You can skip the beginning up to the part where the guide asks you to chroot into the new installation, because you are already in the right environment.
Just follow the guide to configure the following things:
- locale - for rendering Text and special characters
- font and keymap - Default font is fine but if you don’t use a qwerty keyboard you definitely want to set a suitable keymap
- time zone - self explanatory
- hostname - a little personality for our little pi
- network
- lan - skip if you want to work local only
- wlan - if you have a usb wifi dongle (google for a compatibility list if you plan on buying one)
- root password
Arch Linux specific settings that make sense
Now you might want to turn your attention on general things that improve performance. The Archlinux Wiki contains a lot of articles how to improve performance on various hardware like laptops or the RPi.
Maximizing SD Card Performance and Life
/etc/fstab
Mounting is the act of making a file system usable on Unix systems. To improve performance you can set special flags that make more sense then the default ones since you are working on an SD Card and not a standard hard disc drive. Link
Keep in mind that your /etc/fstab entry might look different. You are looking for the line which has a single / in the second column which represents your root partition. Once you located the right line you want to change the options in the 4th column to noatime,discard.
Using a tmpfs for /var/log
If you keep following the Arch Linux wiki article for the Raspberry Pi you will see that the next course of action is to create a ram based filesystem for your logfiles so further reduce write cycles to your SD Card. This makes sense and is not hard, but keep the warning in mind that all system logs are lost on reboot!
Overclocking
Even without additional cooling and a cheap housing i had no heat problems at all. So if you have the feeling you need a bit more oomph you can edit the /boot/config.txt file to your liking.
Keep in mind that an overclocked cpu needs higher voltage and can lead to strange issues with your usb peripherals (like connection loss with a wifi dongle)
Hardware random number generator
The Pi comes with a Hardware RNG. To use it you have to edit /etc/conf.d/rngd as described here.
What is next?
Before you start tinkering with your install and add a lot of packages and configurations you might want to consider backing up your rasperry pi sd card so you can reset it easily if you screw something up.
Add some users (and learn something about Linux user and group management) so you don’t have to use root all the time. If you are tired of console only install a desktop environment. You should probably stay lightweight (LXDE or XFCE) for performance reasons. If you want to go down the server route you might want to look at setting up a SSH Server. Or maybe you want to use it as a media player connected to your TV and install one of the media center applications like xbmc. Whatever you want to do, you are now in posession of a great base system to tinker with.