Kirsle.net logo Kirsle.net

The little things they don't tell you about Linux

September 15, 2020 (updated January 15, 2021) by Noah

When we're talking about "Linux" the operating system, we really mean one of the thousands of Linux distributions that exist out there. Linux itself is just the kernel -- the lowest level part of the operating system that deals with hardware, drivers, process and memory management. A distribution is all the stuff on top: the software, the desktop environments and so on.

Most Linux distributions can be called "GNU/Linux" because they include the Linux kernel and a suite of software tools from the GNU project. These are mostly command-line programs like grep and less as well as deeper system components like the GNU C Library (glibc) which is used by basically every program on the system.

When you're new to Linux you may look at this enormous list of distributions and be paralyzed as to which one you should pick. Fedora, or Ubuntu? Or Debian or Arch?

People will often tell you: it doesn't really matter, all these distributions are running more-or-less the same software and the biggest differences between them is their package manager and what format their software is shipped in. On Fedora you might dnf install firefox or dnf update thunderbird whereas on Debian you would apt install firefox or on Alpine you'll apk add firefox. Just learn the set of commands for your distro of choice and you're good. Software on Fedora-like distros come in .rpm packages, Debian-likes come in .deb, but mainly you'll install software through the official repositories of your distro.

But there's more differences between the distros that they don't tell you about:

Naming conventions for software

Each distribution family names their software packages differently. Almost all of them call Firefox firefox, but where they really start to differ is when it comes to development libraries and non-user-facing software.

The Red Hat/Fedora naming convention is: the development library is named the same as the runtime environment except with the suffix -devel attached. SDL2 is a popular game development library, and on Fedora you can dnf install SDL2 to get the runtime for it (needed if you just want to run a program that uses SDL), and if you're compiling a program you need the development library: dnf install SDL2-devel. OpenGL? Either opengl or opengl-devel.

But on Debian systems the suffix is -dev for development libraries. Oh and they also typically put a prefix of lib in front of everything. apt install libsdl2 to get the runtime, and apt install libsdl2-dev to get the development libraries.

This makes it a challenge when you're given instructions on how to build some software and it was written for Ubuntu or Debian but you're running Fedora. Almost all of the package names will be different, and just removing the "lib" and changing the suffix to "-devel" doesn't always work, so you'll be dnf searching sometimes to find the closest match to what you want.

Software is sometimes packaged differently

A common use case for Linux is to run it on your web servers. To this end, Apache and NGINX are popular web server software you would use.

Between Fedora-like and Debian-like distros, what you actually get when you install apache2 or nginx will vary. On Fedora, each web server comes with a single configuration file: /etc/apache2/apache2.conf, or /etc/nginx/nginx.conf respectively. This is okay enough for single-website servers, but a more common use case is to run multiple websites on the same server, each with their own domain names and their own settings.

Debian's layout here is much nicer: the apache2.conf or nginx.conf is pretty barebones, and Debian has folders labeled "sites-available" and "sites-enabled" where you place your per-site config files. It's out-of-the-box ready to set up multiple distinct websites with their own settings. You can configure Fedora to use a similar layout, but you have to set this up by hand, and you have to hand-edit the base apache2/nginx config file on each server you deploy.

On Debian, you could just backup your sites-available folder, install Debian on a fresh new server machine and copy your configs in, and it "just works" -- you don't even need to touch the base apache2/nginx config file.

For this reason I prefer Debian on my server machines because its software packaging is well suited for this common use case, while I prefer Fedora on all my desktop computers.

Why Fedora on desktops? Well...

Software may be newer or older by the distribution

Fedora is a "bleeding edge" distribution that always packages very recent versions of its software. When a new Firefox is released, Fedora has it available to install within a couple of days. Same for developer tools like git. The down side is, occasionally things may break when you dnf update all your software, but they're usually fixed again within a couple days.

Debian on the other hand is more focused on stability. They don't want to break your shit when you upgrade your software, and so they generally stick to older, stable, tried-and-tested versions of software. Under a Debian desktop, you can't install the latest version of Firefox by doing an apt upgrade. They ship Firefox's Extended Support Release which is a few versions behind current. So when some shiny new HTML5 feature is rolled out in Firefox, Debian won't get it for quite some time. Similarly, developer tools like git will be several major-versions behind the latest. This would occasionally annoy me when Git would add a major new feature and I couldn't use it from my Debian systems unless I want to install my own version of git from source code!

Note: under Debian you can upgrade from the stable branch to the testing or "unstable" for newer software versions. However, expect the occasional broken updates or dependency hell conflicts that don't get resolved in a very timely manner. I've run Debian unstable on desktops before... you get similarly new software as Fedora, but less stability than Fedora overall, so I don't bother anymore. And besides: you still can't apt install firefox and get the latest shiny because Debian has no interest to package the latest Firefox, only the ESR releases that eventually get merged into Debian stable!

Sometimes the GNU userspace is different

At least what most GNU/Linux distributions have in common is that they have the GNU userspace, so your command-line tools like grep will work the same everywhere.

Some distributions mix things up a lot though. In particular I'll talk about Alpine Linux, which is also the base behind postmarketOS which is an up-and-coming Linux distribution that runs on smart phones.

Alpine doesn't run the GNU userspace tools, so commands like grep behave differently and has different support for command-line flags. For example, grep --color will highlight the search term in the results by showing it in a different color, but Alpine's version of grep doesn't support this option and so will just give you errors when you use it. You can install the GNU tools on top of Alpine though to use those instead.

Another area Alpine differs is that they use musl libc instead of GNU libc, meaning all binary software released for Linux won't run as-is on Alpine and must be re-compiled from source code. Otherwise the software can't find the glibc libraries that they were built with. For proprietary, closed source software like Google Chrome that is only given to you in binary form, you just can't run these on a non-GNU system.

Another weird one is Busybox, though I've only seen this used on rooted Android systems. Busybox implements all the typical GNU command-line tools in a single binary, and it too has differences in feature support compared to their GNU counterparts.

Summary

While each Linux distribution looks the same on the surface (same desktop environments and applications), once you look under the hood there's quite a lot of variation from one distro to the next. And they have more differences than I've even highlighted here: systemd vs. sysvinit for managing services at startup (like your web servers) as one more example.

My recommendation is to pick a distro that meets your requirements (on software version recency, ease of server administration, or so on) and just stick to that one, learn the ins and outs of it, and don't worry too much about the other 10,000 distributions that exist out there.

For me, these are: Debian for servers, Fedora for desktops, and Alpine for embedded devices with limited resources such as smartphones or Internet of Things devices.

Tags:

Comments

There is 1 comment on this page. Add yours.

Avatar image
Anonymous posted on September 18, 2020 @ 20:50 UTC

This blog is awesome, keep it up.

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.