Upgrading Alpine - v1.9.x
This document covers upgrading from a previous version of Alpine 1.9 (or 1.10) to newer versions of 1.9 (or 1.10). Thanks to many improvements in Alpine 1.9, it is possible to easily upgrade in most scenarios.
All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).
Upgrading an Alpine Linux Hard-disk installation
When Alpine is installed to hard drive, upgrading the installation is simple.
Edit the /etc/apk/repositories file using an editor ( for instance) and if necessary, add references to the Alpine package repositories. In the example below, the file references the Alpine CD, so that if a requested package is available on the local media, it will be obtained from there instead of being downloaded from the remote repository:
To upgrade, in this example, from version 3.3 to 3.4, simply change:
So that the file will look like this:
Above, only one possible repository is shown, however,
http://dl-3.alpinelinux.org/alpine/ may also be replaced with any geographically close mirror from:
Updating package lists
With the correct repositories file in place, the latest index list of available packages can be obtained with:
Ensure you have the latest available version of the Alpine Package Manager first before upgrading anything else:
apk add -u apk-tools
Finally, upgrade all remaining packages, including the kernel if applicable:
Upgrading Separate Boot Media
You may have an installation where the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information. In this case, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO. If you are booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine box.
Upgrading Alpine on CF/USB
Your installation may consist of Alpine running on Compact Flash or USB media. In most cases, it should be sufficient to upgrade most packages using the Alpine Hard-disk Installation upgrade procedures described above. However, for new packages to survive after a reboot, you should enable APK caching.
Setup environment variables
To make the documentation a bit more "generic" we start by setting some environment variables.
Make sure that the variable
LBU_MEDIA is not commented (by removing the leading '#').
You also need to set a appropriate value for your
LBU_MEDIA. The media you choose will be the media where you store your settings/configuration.
Now that you have your /etc/lbu/lbu.conf configured for your needs, we will set the environment variables (note the leading
You can test if your environment variable was set:
It should output something like
sda1, or whatever you just configured.
Back up your config
Before starting to upgrade, it's wise to save your configuration.
Start by checking that you have enough space on your media.
You need at least 400MB available space.
df -h | grep "Filesystem\|$LBU_MEDIA"
Download and verify new release
Start downloading a new '.iso' and a '.sha1' file
cd /media/$LBU_MEDIA wget -c Template:Latest 1.10 alpine iso-mirrorTemplate:Latest 1.10 alpine iso-filename wget http://dev.alpinelinux.org/alpine/v1.10/iso/Template:Latest 1.10 alpine iso-filename.sha1
Check integrity of the downloaded files (it might take some time)
sha1sum -c Template:Latest 1.10 alpine iso-filename.sha1
The output of the above command should say 'OK'.
If says 'FAILED', delete the iso file and download it again.
Copy the new release
Mount the ISO.
mount -t iso9660 Template:Latest 1.10 alpine iso-filename /mnt
Back up files that you have modified. For example, you might have modified syslinux.cfg to show console output on a serial port.
cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my
Install the rsync package if necessary, and copy the files:
cd /mnt apk add rsync rsync --delete -rltv .alpine-release * /media/$LBU_MEDIA/
Restore your backed up files (in case you had any)
mv -f /media/$LBU_MEDIA/syslinux.cfg.my /media/$LBU_MEDIA/syslinux.cfg
Make sure that all files are permanently saved in right place
Clean up the downloaded/unpacked files
cd .. umount /mnt rm /media/$LBU_MEDIA/Template:Latest 1.10 alpine iso-filename rm /media/$LBU_MEDIA/Template:Latest 1.10 alpine iso-filename.sha1
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).
In most cases you will need to reboot Alpine (especially if there are changes in the kernel):