Alpine Linux: Upgrading on Raspberry Pi

Categories: alpine raspberry pi linux

This post describes the upgrade procedure I follow to upgrade my Raspberry Pi Alpine Linux installation. Alpine Linux on the Raspberry Pi runs from ramfs and thus the upgrading is not straightforward. Most of the details are taken from the Alpine Linux Wiki. I’m not sure if Alpine Linux does any verification on the new downloaded release, so I’m doing that manually on another computer.


First of all, replace the repository confiration to point to the new version:


Press e then replace v3.5 by v3.6 (or whichever is the new release version).

apk update
apk upgrade --update-cache --available

Make sure that /etc/lbu/lbu.conf has the following line:


Then load the environment variables from the file, and backup everything.

. /etc/lbu/lbu.conf
lbu ci

Check that there is at least 400MB (maybe more?) free in the permament storage:

df -h | grep "Filesystem\|$LBU_MEDIA"

Now on another computer, which should have the Alpine Linux release GPG keys on the GPG keyring, download the new release image, verify it’s hash and verify the hash signature:


sha256sum *armhf.tar.gz
cat *armhf.tar.gz.sha256
gpg --verify *armhf.tar.gz.asc

Now we proceed with the upgrade on the Raspberry Pi:

mount -oremount,rw /media/$LBU_MEDIA
cd /media/$LBU_MEDIA

Download the new release image (this time on the Raspberry Pi) and verify that the hash matches the one we verified on the other computer, then extract it:

sha256sum *armhf.tar.gz
mkdir new 
cd new 
tar xzf ../alpine-rpi-$VERSION-armhf.tar.gz
cd ..

Commented is the line suggested in the wiki, which I’m not sure does any verification. We will install from the extracted release image:

#setup-bootable -u$VERSION-armhf.tar.gz /media/$LBU_MEDIA
setup-bootable -u /media/$LBU_MEDIA/new /media/$LBU_MEDIA

Now we clean what we downloaded, backup and reboot. Hopefully everything works!

rm -r alpine-rpi-$VERSION-armhf.tar.gz new/
lbu ci
Written by Dhole