Archlinux ARM (alarm) on Raspberry PI (rpi)

  1. 1 What's this site???
  2. 2 Why Archlinux ARM ?
  3. 3 Is there an official wiki?
  4. 4 To login
  5. 5 To update
  6. 6 To search for a package
  7. 7 How to ask for help
  8. 8 How to work out what your PI is doing
  9. 9 How to connect to your PI behind a Firewall?
  10. 10 Is there an Archlinux ARM IRC channel ?
  11. 11 Is there an Archlinux ARM mailing list?
  12. 12 Wireless
  13. 13 Working with GPIO pins on a Rpi
  14. 14 PI Camera: Where is raspi{still,vid}?
  15. 15 Sending and receiving PI Camera video over the network
  16. 16 Using webp to save bandwidth
  17. 17 How to stop console from blanking
  18. 18 No sound over HDMI?

1 What's this site???

Have you had an Archlinux ARM question, typed it into Google and didn't find an answer?

Perhaps you found the answer later. Either way, do let me know at hendry AT iki.fi and I'll add it to the site source.

2 Why Archlinux ARM ?

3 Is there an official wiki?

Not specifically for Arm on Archlinux, though https://wiki.archlinux.org/index.php/Raspberry_Pi is a good start since much of the excellent Archlinux wiki applies to the rpi.

4 To login

User name root and password root.

Note that you really should disable ssh logins with that default:

grep ^PasswordAuthentication /etc/ssh/sshd_config
PasswordAuthentication no

5 To update

pacman -Syu

6 To search for a package

pacman -Ss $packagename

Refer to pacman reference for more examples.

7 How to ask for help

Setup your terminal to upload your console to share the output.

curl http://archpi.dabase.com/tmux.conf > ~/.tmux.conf

Run tmux. If it's not installed, installed it pacman -S tmux.

Now using tmux's default prefix of ctrl+b and the letter p, will upload your console to be shared.

To learn more about what tmux can do, have a look at its default key binds with tmux lsk.

8 How to work out what your PI is doing

Run top.

9 How to connect to your PI behind a Firewall?

See http://pi.dabase.com/ for such a service.

10 Is there an Archlinux ARM IRC channel ?

Yes, irc://irc.freenode.net/#archlinux-arm

11 Is there an Archlinux ARM mailing list?

No there isn't, however there is an annoying phpBB forum though.

12 Wireless

wifi-menu/netctl is the old way and I would encourage you not to use it, though I am biased.

Sadly you need to pacman -Syu wpa_supplicant since it's not on the default install image. I do this by temporarily wiring my rpi via the ethernet port.

systemctl start wpa_supplicant@wlan0 will fail without a config as you can see from systemctl status wpa_supplicant@wlan0 output.

# cat <<EOF > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
EOF

And hopefully systemctl start wpa_supplicant@wlan0 will now work.

wpa_cli to add a network. The user interface is unfortunately pretty awful. Note you need to quote the essid and psk else it might fail:

add_network
set_network 0 ssid "MYSSID"
set_network 0 psk "passphrase"
enable_network 0
save_config

Obviously check /etc/wpa_supplicant/wpa_supplicant-wlan0.conf is looking correct.

See https://wiki.archlinux.org/index.php/WPA_supplicant for details. Once setup, systemctl enable wpa_supplicant@wlan0 to make sure it associates with wireless on boot.

Finally you need to setup systemd-networkd for DHCP functionality like so:

$cat /etc/systemd/network/any.network
[Match]
Name=*

[Network]
DHCP=both

And of course, enable it.

systemctl enable systemd-networkd

Reboot to see if you device comes up online correctly!

13 Working with GPIO pins on a Rpi

Install pacman -Sy wiringpi and

watch -n 0.5 gpio readall

See this video a friend made of my living room light.

Here is the systemd file that controls it:

[root@rpi2 ~]# cat /etc/systemd/system/motionlight.service
[Unit]
Description=Turns light on thanks to motion
After=network.target

[Service]
# Step 1: We invoke a shell to setup the GPIO and if motion is not detected, turn it off
ExecStartPre=/usr/bin/bash -c '/usr/bin/gpio mode 0 out && test $(/usr/bin/gpio read 7) -eq 0 && /usr/bin/gpio write 0 1'
# Step 2: If motion is detected, turn on the light
ExecStart=/usr/bin/bash -c '/usr/bin/gpio wfi 7 rising && /usr/bin/gpio write 0 0'
# Go to Step 1 after 5 minutes
RestartSec=300
Restart=always
[Install]
WantedBy=multi-user.target

14 PI Camera: Where is raspi{still,vid}?

Rpi userland is packaged as raspberrypi-firmware-tools.

# pacman -Ql raspberrypi-firmware-tools | grep bin/raspi
raspberrypi-firmware-tools /opt/vc/bin/raspistill
raspberrypi-firmware-tools /opt/vc/bin/raspivid
raspberrypi-firmware-tools /opt/vc/bin/raspiyuv

If you get:

# /opt/vc/bin/raspistill -o image.jpg
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not enabled in this build. Try running "sudo raspi-config" and ensure that "camera" has been enabled

You need to append to /boot/config.txt:

start_file=start_x.elf
fixup_file=fixup_x.dat

And reboot...

15 Sending and receiving PI Camera video over the network

2013-08-01 16.55.38

Sending from the PI:

/opt/vc/bin/raspivid -rot 180 -t 0 -fps 30 -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 !  gdppay ! tcpserversink host=$pi_ip_address port=5000

On the machine you want to view the camera from:

gst-launch-1.0 -v tcpclientsrc host=$pi_ip_address port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

16 Using webp to save bandwidth

Install cwebp like so:

pacman -S libwebp

# cat capture.sh
tmp=$(mktemp /tmp/XXX.jpg)
webp=$(basename $tmp .jpg).webp
raspistill -vf -o $tmp
cwebp $tmp -o /dev/stdout
rm -f $tmp

17 How to stop console from blanking

setterm -blank 0 >> /etc/issue

18 No sound over HDMI?

Uncomment from /boot/config.txt:

hdmi_drive=2