≡ Menu

How to upgrade Alpine Linux 3.4 to 3.5.xx

I am using Alpine Linux v3.4 with my LXD server. How do I upgrade Alpine Linux v3.4 to Alpine Linux v3.5?

Before you type any one of the following command make sure that you have a backup of your important data before continuing to update your system. It is important that you keep full backup of your system. Alpine Linux is built around musl libc and busybox. This makes it smaller and more resource efficient than traditional GNU/Linux distributions. A container requires no more than 8 MB and a minimal installation to disk requires around 130 MB of storage. Not only do you get a fully-fledged Linux environment but a large selection of packages from the repository. Alpine Linux was designed with security in mind. The kernel is patched with an unofficial port of grsecurity/PaX, and all userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection. These proactive security features prevent exploitation of entire classes of zero-day and other vulnerabilities. When Alpine Linux is installed to hard drive or as LXD VM, upgrading to a newer stable version is straightforward.
Fig.01: Upgrading an Alpine Linux Hard-disk installation

Fig.01: Upgrading an Alpine Linux Hard-disk installation

Find out your Alpine Linux version

Type the following command:
$ cat /etc/alpine-release

How to upgrading to latest release

Edit /etc/apk/repositories file, enter:
# vi /etc/apk/repositories
Change the version number by hand. For example, the default entry for 3.4 is as follows:
To update to 3.5.xx, enter:
Save and close the file. Next grabt the latest index:
# apk update
Sample outputs:

fetch http://dl-3.alpinelinux.org/alpine//v3.5/main/x86_64/APKINDEX.tar.gz
v3.5.1-18-g5a911c1ac9 [http://dl-3.alpinelinux.org/alpine//v3.5/main]
OK: 5660 distinct packages available

To upgrade all your packages, run:
# apk upgrade --available
Sample outputs:

Upgrading critical system libraries and apk-tools:
(1/5) Installing libressl2.4-libcrypto (2.4.4-r0)
(2/5) Installing libressl2.4-libssl (2.4.4-r0)
(3/5) Upgrading apk-tools (2.6.7-r0 -> 2.6.8-r2)
(4/5) Purging libssl1.0 (1.0.2k-r0)
(5/5) Purging libcrypto1.0 (1.0.2k-r0)
Executing busybox-1.24.2-r13.trigger
Continuing the upgrade transaction with new apk-tools:
(1/13) Upgrading musl (1.1.14-r14 -> 1.1.15-r6)
(2/13) Upgrading busybox (1.24.2-r13 -> 1.25.1-r0)
Executing busybox-1.25.1-r0.post-upgrade
(3/13) Upgrading alpine-baselayout (3.0.3-r0 -> 3.0.4-r0)
Executing alpine-baselayout-3.0.4-r0.pre-upgrade
Executing alpine-baselayout-3.0.4-r0.post-upgrade
(4/13) Upgrading openrc (0.21-r3 -> 0.21.7-r4)
Executing openrc-0.21.7-r4.post-upgrade
(5/13) Upgrading alpine-conf (3.4.1-r5 -> 3.5.0-r2)
(6/13) Replacing zlib (1.2.8-r2 -> 1.2.8-r2)
(7/13) Upgrading busybox-suid (1.24.2-r13 -> 1.25.1-r0)
(8/13) Upgrading busybox-initscripts (3.0-r3 -> 3.0-r8)
Executing busybox-initscripts-3.0-r8.post-upgrade
(9/13) Replacing scanelf (1.1.6-r0 -> 1.1.6-r0)
(10/13) Upgrading musl-utils (1.1.14-r14 -> 1.1.15-r6)
(11/13) Upgrading libc-utils (0.7-r0 -> 0.7-r1)
(12/13) Upgrading alpine-keys (1.1-r0 -> 1.3-r0)
(13/13) Upgrading alpine-base (3.4.6-r0 -> 3.5.1-r0)
Executing busybox-1.25.1-r0.trigger
OK: 6 MiB in 16 packages

Restart the server/VM container:
# sync
# reboot

Verify it:
$ cat /etc/alpine-release

For more information see https://alpinelinux.org/.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 2 comments… add one }
  • Dimdo February 6, 2017, 3:29 pm

    Why two slashes?

  • Legion Anonymous February 17, 2017, 3:33 am

    RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.5/main' | tee -a /etc/apk/repositories \
    && echo 'http://dl-cdn.alpinelinux.org/alpine/v3.5/community' | tee -a /etc/apk/repositories \
    && apk upgrade --purge

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: ,