What the GNU?

Posted on Sep 26, 2021

OK, this is a post I’ve been planning for months, I think? Several past drafts have been injured and killed before I gave birth to this one, the succesful one. So, let’s jump straight into it: I wanna talk about GNU.

GNU. Not the FSF, not RMS… Why are all these three letter acronyms? Are all of these cover operations of some three letter agency? I hope saying that doesn’t get me into any trouble, so you better read my post before I suddenly disappear… Just kidding! But I will address the FSF and RMS some time in the future… Now, let’s just focus on the GNU.

This comes from a cultural thing that has bugged me for very long time. The Anglo FOSS community is way over this kind of stuff, except for the few people who still listen to the BS the FSF spits out… But the Spanish community loves the FSF and RMS so much it’s unnerving. Actually, I almost was about to write this post in Spanish, but then I realized that I enjoy writing in English way more than in my native language… for some reason?

So, this post is to cut off the falsehoods, the half truths, the weird propaganda around GNU. Some of it comes from the FSF, but most of it actually comes from their fans. This is not just a “culture war,” but this has actual, tangible technological consequences… and that’s what bothers me at most.

Let’s get into this, shall we?

And, by the way, if someone at the FSF is reading… Please, no emails? Thanks! We are acquainted already, and last time wasn’t very pleasant, OK? Nope, I will never say “GNU/Linux,” because…

GNU is just a userland.

But as in all good stories, there’s a lot of nuance, a lot of history… and people who defend the “GNU/Linux” name aren’t just idiots… In my opinion they confuse some historical accidents with what really goes on in a Linux system…

The Missing Userland/Kernel

GNU was going to be an operating system. We all know GNU stands for “GNU is Not UNIX” and the story behind that is that RMS wanted to write a clone of UNIX that wasn’t proprietary.

Writing an OS is hell. There are two ways to tackle writing one:

  1. Bottom-up: First write the low-level components, and then write the components which face the user (i.e. the so-called userland).
  2. Top-down: Write the userland first, within an existing OS, and then replace the low-level components with your own.

Torvalds chose method 1; RMS chose method 2. This explains so much of the history of FOSS and how the conflicting views of these two guys developed that I’m so baffled nobody talks about this.

Torvalds wanted to have an initial kernel working first. His motivations were more tech-oriented than philosophical in any means. He just wanted UNIX on his 386 computer; that was all the thought behind the project. And so he did: he wrote the system, which was able to run software compiled in the a.out binary format, targetting i386… and there he had it: the UNIX clone he always wanted…

RMS on the other hand wanted people to be freed from proprietary software. So he wanted to have usable tools as soon as possible, regardless of which OS people were using. So he went the userland-and-compiler-first route. He wrote a clone of the usual UNIX command line tools, which are known as the GNU coreutils, GCC, GNU roff,1 and of course GNU Emacs. His goal was to make people use FOSS as quickly as possible and also get some money from the sales to keep things going, because yes, RMS sold GNU software to pay for the physical media and expenses… Not sure how much margin he got from his sales, though.

I’m explaining this because we all know the history: GNU has, to this day, failed to produce a viable kernel. Linux, on the other hand, didn’t have a UNIX userland, so the only free option available was used as the natural option for the so infamous “Boot-Root” disks: Linux and the GNU userland. This marriage became more of a thing in 1992 with SLS and the awfully named Yggdrasil Linux/GNU/X distros, the first distros as we know them today.

But, wait… Why GNU? Why not use the BSD userland? Isn’t it like under a permissive license? And all BSDs predate GNU, so why didn’t that happen?

I don’t have an answer for this. I found some places talking about “BSD/Linux” probably being a licensing nightmare. Maybe that was the perception, but I truly can’t see it that way… How much BSD-licensed software is included in modern distros without any issues? No, I think there might’ve been a licensing issue… but not that one…

In the early 90s the legal status of the derivatives of 4.3BSD was being settled on court. These derivatives were the Net/1 and Net/2 BSDs. The legal mess of this case is massive and originated from the fact that UC Berkeley had written their BSD UNIX systems from code licensed from AT&T. Back in the 70s, UC Berkeley had closed a special deal with AT&T for educational and research purposes… but now, since the late 80s, BSD systems were trying to become something else. So Net/2 was an active effort to remove all AT&T code from BSD, as per make it freely distributable… but the company who later acquired all rights on System V from AT&T sued anyways, and then there was a suit against a proprietary derivative of Net/2 called BSD/386… Meanwhile 386BSD (seriously, the names…) was a free port of Net/2 to the i386 architecture, but legal threats were still a thing… And from 386BSD we got FreeBSD and NetBSD… and OpenBSD later on from NetBSD… But even if at that point all AT&T code was effectively gone from the new generation of i386-compatible BSD distros… How would’ve anyone risked to even touch BSD code in the early 90s? Stuff like this scares people out. So, when the lawsuits were settled in 1995, at that point, Linux was being used with GNU as its userland, of course. Again, I’m not stating this is the reason why, but I wouldn’t be surprised if this was a big factor in all of this.

If you got SCO v. Novell vibes from that story, yes… I think the whole BSD legal troubles were quite a precursor to the crisis Linux went through in the 2000s.

Meanwhile, GNU Hurd was and still is just a dream. Linux needed a userland. So, pairing Linux with GNU was an obvious choice… and quickly X11 came along too and Yggdrasil had the terrible idea of stating that that combination was going to be called Linux/GNU/X.

Some more stuff happened in the mid-90s. I won’t get into this, because there’s some controversy around this, but putting this in the most neutral way possible, the first time the GNU/Linux name became a thing was when Debian released their 0.9x versions in 1994-1995… because the FSF funded the project and according to Glyn Moody’s Rebel Code, the FSF included a clause in the funding contract that Debian was to be called a “GNU/Linux” distribution. To be honest with all of you, I haven’t found any other source for this outside Moody’s book.

You Use Linux without GNU

You might’ve heard more than once that “You can’t use Linux without GNU.” The story I’ve told you above might even back that claim up, right? OK, let’s now get into more…

…more history, actually, because amidst a very weird conflict between the FSF and Debian during Bruce Perens’s leadership which effectively ended the FSF funding Debian… and led to the creation of Software In the Public Interest (SPI) Foundation… Perens himself decided he would write an alternative UNIX userland that could fit in a diskette, so the Debian Installer would become smaller than if it used GNU coreutils… You know that userland, you have probably used when booting up your machine (no matter which distro), even if you didn’t know.

I’m talking Busybox.1

Oh, the irony. GNU was sort of naturally chosen as the second “root” disk in the early days of Boot-Root disks and now Debian was replacing it with a homebrewed alternative precisely because GNU had gotten way too big.

And nowadays, Busybox is the default userland on Alpine Linux. So much for “You can’t use Linux without GNU,” right? A whole Linux distro that has been able to get rid of GNU coreutils… and glibc (more on the GNU C Standard Library later)… and has no issues at all to be used as a desktop, or server, or even embedded system. Yes, you can install GNU coreutils and glibc on it and the Busybox binary will be shadowed by GNU coreutils, but as you see… it’s totally optional.2

But it goes way beyond that… If you’re using an initramfs image on boot, I bet it includes a copy of Busybox in it. There are many reasons why, like the fact that it’s a fat binary that includes all commands in one single place, statically linked; it’s perfect to make a userland available for the emergency shell when something does wrong… and for your init manager to use for services that are fired at early userspace.2 It might not be normal Linux operation, but it does show you can use Linux without GNU.

What about Plan 9 from User Space or suckless’s sbase or even creating a chroot where you install Busybox into it? It’s totally possible to use alternative userlands in your normal usage of your Linux system. I mean, look at this:

$ uname -a
Linux arch 5.14.7-arch1-1 #1 SMP PREEMPT Wed, 22 Sep 2021 21:35:11 +0000 x86_64 GNU/Linux
$ cat --version
cat (GNU coreutils) 8.32
Copyright © 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.
$ . 9 # Now let's switch to Plan 9 From User Space
$ cat --version
cat: can't open --version: No such file or directory

All of a sudden, my cat doesn’t like GNU extensions like long options… and I’m still on Arch; I haven’t launched any VM or anything like that… In fact, all that . 9 does is change the PATH variable so the Plan 9 commands get higher priority to those installed on /usr/bin. Just changing a variable changes the whole userland I’ve got available (. u reverts the change back).

You might be thinking… “Ariadna, you’re just doing this as a show off…” No, I actually use the Plan 9 userland frequently to test the portability of scripts. I also use bmake (NetBSD’s make implementation) on Arch to test my Makefiles as well! Being able to switch environments within the same OS is one of the greatest things on Linux. I’m not aware if anyone has ported any of the BSD userlands to Linux in a Plan 9 from User Space way, but I don’t see any technical reason why you couldn’t. Or just… hey, switch into an Alpine chroot and voilà you’re inside a Busybox-based userland… The amount of flexibility is astounding… So, don’t trap yourself into a technological cage just because some organization told you some very, very dubious stuff…

Using Linux without GNU is possible… If GNU was the common thing to use, it was just out of historical accidents and not a real technological dependency. Yet, there is more to the GNU userland…

GNU Is Just a (Horrible) Implementation of POSIX

The original plan for GNU was to be a whole OS, yes… But what we’ve got now is GNU being an implementation of the common UNIX userland commands. Now, you might’ve noticed that I haven’t used an acronym across this post… an acronym I use almost everywhere, namely POSIX.

The history of POSIX is a mess and goes back way longer than you might think. You might’ve heard or read from manpages that there was a thing called the SUS specification, the Single UNIX Specification. To put it very simply, POSIX was born out of that first standardization attempt. It’s actually way more complicated than that… and if you love compiling C stuff, you surely have come across a couple of macros which point to various historical stages of UNIX standardization pre-POSIX… like the X/Open Specification… Long story short, POSIX is what defines what UNIX is in our modern times.

And unfortunately, the only truly POSIX certified OSs are all proprietary, e.g. Solaris, HP-UX, AIX, UnixWare… and the weird hybrid beast that is macOS. It’s like we didn’t really learned anything from the UNIX wars in the 80s.

POSIX certified means that these OSs not only comply with POSIX but don’t add any compatible extensions. GNU, on the other hand, is POSIX compatible, but adds extensions (e.g. long options, options and behaviors that aren’t defined by the specs, etc.) For example, see the Synopsis section in sed(1) in OpenBSD:

     sed [-aEnru] [-i[extension]] command [file ...]
     sed [-aEnru] [-e command] [-f command_file] [-i[extension]] [file ...]

Now compare with the respective Synopsis section in sed(1) for the GNU version:

       sed [OPTION]... {script-only-if-no-other-script} [input-file]...

Yeah, sure, but… as soon as you take a look at all the options listed in the Description section… Options like --sandbox, --unbuffered, etc. I mean, does sed really need a switch (-s) to use input files separately rather than concatenating them into a stream? You can just use a for-loop in a shell script to do that.

And now, the POSIX standard manual page (sed(1p) on Linux systems; otherwise check it here):3

       sed [-n] script [file...]

       sed [-n] -e script [-e script]... [-f script_file]... [file...]

       sed [-n] [-e script]... -f script_file [-f script_file]... [file...]

It’s easy to see that the OpenBSD version is closer to POSIX than GNU’s. They do add extensions, like the widespread -i option, but it’s fairly close.

But again, GNU coreutils commands are full of very, very pointless extensions, like head counting bytes in the GNU version by using an option… when POSIX declares that the only unit head should know about is lines.

The problem with this is that if you unknowingly rely on GNU extensions you might believe your scripts will work anywhere, but might not. There’s nothing bad in using them if you know you’re using them. And that’s precisely the problem I see with many GNU fans: they more often than not are totally unaware of the portability issues GNU poses… and how “learning GNU” isn’t exactly “learning how to use UNIX.” I hope I never come across anyone that claims that the OpenBSD implementation, or any other non-GNU implementation of POSIX, is “wrong,” because they will definitely have a word with me.

And that’s why I hate bash. GNU bash is the C++ of shells. It tries to look like POSIX sh (like C++ tries to look like C), but lures everyone into using lots of non-portable constructs… and making them think “they know shell scripting.” No, you don’t. You just learned a very specific dialect that makes things in a very dubious way.

However, there’s way more as to why GNU is a horrible implementation that can make. This is sort of a meme already, but to me it shows a lot of what is wrong with the GNU project. You surely know what yes does, right? It starts an infinite loop that prints y to stdout or, alternatively, whatever you pass as its only command line argument. I’m pretty sure any of you would know how to implement this in your favorite language in what? 10 lines max?

OK, now have a look at the 120 lines long source of GNU yes. And compare now that behemoth against the implementation in OpenBSD, the one from sbase, or the one from busybox. Like… why does GNU yes does so many memory operations for a task that is implemented so easily by everyone else?

And I know, the yes meme is a meme… But now also have a look at this post on Drew DeVault’s blog about a way more serious issue affecting glibc which shows how everything in GNU is always unnecessarily convoluted, weird, hard (or impossible) to mantain… and ultimately for pointless reasons.

Speaking of glibc…

I think Drew’s post linked above makes a great job to show why glibc is horrible from a coding standpoint. My post on static libraries implicitly showed the huge size of GNU C Standard Library, compared to MUSL libc’s.

But I’m not going to get into that or extensions. There’s a reason why I always set POSIX_C_SOURCE to 200809L and use -std=c99 to shut down GNU extensions both in the library and the language, respectively.

But, Ariadna…

OK, I know. I use GNU software. I use Arch, so I’m kinda forced to use it. That’s part of what makes me angry, though. Why are we vendor locked into GNU? Why are we still pretending that’s good or not as evil as the vendor lock-in measures taken by Google, MS, or Apple? Landmining your userland and C Standard Library with extensions is exactly what MS does. When MS does it is bad, so why is it acceptable or tolerated when GNU does it?

You might’ve noticed though that I quite often use a word, not just on this post, but throughout many of them… That word, or rather… concept… is… You guessed it: portability.

Us people who care about portability see GNU as the limiting thing it is. And we like things following the standards already put in place. Because we don’t give a damn about helping the FSF do their thing: We care about tech. We care about and love the legacy of UNIX, its philosophy, and we want to adhere to it as strictly as possible.

If you’re just a regular user or a power user that only deals with the usual Linux distro with a GNU userland, you obviously don’t care about extensions or the terrible code quality of GNU. But I sincerely hope you never see yourself in the situation of touching a non-GNU userland in a critical moment. You might get bitten back.

And that’s the thing, isn’t it? The monoculture and the subtle implication from all the FSF propaganda that “GNU is the right, only truth…” Which is very far from it. I’m very, very sure that non-GNU userlands in Linux distros will start to pop up increasingly: Alpine Linux is just the start. It’s small, it’s a bit of a niche distro still… just give the idea some time and someone will make Alpine or a new distro big enough to become a serious competitor to the GNU monoculture. And then what?

I could’ve talked about Android and embedded Linux. I didn’t want to, though. But me not talking about them doesn’t mean they also show that the FSF telling half truths when it comes to what GNU is. If they had less of that holier than thou attitude I’d tolerate them way more… Them trying to put themselves into a priority position via branding, where… hey… systemd is nowadays way more important in many respects than GNU… Why isn’t anyone making the case for “systemd/Linux”? Or what about X11? For how many decades was it the only graphical server available? Why didn’t the X.org Foundation start bullying everyone to say that graphical Linux systems were “X11/Linux”?

The thing in the end is that the GNU project and the FSF strike to me as very cultish and immensely insecure. Hey, guys, if you’re still reading me over there in Massachussetts… You did a great job and were a key actor in us getting what we’ve got today… But know your place and write good software. And don’t give unsuspecting newcomers such a biased version of the story that only serves your interests… mmokay?

I want cultish followings to end within the FOSS community. I swear I’ll always work against that.

  1. If you thought I was going to go the “Android route” of argumentation… You know… saying that Android shows that Linux can be used without GNU… Sorry! I’m way more sophisticated than that! ↩︎ ↩︎

  2. Thanks to Alexey Yerin for clarifying a couple of things about Alpine! ↩︎ ↩︎

  3. Please, if you haven’t, do yourself a favor and install the Linux manpages package… That way you get the 1p and 3p sections with all the POSIX standard manual pages for both commands and the C Standard Library and syscalls! ↩︎