How to upgrade Alpine Linux 3.11 to 3.12

ADVERTISEMENTS



How to upgrade Alpine Linux

I am using Alpine Linux v3.10 or v3.11 with my LXD server. How do I upgrade Alpine Linux v3.10 to Alpine Linux v3.12? How can I upgrade Alpine Linux v3.11 to Alpine Linux v3.12?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.

When Alpine Linux is installed to hard drive or cloud server, upgrading to a newer stable version is easy:

Edit /etc/apk/repositories file, run: vi /etc/apk/repositories Change the version number by hand. For example, Alpine 3.11 to 3.12 Save and close the file Fetch latest index by running the apk update Upgrade all your Alpine Linux packages: apk upgrade --available && sync Reboot the system, run: reboot

Let us see all commands and examples in details.

Make a backup of your LXD container

Type the following command to create container snapshots:

$ lxc snapshot alpine-www01 "JUN052020"

Verify it:

$ lxc info alpine-www01

Sample outputs:

Name: alpine-www01 Remote: unix:// Architecture: x86_64 Created: 2019/01/04 06:25 UTC Status: Running Type: persistent Profiles: default Pid: 28917 Ips: lo: inet 127.0.0.1 lo: inet6 ::1 eth0: inet 10.105.28.45 vethJ4APTV eth0: inet6 fe80::216:3eff:fee6:6afa vethJ4APTV Resources: Processes: 34 CPU usage: CPU usage (in seconds): 3 Memory usage: Memory (current): 201.15MB Memory (peak): 203.21MB Network usage: eth0: Bytes received: 87.31kB Bytes sent: 435.99kB Packets received: 384 Packets sent: 333 lo: Bytes received: 17.74kB Bytes sent: 17.74kB Packets received: 30 Packets sent: 30 Snapshots: Feb-03-2019 (taken at 2019/02/02 18:38 UTC) (stateless) mar-04-2019 (taken at 2019/03/04 16:23 UTC) (stateless) may-04-2019 (taken at 2019/05/03 21:56 UTC) (stateless) June-21-2019 (taken at 2019/06/20 19:58 UTC) (stateless) June-24-2019 (taken at 2019/06/23 20:29 UTC) (stateless) DEC232019 (taken at 2019/12/23 18:20 UTC) (stateless) JUN052020 (taken at 2020/06/05 10:45 UTC) (stateless)

Now login to your Alpine Linux box/LXD VM using ssh command or lxc command.

Find out your Alpine Linux version

Type the following command:

$ cat /etc/alpine-release

3.11.6

Apply all pending updates for 3.11.xx

Simply run the apk command:

# apk update

# apk upgrade

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:

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

To update to 3.5.xx, enter:

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

Change the version number by hand. For example, the default entry for 3.5 is as follows:

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

To update to 3.5.xx, enter:

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

For example, 3.11.xx it is as follows:

http://dl-cdn.alpinelinux.org/alpine/v3.11/main

So make it as follows for 3.12.xx upgrade, enter:

http://dl-cdn.alpinelinux.org/alpine/v3.12/main

Save and close the file. Here is my sample config file displayed using cat command:

# cat /etc/apk/repositories

Sample outputs:

http://dl-cdn.alpinelinux.org/alpine/v3.12/main http://dl-cdn.alpinelinux.org/alpine/v3.12/community

Next, grab the latest index using apk command:

# apk update

Sample outputs:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz v3.12.0-45-g0e4d4e3558 [http://dl-cdn.alpinelinux.org/alpine/v3.12/main] v3.12.0-47-gda1c1b9ae4 [http://dl-cdn.alpinelinux.org/alpine/v3.12/community] OK: 12830 distinct packages available

To upgrade all your packages, run apk command:

# apk upgrade --available

OR

# apk upgrade --purge

Sample outputs:

Upgrading critical system libraries and apk-tools: (1/1) Upgrading apk-tools (2.10.5-r0 -> 2.10.5-r1) Executing busybox-1.31.1-r9.trigger Continuing the upgrade transaction with new apk-tools: (1/106) Upgrading musl (1.1.24-r2 -> 1.1.24-r8) (2/106) Upgrading busybox (1.31.1-r9 -> 1.31.1-r16) Executing busybox-1.31.1-r16.post-upgrade (3/106) Upgrading alpine-baselayout (3.2.0-r3 -> 3.2.0-r7) Executing alpine-baselayout-3.2.0-r7.pre-upgrade Executing alpine-baselayout-3.2.0-r7.post-upgrade (4/106) Upgrading openrc (0.42.1-r2 -> 0.42.1-r10) Executing openrc-0.42.1-r10.post-upgrade (5/106) Upgrading alpine-conf (3.8.3-r6 -> 3.9.0-r1) (6/106) Replacing libcrypto1.1 (1.1.1g-r0 -> 1.1.1g-r0) (7/106) Replacing libssl1.1 (1.1.1g-r0 -> 1.1.1g-r0) (8/106) Purging ca-certificates-cacert (20191127-r2) (9/106) Installing ca-certificates-bundle (20191127-r3) (10/106) Upgrading libtls-standalone (2.9.1-r0 -> 2.9.1-r1) (11/106) Upgrading ssl_client (1.31.1-r9 -> 1.31.1-r16) (12/106) Replacing zlib (1.2.11-r3 -> 1.2.11-r3) (13/106) Upgrading busybox-suid (1.31.1-r9 -> 1.31.1-r16) (14/106) Replacing busybox-initscripts (3.2-r2 -> 3.2-r2) Executing busybox-initscripts-3.2-r2.post-upgrade (15/106) Upgrading scanelf (1.2.4-r0 -> 1.2.6-r0) (16/106) Upgrading musl-utils (1.1.24-r2 -> 1.1.24-r8) (17/106) Upgrading libc-utils (0.7.2-r0 -> 0.7.2-r3) (18/106) Upgrading alpine-keys (2.1-r2 -> 2.2-r0) (19/106) Upgrading alpine-base (3.11.6-r0 -> 3.12.0-r0) (20/106) Upgrading ncurses-terminfo-base (6.1_p20200118-r4 -> 6.2_p20200523-r0) (21/106) Upgrading ncurses-libs (6.1_p20200118-r4 -> 6.2_p20200523-r0) (22/106) Upgrading readline (8.0.1-r0 -> 8.0.4-r0) (23/106) Upgrading bash (5.0.11-r1 -> 5.0.17-r0) Executing bash-5.0.17-r0.post-upgrade (24/106) Upgrading pkgconf (1.6.3-r0 -> 1.7.2-r0) (25/106) Upgrading bash-completion (2.9-r0 -> 2.10-r0) (26/106) Upgrading openrc-bash-completion (0.42.1-r2 -> 0.42.1-r10) (27/106) Upgrading bash-doc (5.0.11-r1 -> 5.0.17-r0) (28/106) Replacing bc (1.07.1-r1 -> 1.07.1-r1) (29/106) Upgrading ca-certificates (20191127-r2 -> 20191127-r3) (30/106) Upgrading nghttp2-libs (1.40.0-r0 -> 1.41.0-r0) (31/106) Upgrading libcurl (7.67.0-r0 -> 7.69.1-r0) (32/106) Upgrading curl (7.67.0-r0 -> 7.69.1-r0) (33/106) Replacing expat (2.2.9-r1 -> 2.2.9-r1) (34/106) Upgrading pcre2 (10.34-r1 -> 10.35-r0) (35/106) Upgrading git (2.24.3-r0 -> 2.26.2-r0) (36/106) Upgrading git-bash-completion (2.24.3-r0 -> 2.26.2-r0) (37/106) Replacing htop (2.2.0-r0 -> 2.2.0-r0) (38/106) Replacing less (551-r0 -> 551-r0) (39/106) Replacing less-doc (551-r0 -> 551-r0) (40/106) Installing libressl3.1-libcrypto (3.1.2-r0) (41/106) Installing libressl3.1-libssl (3.1.2-r0) (42/106) Installing libressl3.1-libtls (3.1.2-r0) (43/106) Upgrading libressl (3.0.2-r0 -> 3.1.2-r0) (44/106) Replacing popt (1.16-r7 -> 1.16-r7) (45/106) Upgrading logrotate (3.15.1-r0 -> 3.16.0-r0) (46/106) Upgrading logrotate-openrc (3.15.1-r0 -> 3.16.0-r0) (47/106) Upgrading man-pages (5.04-r0 -> 5.06-r1) (48/106) Replacing mariadb-common (10.4.13-r0 -> 10.4.13-r0) Executing mariadb-common-10.4.13-r0.post-upgrade (49/106) Upgrading libgcc (9.2.0-r4 -> 9.3.0-r2) (50/106) Upgrading libstdc++ (9.2.0-r4 -> 9.3.0-r2) (51/106) Replacing mariadb-client (10.4.13-r0 -> 10.4.13-r0) (52/106) Replacing mysql-client (10.4.13-r0 -> 10.4.13-r0) (53/106) Replacing libbsd (0.10.0-r0 -> 0.10.0-r0) (54/106) Replacing netcat-openbsd (1.130-r1 -> 1.130-r1) (55/106) Upgrading pcre (8.43-r0 -> 8.44-r0) (56/106) Upgrading nginx (1.16.1-r6 -> 1.18.0-r0) Executing nginx-1.18.0-r0.pre-upgrade Executing nginx-1.18.0-r0.post-upgrade (57/106) Replacing openssl (1.1.1g-r0 -> 1.1.1g-r0) (58/106) Replacing php7-common (7.3.18-r0 -> 7.3.18-r0) (59/106) Replacing argon2-libs (20190702-r1 -> 20190702-r1) (60/106) Upgrading libedit (20191211.3.1-r0 -> 20191231.3.1-r0) (61/106) Upgrading xz-libs (5.2.4-r0 -> 5.2.5-r0) (62/106) Upgrading libxml2 (2.9.10-r3 -> 2.9.10-r4) (63/106) Replacing php7 (7.3.18-r0 -> 7.3.18-r0) (64/106) Replacing php7-curl (7.3.18-r0 -> 7.3.18-r0) (65/106) Replacing php7-fpm (7.3.18-r0 -> 7.3.18-r0) (66/106) Replacing libxau (1.0.9-r0 -> 1.0.9-r0) (67/106) Replacing libxdmcp (1.1.3-r0 -> 1.1.3-r0) (68/106) Upgrading libxcb (1.13.1-r0 -> 1.14-r1) (69/106) Replacing libx11 (1.6.9-r0 -> 1.6.9-r0) (70/106) Replacing libxext (1.3.4-r0 -> 1.3.4-r0) (71/106) Replacing libice (1.0.10-r0 -> 1.0.10-r0) (72/106) Upgrading libuuid (2.34-r1 -> 2.35.2-r0) (73/106) Replacing libsm (1.2.3-r0 -> 1.2.3-r0) (74/106) Replacing libxt (1.2.0-r0 -> 1.2.0-r0) (75/106) Replacing libxpm (3.5.13-r0 -> 3.5.13-r0) (76/106) Installing brotli-libs (1.0.7-r5) (77/106) Replacing libbz2 (1.0.8-r1 -> 1.0.8-r1) (78/106) Replacing libpng (1.6.37-r1 -> 1.6.37-r1) (79/106) Upgrading freetype (2.10.1-r0 -> 2.10.2-r0) (80/106) Upgrading libjpeg-turbo (2.0.4-r0 -> 2.0.4-r1) (81/106) Upgrading libwebp (1.0.3-r0 -> 1.1.0-r0) (82/106) Replacing php7-gd (7.3.18-r0 -> 7.3.18-r0) (83/106) Upgrading libintl (0.20.1-r2 -> 0.20.2-r0) (84/106) Replacing php7-gettext (7.3.18-r0 -> 7.3.18-r0) (85/106) Replacing php7-json (7.3.18-r0 -> 7.3.18-r0) (86/106) Replacing php7-openssl (7.3.18-r0 -> 7.3.18-r0) (87/106) Replacing php7-mysqlnd (7.3.18-r0 -> 7.3.18-r0) (88/106) Replacing php7-mysqli (7.3.18-r0 -> 7.3.18-r0) (89/106) Replacing php7-opcache (7.3.18-r0 -> 7.3.18-r0) (90/106) Replacing php7-phar (7.3.18-r0 -> 7.3.18-r0) (91/106) Replacing php7-session (7.3.18-r0 -> 7.3.18-r0) (92/106) Replacing php7-simplexml (7.3.18-r0 -> 7.3.18-r0) (93/106) Upgrading socat (1.7.3.3-r1 -> 1.7.3.4-r0) (94/106) Replacing stunnel (5.56-r1 -> 5.56-r1) (95/106) Replacing stunnel-openrc (5.56-r1 -> 5.56-r1) (96/106) Replacing stunnel-doc (5.56-r1 -> 5.56-r1) (97/106) Upgrading libgd (2.2.5-r3 -> 2.3.0-r1) (98/106) Upgrading sqlite-libs (3.30.1-r2 -> 3.32.1-r0) (99/106) Upgrading vnstat (2.4-r1 -> 2.6-r1) (100/106) Upgrading vnstat-openrc (2.4-r1 -> 2.6-r1) (101/106) Installing libunistring (0.9.10-r0) (102/106) Installing libidn2 (2.3.0-r0) (103/106) Upgrading wget (1.20.3-r0 -> 1.20.3-r1) (104/106) Purging libressl3.0-libtls (3.0.2-r0) (105/106) Purging libressl3.0-libssl (3.0.2-r0) (106/106) Purging libressl3.0-libcrypto (3.0.2-r0) Executing busybox-1.31.1-r16.trigger Executing ca-certificates-20191127-r3.trigger Executing mdocml-apropos-1.14.5-r1.trigger OK: 112 MiB in 106 packages

Restart the server/VM container:

# sync

# reboot

Verify it:

$ cat /etc/alpine-release

3.12.0

Another alternative is to query /etc/issue :

# cat /etc/issue

Welcome to Alpine Linux 3.12 Kernel \r on an \m (\l)

Conclusion – Upgrade Alpine Linux

And there you have it, Alpine Linux upgraded from version 3.11 to 3.12. For more information see https://alpinelinux.org/.