How to upgrade Alpine Linux 3.10 to 3.11

last updated in Categories , ,

I am using Alpine Linux v3.9 or v3.10 with my LXD server. How do I upgrade Alpine Linux v3.9 to Alpine Linux v3.11? How can I upgrade Alpine Linux v3.10 to Alpine Linux v3.11?

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.
Fig.01: upgrade Alpine Linux Hard-disk or LXD VM installation
Fig.01: Upgrading an Alpine Linux Hard-disk installation

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.

Advertisements

How to upgrade Alpine Linux

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

  1. Edit /etc/apk/repositories file, run: vi /etc/apk/repositories
  2. Change the version number by hand. For example, Alpine 3.10 to 3.11
  3. Save and close the file
  4. Fetch latest index by running the apk update
  5. Upgrade all your Alpine Linux packages: apk upgrade --available && sync
  6. 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 "DEC232019"
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)

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

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
Change the version number by hand. For example, the default entry for 3.6 is as follows:
http://dl-cdn.alpinelinux.org/alpine/v3.6/main
Make sure you change the version number by hand. For example, the default entry for 3.7 is as follows:
http://dl-cdn.alpinelinux.org/alpine/v3.7/main
Make sure you change the version number by hand. For example, the default entry for 3.8 is as follows:
http://dl-cdn.alpinelinux.org/alpine/v3.8/main
Make sure you change the version number by hand. For example, the default entry for 3.9 is as follows:
http://dl-cdn.alpinelinux.org/alpine/v3.9/main
Make upgrade to 3.10.xx, enter:
http://dl-cdn.alpinelinux.org/alpine/v3.10/main
Finally, make sure you upgrade to 3.11.xx, enter:
http://dl-cdn.alpinelinux.org/alpine/v3.11/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.11/main
http://dl-cdn.alpinelinux.org/alpine/v3.11/community

Next, grab the latest index using apk command:
# apk update
Sample outputs:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.0-10-g70aed95e26 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.0-9-g7b1e07c92a [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11354 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.4-r2 -> 2.10.4-r3)
Executing busybox-1.30.1-r3.trigger
Continuing the upgrade transaction with new apk-tools:
(1/102) Upgrading musl (1.1.22-r3 -> 1.1.24-r0)
(2/102) Upgrading busybox (1.30.1-r3 -> 1.31.1-r8)
Executing busybox-1.31.1-r8.post-upgrade
(3/102) Upgrading alpine-baselayout (3.1.2-r0 -> 3.2.0-r3)
Executing alpine-baselayout-3.2.0-r3.pre-upgrade
Executing alpine-baselayout-3.2.0-r3.post-upgrade
(4/102) Upgrading openrc (0.41.2-r1 -> 0.42.1-r0)
Executing openrc-0.42.1-r0.post-upgrade
(5/102) Upgrading alpine-conf (3.8.3-r1 -> 3.8.3-r4)
(6/102) Upgrading libcrypto1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(7/102) Upgrading libssl1.1 (1.1.1d-r0 -> 1.1.1d-r2)
(8/102) Upgrading ca-certificates-cacert (20190108-r0 -> 20191127-r0)
(9/102) Replacing libtls-standalone (2.9.1-r0 -> 2.9.1-r0)
(10/102) Upgrading ssl_client (1.30.1-r3 -> 1.31.1-r8)
(11/102) Upgrading zlib (1.2.11-r1 -> 1.2.11-r3)
(12/102) Upgrading busybox-suid (1.30.1-r3 -> 1.31.1-r8)
(13/102) Upgrading busybox-initscripts (3.1-r7 -> 3.2-r2)
Executing busybox-initscripts-3.2-r2.post-upgrade
(14/102) Upgrading scanelf (1.2.3-r0 -> 1.2.4-r0)
(15/102) Upgrading musl-utils (1.1.22-r3 -> 1.1.24-r0)
(16/102) Upgrading libc-utils (0.7.1-r0 -> 0.7.2-r0)
(17/102) Replacing alpine-keys (2.1-r2 -> 2.1-r2)
(18/102) Upgrading alpine-base (3.10.3-r0 -> 3.11.0-r0)
(19/102) Upgrading ncurses-terminfo-base (6.1_p20190518-r0 -> 6.1_p20191130-r0)
(20/102) Upgrading ncurses-terminfo (6.1_p20190518-r0 -> 6.1_p20191130-r0)
(21/102) Upgrading ncurses-libs (6.1_p20190518-r0 -> 6.1_p20191130-r0)
(22/102) Upgrading readline (8.0.0-r0 -> 8.0.1-r0)
(23/102) Upgrading bash (5.0.0-r0 -> 5.0.11-r1)
Executing bash-5.0.11-r1.post-upgrade
(24/102) Installing pkgconf (1.6.3-r0)
(25/102) Upgrading bash-completion (2.8-r0 -> 2.9-r0)
(26/102) Upgrading openrc-bash-completion (0.41.2-r1 -> 0.42.1-r0)
(27/102) Upgrading bash-doc (5.0.0-r0 -> 5.0.11-r1)
(28/102) Replacing bc (1.07.1-r1 -> 1.07.1-r1)
(29/102) Upgrading ca-certificates (20190108-r0 -> 20191127-r0)
(30/102) Upgrading nghttp2-libs (1.39.2-r0 -> 1.40.0-r0)
(31/102) Upgrading libcurl (7.66.0-r0 -> 7.67.0-r0)
(32/102) Upgrading curl (7.66.0-r0 -> 7.67.0-r0)
(33/102) Upgrading expat (2.2.8-r0 -> 2.2.9-r0)
(34/102) Upgrading pcre2 (10.33-r0 -> 10.34-r1)
(35/102) Upgrading git (2.22.2-r0 -> 2.24.1-r0)
(36/102) Upgrading git-bash-completion (2.22.2-r0 -> 2.24.1-r0)
(37/102) Replacing htop (2.2.0-r0 -> 2.2.0-r0)
(38/102) Replacing less (551-r0 -> 551-r0)
(39/102) Replacing less-doc (551-r0 -> 551-r0)
(40/102) Installing libressl3.0-libcrypto (3.0.2-r0)
(41/102) Installing libressl3.0-libssl (3.0.2-r0)
(42/102) Installing libressl3.0-libtls (3.0.2-r0)
(43/102) Upgrading libressl (2.7.5-r0 -> 3.0.2-r0)
(44/102) Replacing popt (1.16-r7 -> 1.16-r7)
(45/102) Upgrading logrotate (3.15.0-r0 -> 3.15.1-r0)
(46/102) Upgrading logrotate-openrc (3.15.0-r0 -> 3.15.1-r0)
(47/102) Upgrading mdocml (1.14.3-r3 -> 1.14.5-r1)
(48/102) Upgrading man (1.14.3-r3 -> 1.14.5-r1)
(49/102) Upgrading man-pages (5.01-r0 -> 5.04-r0)
(50/102) Upgrading mdocml-apropos (1.14.3-r3 -> 1.14.5-r1)
(51/102) Upgrading mariadb-common (10.3.20-r0 -> 10.4.10-r0)
Executing mariadb-common-10.4.10-r0.post-upgrade
(52/102) Upgrading libgcc (8.3.0-r0 -> 9.2.0-r3)
(53/102) Upgrading libstdc++ (8.3.0-r0 -> 9.2.0-r3)
(54/102) Upgrading mariadb-client (10.3.20-r0 -> 10.4.10-r0)
(55/102) Upgrading mysql-client (10.3.20-r0 -> 10.4.10-r0)
(56/102) Upgrading libbsd (0.9.1-r0 -> 0.10.0-r0)
(57/102) Replacing netcat-openbsd (1.130-r1 -> 1.130-r1)
(58/102) Replacing pcre (8.43-r0 -> 8.43-r0)
(59/102) Upgrading nginx (1.16.1-r1 -> 1.16.1-r4)
Executing nginx-1.16.1-r4.pre-upgrade
Executing nginx-1.16.1-r4.post-upgrade
(60/102) Upgrading php7-common (7.3.11-r0 -> 7.3.13-r0)
(61/102) Upgrading argon2-libs (20171227-r2 -> 20190702-r1)
(62/102) Upgrading libedit (20190324.3.1-r0 -> 20191211.3.1-r0)
(63/102) Installing xz-libs (5.2.4-r0)
(64/102) Upgrading libxml2 (2.9.9-r2 -> 2.9.10-r1)
(65/102) Upgrading php7 (7.3.11-r0 -> 7.3.13-r0)
(66/102) Upgrading php7-curl (7.3.11-r0 -> 7.3.13-r0)
(67/102) Upgrading php7-fpm (7.3.11-r0 -> 7.3.13-r0)
(68/102) Replacing libxau (1.0.9-r0 -> 1.0.9-r0)
(69/102) Replacing libxdmcp (1.1.3-r0 -> 1.1.3-r0)
(70/102) Replacing libxcb (1.13.1-r0 -> 1.13.1-r0)
(71/102) Upgrading libx11 (1.6.8-r1 -> 1.6.9-r0)
(72/102) Replacing libxext (1.3.4-r0 -> 1.3.4-r0)
(73/102) Upgrading libice (1.0.9-r3 -> 1.0.10-r0)
(74/102) Upgrading libuuid (2.33.2-r0 -> 2.34-r1)
(75/102) Replacing libsm (1.2.3-r0 -> 1.2.3-r0)
(76/102) Upgrading libxt (1.1.5-r2 -> 1.2.0-r0)
(77/102) Upgrading libxpm (3.5.12-r0 -> 3.5.13-r0)
(78/102) Upgrading libbz2 (1.0.6-r7 -> 1.0.8-r1)
(79/102) Replacing libpng (1.6.37-r1 -> 1.6.37-r1)
(80/102) Upgrading freetype (2.10.0-r0 -> 2.10.1-r0)
(81/102) Replacing libjpeg-turbo (2.0.3-r0 -> 2.0.3-r0)
(82/102) Upgrading libwebp (1.0.2-r0 -> 1.0.3-r0)
(83/102) Upgrading php7-gd (7.3.11-r0 -> 7.3.13-r0)
(84/102) Upgrading libintl (0.19.8.1-r4 -> 0.20.1-r2)
(85/102) Upgrading php7-gettext (7.3.11-r0 -> 7.3.13-r0)
(86/102) Upgrading php7-json (7.3.11-r0 -> 7.3.13-r0)
(87/102) Upgrading php7-openssl (7.3.11-r0 -> 7.3.13-r0)
(88/102) Upgrading php7-mysqlnd (7.3.11-r0 -> 7.3.13-r0)
(89/102) Upgrading php7-mysqli (7.3.11-r0 -> 7.3.13-r0)
(90/102) Upgrading php7-opcache (7.3.11-r0 -> 7.3.13-r0)
(91/102) Upgrading php7-phar (7.3.11-r0 -> 7.3.13-r0)
(92/102) Upgrading php7-session (7.3.11-r0 -> 7.3.13-r0)
(93/102) Upgrading php7-simplexml (7.3.11-r0 -> 7.3.13-r0)
(94/102) Upgrading socat (1.7.3.3-r0 -> 1.7.3.3-r1)
(95/102) Replacing libgd (2.2.5-r2 -> 2.2.5-r2)
(96/102) Installing sqlite-libs (3.30.1-r1)
(97/102) Upgrading vnstat (1.18-r0 -> 2.4-r1)
(98/102) Installing vnstat-openrc (2.4-r1)
(99/102) Replacing wget (1.20.3-r0 -> 1.20.3-r0)
(100/102) Purging libressl2.7-libtls (2.7.5-r0)
(101/102) Purging libressl2.7-libssl (2.7.5-r0)
(102/102) Purging libressl2.7-libcrypto (2.7.5-r0)
Executing busybox-1.31.1-r8.trigger
Executing ca-certificates-20191127-r0.trigger
Executing mdocml-apropos-1.14.5-r1.trigger
OK: 115 MiB in 100 packages

Restart the server/VM container:
# sync
# reboot

Verify it:
$ cat /etc/alpine-release
3.11

Conclusion – Upgrade Alpine Linux

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

ADVERTISEMENTS

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Notable Replies

  1. It is actually not updating current /etc/alpine-release file but creating another one. You can verify that with the following commands:

    ls -l /etc/alpine-release* 
    
  2. yes, if you followed info provided on my page your container is on 3.9. It is just that apk no longer updating original file and saving it as /etc/alpine-release.apk-new. Another way to verify it, just run:

    cat /etc/issue
    

    Screenshot%20from%202019-02-19%2016-18-39
    HTH

Continue the discussion www.nixcraft.com

4 more replies

Participants

Historical Comment Archive

9 comment


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

    Still, have a question? Get help on our forum!