Difference between revisions of "Upgrading Alpine"

From Alpine Linux
Jump to: navigation, search
m (Update remaining packages from Web repository: join pars)
m (Update remaining packages from Web repository)
 
(27 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Warning|Make sure that you have a backup of your important data before continuing to update your system.}}
+
This page covers upgrading to newer releases.
 +
 
 +
Doing regular security updates with the package manager is shown at [[Alpine_Linux_package_management#Upgrade_a_Running_System|Upgrading a running system]].
 +
 
 +
 
 +
 
 +
{{Warning|Before actually upgrading your system, make sure that you have a backup of your important data.}}
 +
 
  
 
== Upgrading an Alpine Linux Hard-disk installation ==
 
== Upgrading an Alpine Linux Hard-disk installation ==
 +
 +
=== Upgrading from older versions ===
 +
 +
In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the next successor version as covered by the individual release notes, also check [[Upgrading from older versions]] for potential specifically required upgrade steps.
  
 
=== Upgrading to latest release ===
 
=== Upgrading to latest release ===
 +
 +
When Alpine Linux is installed in '''sys''' mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.
 +
 +
 
{{:Include:Upgrading to latest release}}
 
{{:Include:Upgrading to latest release}}
 +
 +
 +
  
 
=== Upgrading to Edge ===
 
=== Upgrading to Edge ===
 
{{:Include:Upgrading to Edge}}
 
{{:Include:Upgrading to Edge}}
  
=== Upgrading from older versions ===
 
  
See [[Upgrading from older versions]].
+
 
  
  
 
== Upgrading Alpine Linux on CD ==
 
== Upgrading Alpine Linux on CD ==
  
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 Linux box.
+
=== Boot media ===
  
=== Update remaining packages from Web repository ===
+
If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.
  
If you are using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.
+
If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box.  
{{:Include:Using_Internet_Repositories_for_apk-tools}}
 
  
Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
+
=== Update local package installations ===
{{Cmd|apk add -u apk-tools}}
 
  
{{Cmd|apk upgrade
+
If you have locally installed and configured additional packages using [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps.
sync}}
 
  
== Upgrading Alpine Linux on Flash Memory (such as CF/USB) ==
+
Backup the local configuration prior to upgrading.
 +
{{Cmd|lbu ci}}
  
Your installation may consist of Alpine Linux running on Compact Flash or USB media. In most cases, it should be sufficient to upgrade most packages using the '''Alpine Linux Hard-disk Installation''' upgrade procedures described above. However, for new packages to survive after a reboot, you should enable [[How_to_enable_APK_caching|APK caching]].
+
{{:Include:Upgrading to latest release}}
  
{{Warning|As the newer version of alpine may include kernel upgrades, simply pointing the Alpine Linux Package Manager to an Internet-based repository and running ''apk upgrade'' will not be enough, as kernel components are not upgraded when Alpine Linux is run from memory.}}
+
After upgrading the packages, save the upgraded configuration changes.
 +
{{Cmd|lbu ci}}
 +
 
 +
== Upgrading Alpine Linux on other removable media (such as CF/USB) ==
 +
 
 +
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using [[#Upgrading_an_Alpine_Linux_Hard-disk_installation|the procedures detailed above]], then running:
 +
{{Cmd|apk upgrade --update-cache --available}}
 +
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should [[How_to_enable_APK_caching|enable APK caching]].)
 +
 
 +
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.
  
 
{{:Include:Upgrading_Alpine_environmentvars}}
 
{{:Include:Upgrading_Alpine_environmentvars}}
Line 39: Line 63:
 
=== Upgrade Operating System ===
 
=== Upgrade Operating System ===
  
Start by checking that you have enough space on your media.<BR>
+
Start by checking that you have enough space on your media. For a '''standard''' Alpine image, you need at least 400MB available space.
You need at least 400MB available space.
+
{{Cmd|df -h {{!}} grep "Filesystem\{{!}}$LBU_MEDIA"}}
{{Cmd|df -h | grep "Filesystem\|$LBU_MEDIA"}}
 
  
 
==== Download and verify new release ====
 
==== Download and verify new release ====
  
Make sure the media is mounted readwrite.
+
Make sure the media that holds your Alpine system is mounted readwrite.
{{Cmd|mount --remount rw /media/$LBU_MEDIA}}
+
{{Cmd|mount -oremount,rw /media/$LBU_MEDIA}}
  
{{Tip|If using Alpine Linux 2.2.3 or newer, use the following command to download, mount and copy files as needed for you: {{Cmd|setup-bootable -u {{#latestalp:alpine|url}} /media/$LBU_MEDIA}}Once the command completes, proceed to the [[#Load new kernel|Load new kernel]] section. }}
+
'''If using Alpine Linux 2.2.3 or newer''': Download the latest release, {{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso}} and then use the following command to mount and copy files as needed for you: {{Cmd|setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA}} Once the command completes, proceed to the [[#Save changes|Save changes]] section.
  
 +
==== For older versions of Alpine ====
 
Start downloading a new '.iso' and a '.sha1' file  
 
Start downloading a new '.iso' and a '.sha1' file  
 
{{Cmd|cd /media/$LBU_MEDIA
 
{{Cmd|cd /media/$LBU_MEDIA
Line 55: Line 79:
 
wget {{#latestalp:alpine|url}}.sha1}}
 
wget {{#latestalp:alpine|url}}.sha1}}
  
Check integrity of the downloaded files ''(it might take some time)''
+
Check integrity of the downloaded files ''(it might take some time)'':
 
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}
 
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}
 
''The output of the above command should say 'OK'.<BR>''
 
''The output of the above command should say 'OK'.<BR>''
 
''If says 'FAILED', delete the iso file and download it again.''
 
''If says 'FAILED', delete the iso file and download it again.''
  
==== Copy the new release  ====
+
'''If using Alpine Linux 1.10.4 or newer''': there is a tool ''setup-bootable'' that will mount and copy the image you just downloaded to your boot medium. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}
{{Note|There is a tool, ''setup-bootable'', in alpine-1.10.4 and newer, that does the mounting and copying for you. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}Once the command completes, proceed to the [[#Load new kernel|Load new kernel]] section.
+
 
}}
+
[[Upgrading from older versions#Upgrading_a_removable_medium_from_Alpine_before_1.10.4|Instructions for older versions of Alpine]] are located elsewhere.
 +
 
 +
=== Save changes ===
 +
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).
 +
{{Cmd|lbu ci}}
 +
 
 +
=== Load new kernel ===
 +
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):
 +
{{Cmd|sync
 +
reboot}}
 +
 
 +
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}
 +
 
 +
=== Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1) ===
 +
On Alpine 3.X and newer, kernel is not upgraded when using <code>apk upgrade</code> and <code>setup-bootable</code> does not work properly.
 +
 
 +
If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :
 +
{{Cmd|apk update; apk version -l '<';
 +
apk upgrade;
 +
lbu ci;}}
 +
 
 +
So now all your packages are upgraded, you can upgrade your kernel.
 +
 
 +
1. We need to get some variables :
 +
{{Cmd|. /etc/os-release;
 +
. /etc/lbu/lbu.conf;}}
 +
 
 +
2. You '''must''' verify if they are correctly set, using this :
 +
{{Cmd|echo "alpine version : $VERSION_ID";
 +
echo "lbu media : $LBU_MEDIA";}}
 +
 
 +
3. And it will output something like this (if not, do not continue this process) :
 +
{{Cmd|alpine version : 3.13.5
 +
lbu media : mmcblk0p1}}
 +
 
 +
4. Then you can run this script :
 +
{{Cmd|cd /media/$LBU_MEDIA;
 +
mount -oremount,rw /media/$LBU_MEDIA;
 +
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz;
 +
wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256;
 +
sha256sum -c *.sha256;
 +
tar xzf alpine-rpi-$VERSION_ID-armhf.tar.gz;
 +
rm alpine-rpi-$VERSION_ID-armhf.tar.gz alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256;
 +
sync;
 +
reboot;}}
 +
 
 +
5. Test-it !
 +
{{Cmd|uname -a}}
  
Mount the ISO.
+
=== Update local package installations ===
 
{{Cmd|mount -t iso9660 {{#latestalp:alpine|file}} /mnt}}
 
 
Back up files that you have modified. For example, you might have modified ''syslinux.cfg'' to show console output on a serial port.<BR>
 
  
{{Cmd|cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my}}
+
This is done just as at [[#Update local package installations]], above.
  
Install the '''rsync''' package if necessary, and copy the files:
+
== Updating a USB/CF diskless install without setup-bootable ==
 +
It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.
  
{{Cmd|cd /mnt
+
Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:
apk add rsync
+
{{Cmd|apk update && apk upgrade -i -a --update-cache}}
rsync --delete -rltv .alpine-release * /media/$LBU_MEDIA/}}
 
  
Restore your backed up files ''(in case you had any)''
+
We can then use update-conf to check for changes to configurations from the new packages.
 +
{{Cmd|# check apk-new config changes
 +
update-conf -a -l
 +
update-conf -a
 +
}}
  
{{Cmd|mv -f /media/$LBU_MEDIA/syslinux.cfg.my /media/$LBU_MEDIA/syslinux.cfg}}
+
We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.
  
Make sure that all files are permanently saved in right place
+
We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)
  
{{Cmd|sync}}
+
{{Cmd|/etc/init.d/modloop stop
 +
mount /media/mmcblk0p1 -o remount,rw
 +
cd /media/mmcblk0p1
 +
}}
  
==== Clean up ====
+
At this point, remove all files from the SD media '''except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt''' Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.
Clean up the downloaded/unpacked files
 
{{Cmd|cd ..
 
umount /mnt
 
rm /media/$LBU_MEDIA/{{#latestalp:alpine|file}}
 
rm /media/$LBU_MEDIA/{{#latestalp:alpine|file}}.sha1}}
 
  
=== Save changes ===
+
We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system.  
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).
 
{{Cmd|lbu ci}}
 
  
=== Load new kernel ===
+
{{Cmd|wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):
+
wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz
{{Cmd|reboot}}
+
sha256sum -c *.sha256
{{Note|If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.}}
+
tar zxf *-aarch64.tar.gz && sync
 +
rm alpine-rpi-*
 +
}}
  
=== Update remaining packages from Web repository ===
+
Restore the original config.txt:
If you are using [[How_to_enable_APK_caching|APK caching]] you should perform the following steps:
+
{{Cmd|mv config.txt.bak config.txt}}
  
{{:Include:Using_Internet_Repositories_for_apk-tools}}
+
Update the persistent storage using lbu:
 +
{{Cmd|lbu ci -d}}
  
Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
+
We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:
{{Cmd|apk add -u apk-tools}}
+
{{Cmd|mount /media/mmcblk0p1 -o remount,rw
{{Cmd|apk upgrade
+
rm /media/mmcblk0p1/cache/*
sync}}
+
sync && apk update && apk cache -v download
 +
mount /media/mmcblk0p1 -o remount,ro
 +
}}
  
 
[[Category:Installation]]
 
[[Category:Installation]]
 
[[Category:Package Manager]]
 
[[Category:Package Manager]]

Latest revision as of 14:19, 5 July 2021

This page covers upgrading to newer releases.

Doing regular security updates with the package manager is shown at Upgrading a running system.


Tango-dialog-warning.png
Warning: Before actually upgrading your system, make sure that you have a backup of your important data.



Upgrading an Alpine Linux Hard-disk installation

Upgrading from older versions

In case an older version needs to be upgraded, i.e. not just upgrading from the last release to the next successor version as covered by the individual release notes, also check Upgrading from older versions for potential specifically required upgrade steps.

Upgrading to latest release

When Alpine Linux is installed in sys mode, e.g. on a hard drive, upgrading to the next stable version should be a straightforward package manager operation. However, for specific info always refer to the appropriate release notes.


Repository Settings

First thing is to to edit or check the /etc/apk/repositories file.

Besides doing it manually (see below) this may also be done using one of the following shortcuts.

  • Launching the corresponding alpine setup script,

    setup-apkrepos

    and pressing e to edit /etc/apk/repositories. Then adjusting (changing) the repository lines to the new version number by hand.
  • Or, use a one-liner command to edit (change) all versions in the file "in place". This is how you'd change v2.5 to v2.6:

    sed -i -e 's/v2\.5/v2.6/g' /etc/apk/repositories

Note, subsequent manual changes of the version numbers in /etc/apk/repositories may be avoided for following release upgrades, by having the repository lines refer to "latest-stable" instead of an absolute value:

http://dl-3.alpinelinux.org/alpine/latest-stable/main http://dl-3.alpinelinux.org/alpine/latest-stable/community

However, beware of initiating unexpected release upgrades then.


Manual editing of /etc/apk/repositories:


Edit the /etc/apk/repositories file using an editor (nano 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:

Contents of /etc/apk/repositories

/media/cdrom/apks http://dl-3.alpinelinux.org/alpine/v3.3/main

To upgrade, in this example, from version 3.3 to 3.4, simply change:

http://dl-3.alpinelinux.org/alpine/v3.3/main

to

http://dl-3.alpinelinux.org/alpine/v3.4/main

So that the file will look like this:

Contents of /etc/apk/repositories

/media/cdrom/apks http://dl-3.alpinelinux.org/alpine/v3.4/main
Note: Starting with version 3.3, there is a new repository called community. Many packages have been moved from the main repository to the community repository to indicate that they are not guaranteed to be supported beyond six months. If you are using any of these packages, be sure to add the community repository. For example: http://dl-3.alpinelinux.org/alpine/v3.3/community

Above, only one possible repository is shown, however, http://dl-3.alpinelinux.org/alpine/ may also be replaced with any geographically close mirror from: http://rsync.alpinelinux.org/alpine/MIRRORS.txt

Updating package lists

With the correct repositories file in place, the latest index list of available packages can be obtained with:

apk update

Tip: Adding the --update-cache or -U to another apk command, as in apk add -U ... or apk upgrade -U, has the same effect as always running apk update immediately before the other apk command. Instead of auto-update it only if the index has not been updated recently.



Upgrading packages

At times it is required to first upgrade just the Alpine Linux Package Manager itself to the latest available version, before upgrading any other package. This was the case, for example, when upgrading from a version of Alpine before 2.3.0_rc1. But simply always doing so shounld't hurt, either:

apk add --upgrade apk-tools

Next, to upgrade all installed packages:

apk upgrade --available

The --available switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc require doing this.

Note: All services that have been upgraded need to be restarted, to begin using the upgraded version. If the kernel is upgraded, it's required to reboot to begin using the upgraded version:

sync reboot



Upgrading to Edge

An upgrade of Alpine Linux from a stable version to the rolling development version edge basically requires the same steps as Upgrading to latest release.

The crucial difference is, that when editing the /etc/apk/repositories file, all referenced repository versions (such as v3.2 or latest-stable) therein need to be pointing to edge as in http://dl-3.alpinelinux.org/alpine/edge/main.

Tango-dialog-warning.png
Warning: Do not enable stable and edge repos at the same time! This can break your system! Either use edge or stable!.


After upgrading to edge, the currently installed edge version may be checked with

cat /etc/alpine-release

and referring to the build date that is attached to the release.



Upgrading Alpine Linux on CD

Boot media

If the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO.

If booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine Linux box.

Update local package installations

If you have locally installed and configured additional packages using APK caching you should also perform the following steps.

Backup the local configuration prior to upgrading.

lbu ci


Repository Settings

First thing is to to edit or check the /etc/apk/repositories file.

Besides doing it manually (see below) this may also be done using one of the following shortcuts.

  • Launching the corresponding alpine setup script,

    setup-apkrepos

    and pressing e to edit /etc/apk/repositories. Then adjusting (changing) the repository lines to the new version number by hand.
  • Or, use a one-liner command to edit (change) all versions in the file "in place". This is how you'd change v2.5 to v2.6:

    sed -i -e 's/v2\.5/v2.6/g' /etc/apk/repositories

Note, subsequent manual changes of the version numbers in /etc/apk/repositories may be avoided for following release upgrades, by having the repository lines refer to "latest-stable" instead of an absolute value:

http://dl-3.alpinelinux.org/alpine/latest-stable/main http://dl-3.alpinelinux.org/alpine/latest-stable/community

However, beware of initiating unexpected release upgrades then.


Manual editing of /etc/apk/repositories:


Edit the /etc/apk/repositories file using an editor (nano 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:

Contents of /etc/apk/repositories

/media/cdrom/apks http://dl-3.alpinelinux.org/alpine/v3.3/main

To upgrade, in this example, from version 3.3 to 3.4, simply change:

http://dl-3.alpinelinux.org/alpine/v3.3/main

to

http://dl-3.alpinelinux.org/alpine/v3.4/main

So that the file will look like this:

Contents of /etc/apk/repositories

/media/cdrom/apks http://dl-3.alpinelinux.org/alpine/v3.4/main
Note: Starting with version 3.3, there is a new repository called community. Many packages have been moved from the main repository to the community repository to indicate that they are not guaranteed to be supported beyond six months. If you are using any of these packages, be sure to add the community repository. For example: http://dl-3.alpinelinux.org/alpine/v3.3/community

Above, only one possible repository is shown, however, http://dl-3.alpinelinux.org/alpine/ may also be replaced with any geographically close mirror from: http://rsync.alpinelinux.org/alpine/MIRRORS.txt

Updating package lists

With the correct repositories file in place, the latest index list of available packages can be obtained with:

apk update

Tip: Adding the --update-cache or -U to another apk command, as in apk add -U ... or apk upgrade -U, has the same effect as always running apk update immediately before the other apk command. Instead of auto-update it only if the index has not been updated recently.



Upgrading packages

At times it is required to first upgrade just the Alpine Linux Package Manager itself to the latest available version, before upgrading any other package. This was the case, for example, when upgrading from a version of Alpine before 2.3.0_rc1. But simply always doing so shounld't hurt, either:

apk add --upgrade apk-tools

Next, to upgrade all installed packages:

apk upgrade --available

The --available switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc require doing this.

Note: All services that have been upgraded need to be restarted, to begin using the upgraded version. If the kernel is upgraded, it's required to reboot to begin using the upgraded version:

sync reboot

After upgrading the packages, save the upgraded configuration changes.

lbu ci

Upgrading Alpine Linux on other removable media (such as CF/USB)

The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using the procedures detailed above, then running:

apk upgrade --update-cache --available

will suffice for some purposes. (If you want the new packages to be used after a reboot, you should enable APK caching.)

However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.

Setup environment variables

To make the documentation a bit more "generic" we start by setting some environment variables.

vi /etc/lbu/lbu.conf

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.

Note: Even if you have you alpine installed on CF, HD or USB you can still choose to save your config on some other media that suits your needs. But remember that both the media where you have your Alpine system AND the media where you have your config need to be in your box when booting it.

Examples:

LBU_MEDIA=usb

or:

LBU_MEDIA=sda1

Now that you have your /etc/lbu/lbu.conf configured for your needs, we will set the environment variables (note the leading .).

. /etc/lbu/lbu.conf

You can test if your environment variable was set:

echo $LBU_MEDIA

It should output something like usb, sda1, or whatever you just configured.

Back up your config

Before starting to upgrade, it's wise to save your configuration.

lbu ci

Upgrade Operating System

Start by checking that you have enough space on your media. For a standard Alpine image, you need at least 400MB available space.

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

Download and verify new release

Make sure the media that holds your Alpine system is mounted readwrite.

mount -oremount,rw /media/$LBU_MEDIA

If using Alpine Linux 2.2.3 or newer: Download the latest release,

wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/<arch>/<image>.iso

and then use the following command to mount and copy files as needed for you:

setup-bootable -u alpine-extended-<version>-<arch>.iso /media/$LBU_MEDIA

Once the command completes, proceed to the Save changes section.

For older versions of Alpine

Start downloading a new '.iso' and a '.sha1' file

cd /media/$LBU_MEDIA wget -c {{#latestalp:alpine|url}} wget {{#latestalp:alpine|url}}.sha1

Check integrity of the downloaded files (it might take some time):

sha1sum -c {{#latestalp:alpine|file}}.sha1

The output of the above command should say 'OK'.
If says 'FAILED', delete the iso file and download it again.

If using Alpine Linux 1.10.4 or newer: there is a tool setup-bootable that will mount and copy the image you just downloaded to your boot medium. With this tool simply do:

setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA

Instructions for older versions of Alpine are located elsewhere.

Save changes

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

lbu ci

Load new kernel

In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):

sync reboot

Note: If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.

Update to latest kernel on armhf (eg. Raspberry Pi 0 or 1)

On Alpine 3.X and newer, kernel is not upgraded when using apk upgrade and setup-bootable does not work properly.

If you want to upgrade your kernel, you will need to get it from the latest release, but first you must have and run :

apk update; apk version -l '<'; apk upgrade; lbu ci;

So now all your packages are upgraded, you can upgrade your kernel.

1. We need to get some variables :

. /etc/os-release; . /etc/lbu/lbu.conf;

2. You must verify if they are correctly set, using this :

echo "alpine version : $VERSION_ID"; echo "lbu media : $LBU_MEDIA";

3. And it will output something like this (if not, do not continue this process) :

alpine version : 3.13.5 lbu media : mmcblk0p1

4. Then you can run this script :

cd /media/$LBU_MEDIA; mount -oremount,rw /media/$LBU_MEDIA; wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz; wget https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256; sha256sum -c *.sha256; tar xzf alpine-rpi-$VERSION_ID-armhf.tar.gz; rm alpine-rpi-$VERSION_ID-armhf.tar.gz alpine-rpi-$VERSION_ID-armhf.tar.gz.sha256; sync; reboot;

5. Test-it !

uname -a

Update local package installations

This is done just as at #Update local package installations, above.

Updating a USB/CF diskless install without setup-bootable

It is possible to update a diskless install of Alpine from another system, or without using the setup-bootable script. This was tested for the 3.13 to the 3.14 upgrade on a Raspberry Pi.

Before starting, update /etc/apk/repositories file to retrieve packages for the new release. Then update all packages with:

apk update && apk upgrade -i -a --update-cache

We can then use update-conf to check for changes to configurations from the new packages.

# check apk-new config changes update-conf -a -l update-conf -a

We now need to prepare to update the kernel and boot materials. To do this, we stop the modloop (which is the loopback mount providing kernel modules) and remount the SD media as read/write.

We can also shutdown the system, eject the media, and perform the next steps on another machine (if so, skip this command block)

/etc/init.d/modloop stop mount /media/mmcblk0p1 -o remount,rw cd /media/mmcblk0p1

At this point, remove all files from the SD media except for /cache, *.apkvol.tar.gz, usercfg.txt, and config.txt Rename config.txt to config.txt.bak temporarily, as extracting the new tar file will overwrite the file.

We can now download the new release and extract it. This example is for an Alpine Raspberry Pi release, so feel free to adjust the URLs for your system.

wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz.sha256 wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-rpi-3.13.0-aarch64.tar.gz sha256sum -c *.sha256 tar zxf *-aarch64.tar.gz && sync rm alpine-rpi-*

Restore the original config.txt:

mv config.txt.bak config.txt

Update the persistent storage using lbu:

lbu ci -d

We can now reboot, and this should boot into the new kernel. Once this is done, we can clean up and re-download apk caches:

mount /media/mmcblk0p1 -o remount,rw rm /media/mmcblk0p1/cache/* sync && apk update && apk cache -v download mount /media/mmcblk0p1 -o remount,ro