ArchLinux Install Guide
This guide is intended to help someone install the Arch Linux ARM distribution on their Raspberry Pi. The guide presupposes you have some familiarity with the linux system and are comfortable working from the command line, but it does not require you to be an expert. We learn a great deal by doing, and if you'd like to learn more about how linux operates, Arch Linux is an excellent choice for many reasons.
Arch Linux, pacman, documentation, and scripts are Copyright © 2002-2007 by Judd Vinet, Copyright © 2007-2011 by Aaron Griffin and are licensed under the GNU General Public License Version 2.
Arch Linux ARM is Copyright © 2011-2012 and is licensed under the GNU GPLv2, with full source being free and open software. Each package is licensed under its respective license. The PlugApps distribution is copyright Mike Staszel. You may modify, adapt, and copy it to fit your needs. If you do so, it must be licensed under a similar license to the GPLv2.
One of the greatest advantages of the Arch Linux distribution is its simplicity in approach and attitude. The Arch Linux Beginner's Guide describes this attitude very well:
- The design principles behind Arch are aimed at keeping it simple.
- 'Simple', in this context, shall mean 'without unnecessary additions, modifications, or complications'. In short; an elegant, minimalist approach.
- Some thoughts to keep in mind as you consider simplicity:
- " 'Simple' is defined from a technical standpoint, not a usability standpoint. It is better to be technically elegant with a higher learning curve, than to be easy to use and technically [inferior]." -Aaron Griffin
- Entia non sunt multiplicanda praeter necessitatem or "Entities should not be multiplied unnecessarily." -Occam's razor. The term razor refers to the act of shaving away unnecessary complications to arrive at the simplest explanation, method or theory.
- "The extraordinary part of [my method] lies in its simplicity..The height of cultivation always runs to simplicity." - Bruce Lee
Arch gives you the ability to build your system from the ground up, including only the software you actually need. This minimizes the amount of SD card memory it takes to hold the operating system for your Raspberry Pi, leaving more space for everything else you'll be doing.
Obtain the latest image
- You can download the latest Arch Linux ARM image for the Raspberry Pi here. The current version is 29-04-2012, and this guide pertains to this release. Download the image to any computer that has a way for you to connect your SD card.
Check the image integrity
- Unzip the downloaded image to obtain a directory with the image itself and the SHA-1 checksum. You can verify the integrity of the image with:
- * linux: $ sha1sum --check name_of_checksum_file.txt
- replacing name_of_checksum_file.txt with the name of the .txt file in the downloaded directory.
- * Windows:
- * Mac OS-X:
Write image to the SD card
- Plug your SD card into your computer, and write the Arch Linux ARM image by following the Easy SD Card Setup instructions.
Optional: Resize partitions
- If your SD card is larger than 2 GB, you will want to resize the partitions to make use of your entire card. The Easy SD Card Setup page also has instructions for resizing using parted, though you may also use graphical tools like gparted if you wish.
- The image creates two partitions, which will be available as /dev/mmcblk0p1 and /dev/mmcblk0p2 when you boot up your Raspberry Pi. The first partition (100 MB) is mounted to /boot, and the second (1.7 GB by default) is mounted to the root directory /. Leave the first partition as it is, and expand the second to as large as you desire within the space available on your card. You may also consider creating a third or even fourth partition for /home and/or swap if desired. Neither is necessary, and the two partitions alone are all that are necessary.
When you boot up your Pi, it will bring you to a login prompt. Log in as root (password root). Now we'll change a few settings to personalize your Pi.
Dealing with a Black Screen
- If you boot up your Pi but nothing is displayed on your monitor, it's probably not a hardware problem. Have your Pi plugged in to your network, then from another computer you should be able to connect to it remotely with ssh. (Linux and Mac OS-X have ssh already; Windows users can use any client, such as PuTTY or Bitvise Tunnelier.)
- From another computer connected on the same network, open ssh to alarmpi, the default hostname of the Arch Linux ARM installation. Log in as root (password root), and in a shell run
- # mv /boot/config.txt /boot/config.old
- # reboot
- The ssh session will end, your Pi will reboot, and the display on the monitor or TV connected to it should come up just fine. You no longer need to work through ssh, though if you don't have a keyboard connected to your Pi you can.
Change Root Password
- The first task is to change the root password by running the command passwd. True, you don't really have to do this-- but if you're going to connect to the internet you really ought to. Change it to something at least fairly secure, but rememberable.
- # passwd
Modify System Files
- Arch uses a handful of files to control the startup scripts. The key file of these is /etc/rc.conf. Open this file in either nano or vi, whichever is more comfortable to you. (If you've never used vi, it is highly recommended to stick with nano; the remainder of this tutorial will assume you use it.)
- In this file, you will need to change two things: you will specify your local timezone and give your Pi a name.
- The default timezone is "Europe/London". If you live somewhere else, you can find the possible settings in the /usr/share/timezone/ directory. Find the subdirectory that describes where you live best, then find the file that corresponds to the location closest to you within your timezone.
- # ls /usr/share/zoneinfo
- # ls /usr/share/zoneinfo/America
- With the above commands, I locate my timezone as "America/New_York".
- Open /etc/rc.conf in an editor.
- # nano /etc/rc.conf
- In the LOCALIZATION section, change TIMEZONE="Europe/London" to the value you just found.
- In the NETWORKING section, change HOSTNAME="alarmpi" to the name chosen for your Pi.
- If using nano, use CTRL-x to exit, hit Y to save the file.
- Now we need to edit the /etc/hosts file to reflect the hostname.
- # nano /etc/hosts
- Modify the line of the file to read
- 127.0.0.1 localhost.localdomain localhost yourhostname
- replacing yourhostname with the name you put in /etc/rc.conf.
Mount Extra Partitions
- If you put a separate /home partition on your SD card, you need to specify where to mount it. Edit the /etc/fstab file:
- # nano /etc/fstab
- Add at the bottom of the file the line:
- /dev/mmcblk0p3 /home ext4 defaults 0 0
- using whatever partition you've established for that directory. If you've used a filesystem other than ext4, change it accordingly.
- To be done
- Bring your system installation up to date using pacman. You will first have to creat a pacman key for this to work:
- # pacman-key --init
- Now, in order to create random entropy on your system you need to switch to a second console with <ALT><F2> and:
- #ls -R / && ls -R / && ls -R /
- You may have to run this multiple times, it will take a while. Preiodically switch back to the first console <ALT> <F1> to check the status of the key generation. After a key is generated you can update with:
- # pacman -Syu
- It will update your repositories, and prompt you for permission to update any out of date programs. When that is done, reboot your Pi and log in again as root using your new root password. The initial installation is now done!
Many of the steps here can be considered optional, depending on how you intend to use your Raspberry Pi. The steps described here assume typical usage, and if you're not already familiar with the system are recommended.
- It's not wise to use your system always as the root user, so you'll want to create a regular user account with permision to perform root functions under sudo. To install sudo:
- # pacman -S sudo
- To give your regular user permission to use sudo, you need to edit the configuration file using visudo:
- # EDITOR=nano visudo
- Locate the section marked as:
- ## User privilege specification
- and uncomment the line below to say
- %wheel ALL=(ALL) ALL
- Save and exit.
Create Regular User Account
- Create a new user to use regularly:
- # adduser
- Follow the prompts; use whatever username you'd like to log in. The next available UID is fine. Use the default users as the initial group. For additional groups, add the following:
- tbd: which of these are actually necessary?
- The default home directory and shell are both fine. Unless you want one, don't bother putting an expiration date in. The script will then ask you to confirm the entry as you've entered it. If all is satisfactory, continue to make the account, give the user a password, and add any other information it asks for as desired.
- Save and exit
- Logout, and relogin as the regular user:
- # logout
- login: newuser
- password: yourpassword
- (Note the change in prompt from # to $. This will help you know if you're logged in as root or not.) From now on, you should use your regular user for everything. When root needs to do something on your system, use sudo. (The first time you use it, the display will show some general good-behavior rules for its use.)
Keeping Boot Messages on the Display
- If you want to be able to see the boot messages and not have the screen cleared for login as is default, you'll need to edit /etc/inittab:
- $ sudo nano /etc/inittab
- Change the line for tty1 to read
- c1:2345:respawn:/sbin/agetty --noclear -8 -s 115200 tty1
- Save and exit.
Install Any Desired Software
- Pacman is used to install any new software. You can search for program names using:
- $ pacman -Ss keyword
- Install software with:
- $ pacman -S program-name
Suggested software to install
- xorg: for graphical display
- $ sudo pacman -S xorg
- lxde: LXDE Desktop Environment
- $ sudo pacman -S lxde
- or xfce: XFCE Desktop Environment
- $ sudo pacman -S xfce4
- Vim: powerful text editor
- $ sudo pacman -S vim or $ sudo pacman -S gvim
- Emacs: likewise, for those so-inclined
- $ sudo pacman -S emacs
- Python 3: Python v3 programming language
- $ sudo pacman -S python
- Python 2: Python v2 programming language
- $ sudo pacman -S python2
- GCC: GNU C/C++ compiler
- $ sudo pacman -S gcc