Arch Linux on the Raspberry Pi 2

Yes, I already have a couple of Raspberry Pi, but I had to get one of the new Raspberry Pi 2 (model B), to check out its increased processing power with OpenCV and image processing.

So, lets install it. The Arch Linux install page is here. This new RPi2 has a new ARMv7l Cortex-A7 quad-core! Arch Linux has a new distro page dedicated to it. If you want to install the previous RPi model you can also follow my notes, you just have to get the correct SD image here.

To create the SD card I’ll be using the Arch Linux that I installed in a VirtualBox in a previous post. My Transcend TS-RDF8K isn’t recognized by Arch Linux if I plug it to an USB 3 port. I get lots of errors about not being able to enumerate usb device. If I plug it to a USB 2 port it works fine. I think its because this VM installed version of Arch Linux is too old, I’ll have to update it and try again the USB 3 drivers. Not going to do it now.

Another thing, when you plug the SD reader with the card inside, you’ll see the new associated disks on Windows explorer. But when you start the Linux virtual machine they disappear. This is normal, they are locked by VirtualBox.

After plugging the Transcend card reader, doing a dmesg command I can find which device is associated to my 4GB SD card. The following image shows the last lines of the dmesg command and the output of the fdisk command.


You also have the lsblk command, it will list all your block devices so you can know which one is the SD card. I don’t need to remind you that if you re-partion or format the wrong disk you will lose data.

Now just follow whats on the Arch Linux install page, in my case the SD card is /dev/sdc, so I start with the command fdisk /dev/sdc, etc…

You need to install the package dosfstools if you get an error when you give the mkfs.vfat command using the pacman tool.

pacman -S dosfstools

When you finish, unmount the SD card, insert it into your RPi2, plug a network cable and power up, if you didn’t mess up during the install procedure it will boot. If you have a DHCP server in your network then an IP address is automatically assigned to your RPi2. If you have several PCs connected as I do, you can use a tool like nmap or Zenmap for Windows (its cross platform). This nmap command will do a ping scan (-sn) and TCP SYN/ACK discovery to ssh port 22 to quickly find live hosts with the ssh port open:

nmap -sn -PS22

Then after scanning the network you can easily figure out which one is your new RPi2.

Now that you have the RPi2 IP address, use the ssh command to connect to it as root, the root’s password is noted on the Arch Linux install page. Start by updating everything with pacman -Syyu and then create a normal user with useradd -m, you should not get used to login as root all the time. Add this new user to the sudoers list so you can use the sudo command. Don’t edit /etc/sudoers file directly, use the visudo command, it works like vi so you need to be familiar with this editor. You need to install the sudo package (pacman -S sudo) and then edit the sudoers list and add this new user.

Of course you can also plug an HDMI monitor and USB keyboard to connect to the RPi2 directly, that way you don’t need to find out what’s the IP address of the RPi2. Verify the IP address with ifconfig.

It is a good idea to change the host name so you know where you are connected to when you have several PCs and RPis in your network:

hostnamectl set-hostname myhostname

In order to not have permission issues with this new user you may want to add it to the following groups: audio, video, power, wheel. Use the command:

gpasswd -a myuser audio
gpasswd -a myuser video
gpasswd -a myuser power
gpasswd -a myuser wheel

If you want to play around with it you probably need to install the devel package with pacman -S base-devel and chose to install all of the packages.

To setup the WiFi look for info on this page. Like they say, the first part is to identify and ensure the correct driver for your wireless device is installed, and to configure the interface. The second is choosing a method of managing wireless connections.

To see my USB WiFi I have to use lsusb, the result is this:

[root@alarmpi ~]# lsusb
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. SMC9512/9514 USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It looks good, the USB WiFi device was detected.
I also see in that list my ethernet device, it is also connected internally via USB.

If I do a ip a command I can see my network cards:

[root@alarmpi ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether b8:27:eb:35:72:cc brd ff:ff:ff:ff:ff:ff
inet brd scope global dynamic eth0
valid_lft 78949sec preferred_lft 78949sec
inet6 fe80::ba27:ebff:fe35:72cc/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether e8:4e:06:11:7d:6f brd ff:ff:ff:ff:ff:ff

So I’m lucky, my wireless device is installed and running.

For WPA/WPA2 encryption you need to install the pacman -S wpa_supplicant package. Also install the dialog package, some of the configuration tools use it for screen display.

Install the iw package to manage wireless settings, if something goes wrong and you need mode control:
sudo pacman -S iw

Now for the managing part of wireless connections, lets install NetworkManager, an advanced service that manages network devices automatically, with pacman -S networkmanager. After install, start the service with systemctl start NetworkManager. Enable the service to start on boot with systemctl enable NetworkManager. Use the nmtui command, chose activate a connection from the list and look for your WiFi name. Select it and enter your password.

Set your time zone with ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime (if you live in Paris ;-) or replace Paris with the name of your time zone city. Edit the /etc/locale.gen file, uncomment the locales you’ll be using and then call the locale-gen command.


Author: pedro_nf

Independent contractor on IT solutions and automation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s