Archlinux ARM on Raspberry PI (rpi)

  1. 1 What's this site???
  2. 2 Why Archlinux ARM ?
  3. 3 Is there an official wiki?
  4. 4 Installing Archlinux ARM
  5. 5 To login
  6. 6 To update
  7. 7 To search for a package
  8. 8 How to ask for help
  9. 9 How to work out what your PI is doing
  10. 10 How to connect to your PI behind a Firewall?
  11. 11 Is there an Archlinux ARM IRC channel ?
  12. 12 Is there an Archlinux ARM mailing list?
  13. 13 PI Camera: Where is raspi{still,vid}?
  14. 14 Setting up correct time
  15. 15 Sending and receiving PI Camera video over the network
  16. 16 Using webp to save bandwidth
  17. 17 How to downgrade a kernel with Archlinux Arm
  18. 18 Resizing a freshly dd-ed Archlinux image to take all the available space of the SD card

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 Installing Archlinux ARM

After installing the latest Archlinux ARM from PI downloads you will find you only have a 2GB root. Expand it following this guide.

5 To login

User name root and password root.

6 To update

pacman -Syu

7 To search for a package

pacman -Ss $packagename

Refer to pacman reference for more examples.

8 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.

9 How to work out what your PI is doing

Run top.

10 How to connect to your PI behind a Firewall?

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

11 Is there an Archlinux ARM IRC channel ?

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

12 Is there an Archlinux ARM mailing list?

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

13 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...

14 Setting up correct time

You need to have Internet connectivity for time to be properly synced since the PI does not have a clock.

pacman -S ntp
systemctl enable ntpd.service
timedatectl set-ntp 1
timedatectl status

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 downgrade a kernel with Archlinux Arm

[root@pihsg ~]# cd /var/cache/pacman/pkg
[root@pihsg pkg]# uname -a
Linux pihsg 3.10.18-1-ARCH+ #1 PREEMPT Tue Nov 12 00:08:16 CST 2013 armv6l GNU/Linux
root@pihsg pkg]# ls -1 | grep linux
linux-api-headers-3.10.6-1-armv6h.pkg.tar.xz
linux-firmware-20130610-1-any.pkg.tar.xz
linux-firmware-20130728-1-any.pkg.tar.xz
linux-firmware-20130917-1-any.pkg.tar.xz
linux-firmware-20131013.7d0c7a8-1-any.pkg.tar.xz
linux-headers-raspberrypi-3.10.18-1-armv6h.pkg.tar.xz
linux-headers-raspberrypi-3.6.11-13-armv6h.pkg.tar.xz
linux-headers-raspberrypi-3.6.11-14-armv6h.pkg.tar.xz
linux-headers-raspberrypi-3.6.11-17-armv6h.pkg.tar.xz
linux-headers-raspberrypi-3.6.11-18-armv6h.pkg.tar.xz
linux-raspberrypi-3.10.18-1-armv6h.pkg.tar.xz
linux-raspberrypi-3.6.11-13-armv6h.pkg.tar.xz
linux-raspberrypi-3.6.11-14-armv6h.pkg.tar.xz
linux-raspberrypi-3.6.11-17-armv6h.pkg.tar.xz
linux-raspberrypi-3.6.11-18-armv6h.pkg.tar.xz
util-linux-2.23.1-2-armv6h.pkg.tar.xz
util-linux-2.23.2-1-armv6h.pkg.tar.xz
util-linux-2.24-1-armv6h.pkg.tar.xz
[root@pihsg pkg]# pacman -U linux-raspberrypi-3.6.11-18-armv6h.pkg.tar.xz
loading packages...
warning: downgrading package linux-raspberrypi (3.10.18-1 => 3.6.11-18)
resolving dependencies...
looking for inter-conflicts...

Packages (1): linux-raspberrypi-3.6.11-18

Total Installed Size:   21.00 MiB
Net Upgrade Size:       -1.25 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring                                                    [###############################################] 100%
(1/1) checking package integrity                                                  [###############################################] 100%
(1/1) loading package files                                                       [###############################################] 100%
(1/1) checking for file conflicts                                                 [###############################################] 100%
(1/1) checking available disk space                                               [###############################################] 100%
(1/1) downgrading linux-raspberrypi                                               [###############################################] 100%
>>> Updating module dependencies. Please wait ...
[root@pihsg pkg]#

18 Resizing a freshly dd-ed Archlinux image to take all the available space of the SD card

  1. Write the image
  2. Delete the second partition
  3. Recreate it using hte same start sector
  4. Resize it

Using fdisk on Archlinux on my X220, with the SD card on the /dev/mmcblk0 device:

x220:~$ sudo fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368   3667967 1740800   5 Extended
/dev/mmcblk0p5         188416   3667967 1739776  83 Linux

The partition is a little complicated. The second partition is actually within an extended partition. Just follow what I do:

Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.

I delete the partition, but actually the data is still there if I recreate on the same block boundaries:

Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot Start       End Blocks  Id System
/dev/mmcblk0p1       2048    186367  92160   c W95 FAT32 (LBA)

Command (m for help): n

Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2):
First sector (186368-15564799, default 186368): 186368
Last sector, +sectors or +size{K,M,G,T,P} (186368-15564799, default 15564799):

Created a new partition 2 of type 'Extended' and of size 7.3 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368  15564799 7689216   5 Extended

Command (m for help): n

Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (188416-15564799, default 188416):
Last sector, +sectors or +size{K,M,G,T,P} (188416-15564799, default 15564799):

Created a new partition 5 of type 'Linux' and of size 7.3 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368  15564799 7689216   5 Extended
/dev/mmcblk0p5         188416  15564799 7688192  83 Linux

Now lets write out this new partition that takes up the whole of this 8GB SD card:

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Ok, now you need to take out the SD card and re-insert or do whatever is necessary to make sure you're system RE-READs the NEW PARTITION TABLE.

Ok, lets check to be sure after I've re-inserted it.

x220:~$ sudo fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1           2048    186367   92160   c W95 FAT32 (LBA)
/dev/mmcblk0p2         186368  15564799 7689216   5 Extended
/dev/mmcblk0p5         188416  15564799 7688192  83 Linux

Command (m for help): q

Looks good! Now we have to tell the ext filesystem on the disk, we have resized, like so:

x220:~$ sudo resize2fs  /dev/mmcblk0p5
resize2fs 1.42.10 (18-May-2014)
Please run 'e2fsck -f /dev/mmcblk0p5' first.

x220:~$ sudo e2fsck -f /dev/mmcblk0p5
e2fsck 1.42.10 (18-May-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mmcblk0p5: 28769/108864 files (1.3% non-contiguous), 124064/434944 blocks
x220:~$ sudo resize2fs  /dev/mmcblk0p5
resize2fs 1.42.10 (18-May-2014)
Resizing the filesystem on /dev/mmcblk0p5 to 1922048 (4k) blocks.
The filesystem on /dev/mmcblk0p5 is now 1922048 blocks long.

Mount /dev/mmcblk0p5 and inspect the data. The Archlinux Arm filesystem should be there in tact. Unmount and you're ready to go!