I've used various Linux distributions in the past, starting with a Knoppix live CD a long time ago. For a long time I was an Ubuntu user (with compiz-fusion ofcourse), then I used Arch Linux for years thinking it was the perfect distribution. Due to postmarketOS I found out about Alpine Linux and now after using that for some years I think I should write a post about it.

Installing

Ubuntu has the easy graphical installer of course. Installing Arch Linux the first time is quite an experience the first time. I believe Arch since has added a setup wizard now but I have not tried it.

Installing Alpine Linux is done by booting a live cd into a shell and installing from there just like Arch but it provides the setup-alpine shell script that runs you through the installation steps. It's about as easy as using the Ubuntu installer if you can look past the fact that it's text on a black screen.

A minimal Alpine installation is quite small, that combined with the fast package manager makes the install process really really quick.

Package management

The package management is always one of the big differentiators between distributions. Alpine has it's own package manager called APK, the Alpine Package Keeper. While it's now confused with the android .apk format it predates Android by two years.

The package management is pretty similar to Archlinux in some aspects. The APKBUILD package format is very similar to the pkgbuild files in Arch and the packages support similar features. The larger difference is the packaging mentality: Archlinux prefers to never split packages, just one .pkg.tar.zst file that contains all the features of the application and all the docs and development headers. Alpine splits out all these things to subpackages and the build system warns when the main package contains any documentation or development files.

For a minimal example of this let's compare the tiff library. In Alpine Linux this is split into 5 packages:

  • tiff, the main package that contains libtiff.so.6 [460 kB]
  • tiff-dev, the development headers [144 kB]
  • libtiffxx, the c++ bindings [28 kB]
  • tiff-doc, the documentation files [5.21 MB]
  • tiff-tools, command line tools like ppm2tiff [544 kB]

In Arch Linux this is a single package called libtiff that's 6.2 MB. For most Linux users you'd never need the library documentation which takes the most space in this example.

The end result is that my Archlinux installations are using around 10x the disk space my Alpine installations use if I ignore the home directories.

Some more differences are that Alpine provides stable releases on top of the rolling edge release branch. This improves reliablity a lot for my machines. You wouldn't normally put Arch Linux on a production server but I found Alpine to be almost perfect for that usecase. Things like the /etc/apk/world file makes management machines easier. It's basically the requirements.txt file for your Linux installation and you don't even need to use any extra configuration management tools to get that functionality.

There's also some downsides to apk though. Things I'm missing is optional packages and when things go wrong it has some of the most useless error messages I've encountered in software: temporary error (try again later) . Throwing away the original error and showing "user friendly" messages usually does not improve the situation.

Glibc or not to glibc

One of the main "issues" that get raised with Alpine is that it does not use glibc. Alpine Linux is a musl-libc based distribution. In practice I don't have many problems with this since most my software is just packaged by in the distribution so I wouldn't ever see that it's a musl distribution.

Issues appear mostly when trying to run proprietary software on top of Alpine or software that's so hard to build that you're in practice just getting the prebuilds. The solution to proprietary software is... don't use proprietary software :)

For the cases where that's not possible there's always either Flatpak or making a chroot with a glibc distribution in it.

Systemd

Beside not using glibc there's also no systemd in Alpine. This is one of the things I miss the most actually. I don't enjoy the enormous amount of different "best practices" for specifying init scripts and the bad documentation surrounding it. So far by best solution for creating idiomatic init scripts for alpine is just submitting something to the repository and wait until someone complains about style issues.

Beside that I'm pretty happy with the tools openrc provides for manageing services. The rc-update tool gives a nice consise overview of enabled boot services and the service tool just does what I expect. It seems like software is starting to depend on systemd restarting it instead of fixing memory leaks which causes me some issues sometimes.

Conclusion

Alpine Linux is neato. I try to use it everywhere I can.