Skip to main content

Arch Linux on the Raspberry Pi and the bsdtar Fix

A couple of years ago, or more, I wrote a script to get the latest Raspberry Pi filesystem archive from the Arch LinuxARM site, create, partition and mount a new .img file and extract the .tar.gz file into the mounted partitions.

But a while ago, about December 2016 or so I started to get bsdtar errors when extracting the archive.

Note here that it is documented on the Arch Linux ARM site that GNU tar will not work with this operation and it must be bsdtar.

In the last couple of days my need to find a solution has grown more pressing and I went looking for the answer. I turned up this post in the Arch Linux ARM forums.

On page two of the thread it says that version 3.3+ is required.

As my main machine is Debian Stretch my version was not that high.

Below is a script which will get, make and install a sufficiently current version:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
#
# Get, build and install the version of bsdtar needed by the Raspberry Pi Arch Linux root file-system get and 
# extract
#

if [ `whoami` != 'root' ]; then
    echo "Script must be run as root, try: $0"
    exit 1
fi

set -e

wget https://www.libarchive.org/downloads/libarchive-3.3.1.tar.gz
tar xzf libarchive-3.3.1.tar.gz
cd libarchive-3.3.1
./configure
make
make install
exit 0

Now:

bsdtar --version

Should show a version > 3.3.

Here is how to clone my repo and use the script:

git clone https://github.com/cromarty/rpi-stuff

Now:

cd rpi-stuff/make-rpi-arch

Execute the script with one argument, which is the version architecture:

sudo ./make-rpi-arch.sh <architecture>

Where <architecture> is one of:

  • armv6 for the older Pi versions
  • armv7 for the Pi2
  • armv8 for the Pi3

Note I have never run an armv8 image.

The script also needs bsdtar (as discussed above), kpartx, and parted.