Monday, November 12, 2012

How to set up Arch Linux on a Raspberry Pi

This article was shamelessly stolen from r3v0luti0n. At least I didn’t simply translate it, but actually used it to configure Arch Linux on my Raspi.

First Login

You should see something like this:

  Arch Linux 3.1.9-20-ARCH+ (tty1)
  alarmpi login: root
  Password:


Both username and password are root. If you put in anything else you can watch the system trying and failing to start a graphical system.

  [root@alarmpi ~]#

Change of Keyboard Layout

Not done. I am fine with an English layout for now. The main problem is the switch between y and z anyway.

Test of Internet Connection

This was not really necessary for me because I knew from the previous Raspbian system that the internet connection was fine. If you want to you can do

  [root@alarmpi ~]# ping -c 3 r3v0luti0n.com

The r3v0luti0n.com can of course be replaced by an internet address of your choice which is known to be always available. So maybe not twitter.com or some other site similarly prone to outages.
I haven’t bothered with trying to set up a wireless connection at this point, so I am deviating even further from the guide.

System Update

One of the first steps for any linux setup is always a system upgrade. The Arch package manager pacman is said to be very fast and simple to use.

  [root@alarmpi ~]# pacman -Syu

The parameter -S requests packages from the preconfigured repositories, -y updates the resources and checks available packages against the system, and -u starts the upgrade.
The first upgrade will take a long time. Arch Linux uses a rolling upgrade and update system:There are no big system upgrades, but instead packages are continuously updated. This means that even after downloading the most recent image there might be quite a lot of updates waiting for you. I was luck with only 48 package updates, which took about 30 minutes.

Configuration of Locale and Keyboard Layout

As with most things the locale is defined in a text file. Use
  
  [root@alarmpi ~]# nano /etc/locale.gen

to start the nano text editor. Nano is a very simple text editor that runs in the command line. The main commands are explained at the bottom, and the rest is done by navigating with the arrow keys and typing text. The file contains some explanatory text and a long list of possible locales, i.e. language and localisation settings. Uncomment the ones you would like to use. For me this was the line

  #en_DK.UTF-8 UTF-8
  #en_DK ISO-8859-1
  en_GB.UTF-8 UTF-8
  #en_GB ISO-8859-1
  #en_HK.UTF-8 UTF-8


(The important line is highlighted in bold print). [Ctrl]-o will write the file (after a confirmation), and [ctrl]-x will exit nano. [I didn’t know that Denmark had a specific English keyboard layout, but you never stop learning …]
The command

  [root@alarmpi ~]# locale-gen

will generate the corresponding language files.

Main Configuration

There was no /etc/rc.conf present on my system, so I had to create it myself. It seems that quite a bit of the essential of the system configuration has changed since the r3v0luti0n guide was created, so from here on I am following the ArchWiki. Actually, there was a change to systemd as the default init daemon, so /etc/rc.conf is obsolete.

Keyboard Layout

The keyboard layout is stored in /etc/vconsole.conf. If you want to change from the default (US of course …) you can look up the available keymaps with

  [root@alarmpi ~]# ls /usr/share/kbd/keymaps/i386/querty

and set it by using
  
  [root@alarmpi ~]# nano /etc/vconsole.conf

[Ctrl]-o will write the file (after a confirmation), and [ctrl]-x will exit nano. My final /etc/vconsole.conf looks like this:
  
  KEYMAP=uk
  FONT=lat9w-16
  FONT-MAP=8859-1_to_uni


I haven’t touched any other settings than the keymap because I am not sure what they do.

Main Configuration File

I created a file using
  
  [root@alarmpi ~]# nano /etc/rc.conf

looking like this:

  # /etc/rc.conf - configuration file for initscripts
  #
  # Most of rc.conf has been replaced by various other configuration
  # files. See archlinux(7) for details.
  #
  # For more details on rc.conf see rc.conf(5).
  #
 
  DAEMONS=(syslog-ng network crond)
 
  # A reasonable DAEMONS array when using sysvinit is:  

  # DAEMONS=(syslog-ng network crond)
  #
  # When using systemd, it is recommended to only enable daemons that
  # do not have native systemd service files.
 
  # Storage
  #
  # USEDMRAID="no"
  # USELVM="no"
 
  # Network
  #
  # interface=
  # address=
  # netmask=
  # gateway=


Again, [ctrl]-o will write the file (after a confirmation), and [ctrl]-x will exit nano.

Reboot

After this ordeal I rebooted with

  [root@alarmpi ~]# reboot

This is particularly important if you want to use the GB keyboard layout right away. I really can’t get used to # being on [shift]-3 …

Later more.


3 comments:

  1. I need help, ive tried 2 types of keyboards none of them work correctly. Somtimes the letters dont show up or it just repeat the letter I clicked on.

    ReplyDelete
  2. Jeremias: You need to check that your keyboard is not drawing too much current from the Pi.

    ReplyDelete
  3. I usually have a powered USB hub for peripherals so I do not run into that issue.

    ReplyDelete