Experience with Alpine Linux

Alpine Linux Nix Linux

Experience with Alpine Linux (and some Nix)

After a good day spent researching various Linux distributions using the very useful and very reliable Distrowatch site, I settled on exploring Alpine Linux.

Alpine - the first reading

Well, the documentation on the front page seemed promising, as it gave several use-cases for Alpine and pointed out several install images to choose from. My Linux machine was to be a VMware Workstation VM hosted on Windows 10. Alpine actually had a virtualized install package for that. Points for them.

But the User Handbook was labelled version 0.1. Hmmm, this might not be so good.

The first few sections (Introduction, selecting the installation medium, and booting) are fairly well written. The expected audience knowledge seems to vary widely, from novice to experienced (for example, knowing what a kernel boot option is).

Where the handbook falls down seriously is in the “Automatic” installation instructions. Where to begin? There is so much wrong with this section:

Clear? I thought not.

The Semi-Automatic section describes in detail how to select options for keyboard, hostname, networking etc. This seems mostly correct.

But only after reading a few of these, and examining the setup-alpine script itself, did I realize there are a number of setup-xxx scripts for each topic. Duh. But why not say so?

Eventually I got the networking corrected and the system rebooted.

When trying to get Xwindows running, the unhelpful doc says if you don’t like lxdm,

In case you want a different DE or DM, you should install those now.

And, what are the options? No word. (There is a list on the Alpine Desktop Environment wiki.)

Alpine assumptions

The primary purpose seems to be running containers, and not so much running software. That’s perfectly fine: know your customer!

The base system is adequately small (see my list of requirements) and reboots very quickly.

Alpine is based on the MUSL library instead of GLIBC. What this means in the end is that not all software will necessarily build correctly (MUSL is not pin-for-pin compatible with GLIBC).

See MUSL for GLIBC for a description of MUSL and what it might mean for you.

The other big difference is use of busybox instead of GNU command-line utilities. This becomes obvious when you try additional options for top, ls, ps and so on. And they aren’t there.

See BusyBox website for details.

Alpine is very basic

Out of the box you get a root account. And a few packages pre-installed. And that’s all.

To make it useful, add users and setup groups in a way most other Linux distros will automate. This is not a bad thing, it’s just what it is:

addgroup -g 1000 dobby
adduser -h /home/dobby -g 1000 -S -s /bin/sh dobby
addgroup dobby video
addgroup dobby input
addgroup dobby audio
addgroup dobby cdrom

And repeat for other user accounts as needed.

Alpine package management

There is a website with a list of packages, divided into “main” (meaning officially supported) and “community” packages.

Alpine Packages is the website. It’s quick, has multiple choices to select where to look for something (such as Fortran, for which you type *fortran* in the search box).

Add a package with apk, as in

apk add curl rsync doas doas-doc
apk add xf86-video-intel
apk add mandoc mandoc-doc cwm cwm-doc
apk add xterm lxterminal freeglut-dev lxterminal font-space-mono-nerd
apk add xset xcalc util-linux alpine-sdk zlib-dev

apk add ttf-dejavu
fc-cache -f -v \
    /usr/share/texmf-dist/fonts/truetype/google \
    /usr/share/texmf-dist/fonts/truetype/public

(which represents the total value of several days of exploring how to locate and install packages to do what I wanted. In this case, running cwm window manager and porting the mangl manpage viewer).

Can’t run

As seems to be typical with many operating systems, finding what you need to install to do task X or Y seems to be most of the effort. Especially compared to ./configure; make.

In the end, the list of missing packages, and the MUSL library results in some difficulties getting things to just work.

For example, Julia didn’t work, despite having a MUSL version.

Nix

We are not here to rescue you, but you will not die in vain.

–Capt Kirk

I tried the Nix layer for apps. Nix rewrites your PATH variable and provides individually self-consistent packages. These are buried in a large complex directory structure in your home or a system directory.

The only cost is disk space for all those files; not really a big deal these days.

The “new” Nix utility suite is a rewrite of prior versions. (The documentation made several apologies for possible issues.) I tried version 2.5.1 (I think it was):

curl -o t.t -L  https://nixos.org/nix/install
vi t.t      ## no changes
sh t.t

takes a long time, 15 minutes, about 400MB RAM, 1.5GB virtual memory.

. .nix-profile/etc/profile.d/nix.sh

This auto-updates your .profile/etc/profile

You must comment out the .profile stuff for other managers (spack*/ and .local/). An example very simple install is:

nix-env -i hello

This takes a long time, 15 minutes, but downloads a lot of prerequisites. An example installation of Python SciPy is:

nix-env -iA nixpkgs.python39Packages.scipy

is pretty quick for determining additional prerequisites and a 50MB download. But then I tried search:

nix search nixpkgs lapack

This copies a 27MB tar file, then a memory leak overloads memory and the command does not complete.

I gave up on Nix.

Conclusion

Alpine had promise as a relatively small and simple Linux distro. But the issues around documentation lead me to think that developers are interested in their own vision of code construction but have no time for documentation. The wiki has a lot of HowTos and Tutorials. But there is no documentation in the form of a manpage or complete list of Alpine-specific scripts.

Nobody is doing any objective documentation reviews. For example, putting the UEFI description in a list of Post-installations tasks is just plain wrong.

Adding other layers or building own software just didn’t work, largely due to the MUSL lib. A GLIBC version of Alpine, plus adequate documentation, would be a useful thing.

And Nix. A memory leak on package search? Really?

Both of these groups are failing to see their projects with the eyes of their users. Documentation and testing cannot be afterthoughts.

November 2021



OpenBSD Numerics | My Linux Experience | Experience with Alpine Linux | Experience with Clear Linux