Arch Linux Raspberry Pi Install Guide – Updated – LXDE + SLIM

This guide will explain how to install Arch Linux using the NOOBS (New Out Of Box Software) zip file provided by the Raspberry Pi Foundation on their download’s page. I will also explain how to install a desktop environment as well as a few other applications to get you started. This guide will only explain how to install Arch as the ONLY OS on the SD card !!

You will need an SD card formatted to FAT32 and either the NOOBS.zip file or the NOOBS Lite.zip file from the Raspberry Pi downloads page. The process is amazingly simple, once downloaded all you have to do is extract the .zip file onto the SD card using the program of your choice (Linux = 7zip/PeaZip/Ark/etc Windows = WinZip/7-Zip/PeaZip/etc).

Once this is done plug the SD card into the Pi and turn it on, it will start re-sizing partitions and creating new ones, when it is finished you will be left with 3 partitions on your SD card, the normal 2 and an additional recovery partition. You will be greeted by a selection of operating systems to choose from, select Arch Linux and click the “Install” button. You will see a warning appear about over-writing all existing data, click “Yes”, it will start installing Arch on your system for you, sit back and grab a drink, when it’s done you will see a pop-up notifying you that the OS has been successfully installed, click “OK”.

The Pi will reboot and you will be greeted by a command line interface, log in using the username root and the password root. The first thing we will do is change the password :

# passwd

Change it to something memorable and secure. Arch uses a few files to control the startup scripts. These files are located in /etc. We need to do 2 things, change the timezone if necessary 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

These 2 commands would locate the timezone to America/New York, we now need to remove the old timezone link and create a new one :

# rm /etc/localtime

We now need to create a symlink to the timezone information :

# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

We need to edit /etc/timezone so we will open it up using nano – a simple command line text editor and replace “Europe/London” with “America/New_York” :

# nano /etc/timezone

Press CTRL+X to exit, pressing Y to save and hitting ENTER when it asks for the name. Now we will change the name of the Pi :

# nano /etc/hostname

Change “alarmpi” to whatever name you would like to give your Pi, again hitting CTRL+X to exit and then pressing Y and ENTER to save. Because we changed the name of the Pi we need to edit the /etc/hosts file to reflect the name you have just chosen :

# nano /etc/hosts

You need to change the line that reads :

127.0.0.1 localhost.localdomain localhost yourhostname

Change “yourhostname” to whatever name you picked in the step previous to this one, once again exiting and saving. Now we will update the system using pacman. We need to create a pacman key first for this to work :

# pacman-key –init

NOTE – 2 dashes in front of init !!! So it should read <pacman-key><space><dash><dash><init>

We need to create random entropy to help this process along, open a new terminal window with ALT+F2 and enter the following :

#ls -R / && ls -R / && ls -R /

You might have to do this a few times, keep switching back to the first console with ALT+F1 to check if it has generated a key yet, when it has we can update using this command :

# pacman -Syu

This will make pacman update your repositories and prompt you to update and software which may be out of date, once it is done you can reboot your pi using :

# reboot

That is the initial installation finished, these next steps are highly recommended if you haven’t used Arch Linux before. Log back into root using the username root and the password you specified earlier. Now we are going 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 in the normal way.

Now we need to tell sudo that pi is allowed to use it. We will do this by adding the pi user to the sudo group :

# EDITOR=nano visudo

Locate the lines that are currently commented out as follows :

## Uncomment to allow members of group sudo to execute any command

# %sudo ALL=(ALL) NOPASSWD: ALL

Uncomment the second of the above lines, so that it reads as follows :

## Uncomment to allow members of group sudo to execute any command

%sudo ALL=(ALL) NOPASSWD: ALL

Save and Exit.

We will now create the regular user account but first we need to install adduser :

# pacman -S adduser

Now we will create the new user :

# adduser

Follow the on screen prompts; pick your username, using the next available UID is fine. Use the default users as the initial group. For additional groups, add the following :

audio,lp,optical,storage,video,wheel,games,power,scanner

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, then logout and back in :

# 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.)

Now add a new group named sudo to the system and add the pi user to it:

# groupadd sudo

# usermod -a -G sudo your_username

And we can check if it stuck, with the following command:

# groups your_username

If all went well, you should see the full list of groups we set up when we created the pi user, and the new sudo group as well:

lp games video audio optical storage scanner power sudo users

When the pi user next logs in, or starts a new shell, then it will be allowed to use the sudo command.

To keep boot messages on the display follow this guide :

https://wiki.archlinux.org/index.php/Disable_Clearing_of_Boot_Messages

In Arch we use pacman to install packages. You can search for program names using :

$ pacman -Ss keyword

Install software with:

$ pacman -S program-name

If your keyboard is not set to the UK keymap please follow the first part of this guide :

http://qdosmsq.dunbar-it.co.uk/blog/2013/06/beginners-guide-to-arch-linux-on-the-raspberry-pi/

We will now install a desktop environment. To install LXDE simply run :

$ sudo pacman -S xorg xorg-xinit xorg-server xorg-server-utils xterm lxde

A ttf font is needed and should give you options to pick one during install. This is just in case you see that it did not.

To find all the ttf fonts available :

$ pacman -Ss ttf

or for simplicity :

$ sudo pacman -S ttf-dejavu

Now we will install the SLiM login manager and make it start automatically at boot :

$ sudo pacman -S slim

Now we have to enable the SLiM daemon by running this command :

$ sudo systemctl enable slim.service

From here you need to tell SLiM which environment it should be loading. You do this by editing your .xinitrc file :

$ sudo nano ~/.xinitrc

Add or uncomment the following, making sure there is only one exec for an environment uncommented :

exec startlxde

Now just reboot :

$ reboot

From here you can further configure both SLiM and LXDE to your exact visual needs.

Login using the details you provided when you created your user, you should be at a graphical login. A good lightweight browser is netsurf, install it with :

$ sudo pacman -S netsurf

You can install conky following this guide from the Arch wiki, check out this blog for a nice conkyrc to use with your Pi. For a list of other applications check out this link :

https://wiki.archlinux.org/index.php/List_of_Applications

Have a look through for some ideas, the only thing i would suggest is try not to install anything too resource heavy unless you plan on overclocking your Pi. You could always try installing DOOM using my guide if you fancy a bit of fun :

https://hreikin.wordpress.com/2013/12/18/doom-on-arch-linux/

One last thing and this is IMPORTANT; you will need this command to shutdown your Pi :

$ sudo shutdown -h now

Now go out and have fun exploring the world’s of Arch and the Raspberry Pi.

Advertisements

14 thoughts on “Arch Linux Raspberry Pi Install Guide – Updated – LXDE + SLIM

  1. I basicly set my pi with arch up following only your tutorial so thank you very much, it worked great!!

    Since I’m not really that experienced at using the shell (only ubuntu experience) there were a couple of steps that i could do, but not completely understand
    first of all:
    pacman-key –init
    and:
    ls -R / && ls -R / && ls -R /

    What kind of key is that, why do I need it and how does ls -R help to do that? When I did that i only saw tons of text running over my screen. But i guess it created the key.

    sudo systemctl enable slim.service
    Why is it “.service”? If I want any application to start during boot do I just have to say systemctl enable .service?

    Last but not least. What are those groups for?
    audio,lp,optical,storage,video,wheel,games,power,scanner
    I understand why I need sudo but what powers do I gain being in those groups. I already didn’t understand what the group “wheel” is, when it was mentioned a couple steps before.

    Thanks for your work.
    Tom

    Like

    1. Glad to hear you had some success with the guide, i will try to answer your questions as best i can.

      pacman-key –init is used to initialise the pacman key, the next bit is from the arch wiki :

      Pacman uses GnuPG keys in a web of trust model to determine if packages are authentic. There are currently five Master Signing Keys. At least three of these Master Signing Keys are used to sign each of the Developer’s and Trusted User’s own keys which then in turn are used to sign their packages. The user also has a unique PGP key which is generated when you set up pacman-key. So the web of trust links the user’s key to the five Master Keys.

      the ls -R / && ls -R / && ls -R / command is to generate entropy to help speed up the process of initialising the key. The randomness created is used to set up a keyring (/etc/pacman.d/gnupg) and the GPG signing key of your system.

      the slim.service is just the way arch runs i believe, slim relies on systemd-logind and that is just how a service is enabled in arch, most programs would be started in your autostart file only certain things would use .service

      the groups are just normal groups to have on a pc, they are nothing special really and you should be fine without them, wheel however is a group used which people can be added to for using sudo, it is an option in the visudo file, otherwise you have to create a sudo group and then add the user to it and edit visudo to let users in sudo group use the sudo command

      i hope that helped, more info can be found at the arch linux wiki :

      https://wiki.archlinux.org/

      just google anything your arent sure about, its pretty much how i learn 😛

      Like

      1. Ok thanks, that already helps.
        You can believe a googled a lot of stuff and used the wiki but it can be really tedious sometimes and I had a hard time understand how to use systemctl.
        So thanks for your answers, helped a lot.
        By the way, shouldn’t
        sudo pacman -S xorg xterm lxde or even
        sudo pacman -S xorg-xinit xorg-server xorg-server-utils xterm lxde
        work instead of:
        sudo pacman -S xorg xorg-xinit xorg-server xorg-server-utils xterm lxde

        Like

      2. They probably would, these guides are just what I have done to get things working, they are far from perfect. Just glad they help !

        Like

  2. ## Uncomment to allow members of group sudo to execute any command

    %sudo ALL=(ALL) NOPASSWD: ALL

    I only finde:

    ## Uncomment to allow members of group sudo to execute any command

    %sudo ALL=(ALL) ALL

    at my file.

    Should I edit it?

    Best regards

    Belfigator

    Like

    1. the “NOPASSWD: ALL” part only makes it so you don’t have to enter your password for any sudo command, it can be risky/dangerous if you don’t read everything you type in to a terminal 😛 so it is up to you. you will be ok with or without adding it into the file.

      mic

      Like

  3. Mic just curious, did your pi happen to turn off its signal as it was running the pacman -Syu command? I was having it run this command and all of a sudden my screen went black and I can’t see anything. I reconnected the hdmi cables but there is nothing here. I’m not sure if it even finished updating.

    Thanks

    Like

    1. If i remember correctly i think the screen goes off due to a “lack of signal” i.e. no mouse/keyboard input for a while, you should be ok to press the up arrow while it is updating with the command to bring the screen back on i think

      Like

  4. Need help please, i’m stuck while typing the command “pacman -S sudo”, when i push enter it appears “error: failed to initialize alpm library
    (database is incorrect version: /var/lib/pacman/) error: try running pacman-db-upgrade

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s