mccd

pub   rsa4096 2023-09-22 [SC]

2F30 1709 2782 FD05 CCCF 7964 647E 396D 1F4E AE7B

uid              Marc  Coquand  <[email protected]>

comma mastodon rss git

Why I Like NetBSD, or Why Portability Matters

NetBSD is one of the oldest BSDs still around, its initial release being in 1993. NetBSD is based on the original UCB 4.3 BSD, and upon installation provides a small old-school minimal desktop. Out of all the already niche BSD systems, it is one of the smaller ones. The more used BSDs these days are FreeBSD, famous for its focus on performance, and OpenBSD, the security focused fork of NetBSD. More than any BSD, Linux has by far the largest user base.

I personally do not know too many places where NetBSD is being used, but I do know that Void Linux, an incredible Linux distro, was built by a NetBSD developer. I also know that sdf.org, the O.G. communal unix environment, runs on NetBSD. Fun fact: when Ritchie first envisioned Unix, the idea was very much based around the idea of communal computing, with people coming together to build the specific tools they need for their community using smaller tools. The way Ritchie described it is:

What we wanted to preserve was not just a good environment in which to do programming, but a system around which a fellowship could form. We knew from experience that the essence of communal computing, as supplied by remote-access, time-shared machines, is not just to type programs into a terminal instead of a keypunch, but to encourage close communication.

So why use NetBSD? Many of its proponents would argue that NetBSD also has its own niche: the focus on portability. At the time I first heard about portability, I took it to roughly mean that you can run it on any machine. Now my understanding of the concept has evolved and I want to talk a bit about why portability is awesome, and why I think people undersell its importance.

NetBSD has a track record of portability: The OS itself has 8 “tier-1” supported ports, 49 “tier-2” ports and 1 “tier-3” port. Their kernel can be crosscompiled from Linux. Their portable package manager, Pkgsrc, supports 19 different OSes including Linux, Mac, BSDs and more.

My personal interpretation is that NetBSD is portable as a consequence of trying to be a pure old-school Unix, and a lot of its other awesome properties come from that. NetBSD is simple: the init scripts are just files, the configuration are just files, the tools are small and focused, the kernel code is great. It is more Unix than many Linux distributions are today.

Portability has long been a cornerstone of Unix, but interestingly enough for different reasons than those I care about. In the book The Unix Philosophy (1994), Mike Gancarz argues that hardware keeps improving at such a rapid pace, it makes little sense to try to optimize software for existing hardware. Instead, it is better to upgrade to newer hardware when available, and ensure the software is portable. So the performance hit of portability is worth it and optimizing for hardware not so much.

Today I think portability matters, but for different reasons. We have old, fast hardware that still would work, but due to software, have become obsolete. The waste this leads to is of course unsustainable. A portable system, it turns out, can serve as a way to maintain older hardware and diminish waste. From this angle, I find NetBSD’s portability aspirational and worth striving for.

To make such a portable system, NetBSD has another area of focus: code quality. The NetBSD team argues that having high quality, modular code is key to creating a portable system. This makes the system quite easy to understand, hack and tweak, which makes it excellent for learning.

To describe how much the NetBSD team cares about code quality, they describe it this way:

One of the key characteristics of NetBSD is that its developers are not satisfied with partial implementations. Some systems seem to have the philosophy of “If it works, it’s right”. In that light, NetBSD’s philosophy could be described as “It doesn’t work unless it’s right”. Think about how many overgrown programs are collapsing under their own weight and features and you’ll understand why NetBSD tries to avoid this situation at all costs.

NetBSD is a system that invited me to play with it and learn. I was able to easily recompile the kernel and change the startup text color from its default green to a white background and black foreground that I preferred. I was also able to apply some patches to install drivers, even though I had never done any kind of kernel work before. Then I noticed that middle click scroll did not work, and I was able to patch the synaptics driver myself so that it worked. I could kind of understand what the code did and how everything was connected on a high level. It makes me say: hey maybe I could actually learn this. It invites me to just hack away for the fun of it.

For the longest time, especially in commercial software, the mantra has been to give the user as little control over tweaking their system as possible. I think however that being able to understand and repair your system is important for sustainability, and being able to tweak and personalize your system is a form of self-expression that should be valued.

The importance of portability and understandability is echoed by 100 rabbits. They are an art/research collective that live on a boat and who have experienced frequent hardware and software failures due to their low energy storage and lack of reliable connectivity.

From that experience, they built their own philosophy for software. In a talk, they introduced the term Permacomputing. The term describes their software philosophy, with practices borrowed from permaculture. It looks at how we can extend the life of systems. They describe it as a practice around creating resilient and regenerative systems. Maximizing hardware lifespan, minimize energy use and focus on the use of available computational resources. It is a philosophy that really resonated with me.

The website permacomputing list a few properties of a good system:

To me NetBSD, intentionally or not, fulfills most of these characteristics:

NetBSD has a community that celebrates older tech, and extending the life of systems. The top post of /r/netbsd is a post of someone browsing the web on their 1994 Sparcstation 20. How cool is that!??

While NetBSD is not as performant and therefore as efficient as FreeBSD and Linux, it does still try to better the performance where possible. This differs a bit from OpenBSD, for example, which disables hyperthreading for security concerns, whereas NetBSD chooses to enable it.

All that to say, I find that NetBSDs philosophy aligns with mine. The OS is small and cozy, and compared to many minimal Linux distributions, I found it faster to setup. Supported hardware is automatically picked up, for my Thinkpad T480s almost everything (except the trackpad issue I solved above) worked out of the box, and it comes with a minimal window manager and display manager to get you started. It is simple and minimal but with sane defaults. It is a hackable system that teaches you a ton. What more could you want?