Alpine Linux is an interesting Linux distribution meant for embedded devices. Its key ability is running on a diskless system. Unlike other embedded distributions, it remains very usable for desktop use. The recommended, standard edition, runs a hardened Linux kernel with grsec and PaX patchsets. This strengthens the security of an already secure operating system. I will explain why I chose Alpine as my daily driver and share my opinion on its package management, memory footprint and shortcomings.
Why I chose Alpine
I used to have 2 hard drives grouped in a RAID 0 setup. I noticed that one of them had been dying, but I went on with my life… until I filled up my storage. To my surprise, both drives failed. I had to use my old USB flash drive until I get a new drive. As usual, I installed Arch Linux on the flash drive and used it like that for a week. Thanks to my past experience using Arch as a portable Linux installation, which boots on any x86 machine, I felt at home. However, it was quite slow for day-to-day use. I tried many things to speed up the drive. I used a utility called profile sync daemon, which moves the web browser’s profile and cache to RAM. I stuck to lightweight applications. That did not help much because my computing needs were already modest. I reconfigured file caching behavior of the kernel, without noticeable improvement.
So I decided to find a Linux distribution that boots to RAM. Alpine won mainly thanks to its simplicity, lightweightness and easy package management. Moreover, it has been the base of Docker images for some time, so Alpine’s userbase is much bigger than it seems.
I immediately fell in love with apk package manager. It is even simpler than Arch’s pacman (and much simpler than apt, yum and others). Most importantly, it is really fast. Packages in Alpine are compiled to be as small as possible, sometimes leaving out useful features. For example, I had to recompile ImageMagick for Import and Display capabilities because they were missing from the package shipped in Alpine’s repositories. This is fairly easy to do by following this article on Alpine’s wiki. Alpine’s APKBUILDs are very similar to Arch’s PKGBUILDs so Arch users will get the hang of apk quickly.
This is where Alpine excels. It is the most lightweight general purpose Linux distribution that is still properly maintained. Part of this is achieved by replacing glibc with musl, a lightweight implementation of the standard C library. Have a look at the memory footprint of a setup with Openbox and Chromium playing 720p youtube video: Right there it says 593 MB of RAM used. This is the root filesystem and the actual RAM consumed by running programs. Some distributions use this much RAM for running just Chromium by itself. This could be the most lightweight way to build a “pseudo-ChromiumOS”. I have actually made a setup like this for a family member, so that she can plug in her android phone mass storage anywhere and use her own Chromium workspace. The deployment times are pretty fast too. You can get a working Alpine setup in less than 2 minutes on good hardware. Much faster than most distributions will ever get.
One of its strengths is its biggest weakness - musl C library. While simple
programs compile just fine, others require patching. Theoretically, everything
should work when patched, but the difference in implementation between glibc
and musl make some problems hard to discover (i.e. it compiles fine but there
will be a very specific use case where the program fails at runtime). Next
problem is the lack of package maintainers. This is probably due to the small
userbase and the needed knowledge on patching things to work with musl. For
Arch users, who are likely to check out Alpine if they want to try something
new, the biggest shortcoming is the lack of packages. Out of the programs I
use, I could not find Termite and pass in the repositories. I use
rxvt-unicode instead. While Alpine is not a replacement for Arch or
similar distributions, it is very familiar.Users of Arch will find themselves
at home when using Alpine. Other than that, I have only had one problem with
Alpine and that was grsec kernel failing on my computer. The computer would
lock up and not respond to ping, ssh or anything. I am unable to identify the
cause of this, because the computer only responds to SysRq and I can’t back up
the data/logs from RAM to persistent storage. If this happens to you, go for
the vanilla kernel flavour of Alpine. You can have both grsec and vanilla on
the same media and pick whichever one you like during syslinux
I did not cover how the system works or how exactly I use it. This includes lbu backups, apk cache, encryption and some further tweaks that I will cover in the future.