Klaus Zimmermann's Corner

A Linux veteran tries out FreeBSD for the first time

You might have been seeing recently a string of toots from my Mastodon account that outlined the beginning of my adventures with FreeBSD.

I had fiddled with the idea of trying something other than Linux for a while, starting at least back in 2012-ish, when I first burned a live medium of GhostBSD and tried it out for a few hours on my laptop, before deciding I liked Linux better. With the growing experience I got from using Linux every day, however, my interest was renewed and I finally decided to try it again in 2021.

I've been using GNU/Linux as my only OS for more than ten years now, and I have changed distributions a couple of times during this adventure, starting out with Ubuntu, trying out many other Debian-based mini-distros, switching seriously to Debian stable and, more recently, Artix Linux. From this standpoint, I thought I'd be prepared to try my hand at FreeBSD.

In the realm of learning an operating system, though, the number of years using something turns out not to be so much of a credential. For example, most people have been using Windows for 20 or even 30 years, and still don't know how the innards of Windows work, or how to salvage it if something bad breaks. That's because all they did on it was run Microsoft Office, browse the internet or play games.

I'm still not sure if my knowledge qualifies as "advanced" in terms of Linux, but after doing all my computer-related activities inside of the text-only Linux console for a week, I felt I was a little more prepared to dive head in into a completely new OS. This post is my summary of what I have learned so far, and my thoughts on how FreeBSD feels coming from a Linux background.

My goals in this exercise

To clarify any questions that may be hanging in your head, I'm not planning to replace Linux with FreeBSD anytime soon. That's because to me there is neither competition or mutually exclusion along GNU/Linux and FreeBSD - each one can fulfill their own specific duties with their own sets of strengths and weaknesses.

I wanted primarily to expand my horizons of knowledge of how Unix-like OSes work, and to "get my hands dirty" concerning the creation of a tailored distribution from bottom up on my own way. I could have chosen Gentoo or other minimalist Linux distributions (LFS, perhaps, someday?) for the same exercise, but BSD seemed to be the best fit for the challenge - not too big, not too small.

I did not have many expectations about this venture to begin with, since I truly had no idea about what to expect from a barebones FreeBSD system. This low expectation in the long run benefitted me because it protected me from some pretty bad falls along the way from an operating system that sometimes you read about as being "better" or "much saner" than Linux. This, combined with me having no intention of replacing my current OS, gave me a free mindset to explore ahead.

Also, I must add that this project would not have gone so far had two things not happened in recent times. First, I now have a spare machine that was procured from the trash earlier on. This gave me the freedom to really tinker around, try, break things and restart afresh that would not have been possible if that machine also happened to house all my data. And second, just recently recovered a real gem, a Raspberry Pi B (released in 2012), again from the depths of the trash. I decided to also try to install FreeBSD there, since they advertised a specific image for it, and suppposed was lightweight.

My trash-recovered Raspberry Pi B running FreeBSD 12.2

Couldn't I have done it in a Virtual Machine instead? Probably yes, but getting VirtualBox to work under Artix has proved to be sort of a challenge, and apparently there are some known issues when trying to run a FreeBSD guest inside VirtualBox according to this video.

Installing FreeBSD: who's afraid of a text installer?

Ok, I've made up my mind; let's install the beast(ie)! Where do I start?

The FreeBSD project makes the release snapshots available for the public in their own webpage, but I couldn't find any torrents there. There are quite a lot of options that you can choose from since they support a wide range of processor architectures, just like when you choose a Debian image to install. No problem for me, as I already knew what I was looking for, but a novice might find it confusing.

There was one point that I did confuse me, though: they have different .iso and .img files intended for different installation media. I grew used to most Linux distributions using hybrid ISOs that work for both USB sticks and optical media that I just grabbed the first ISO for my machine, burned it to my stick and promptly resulted in an unbootable environment. Lesson quickly learned: .img is for USB sticks in FreeBSD. That's no biggie.

A bigger problem, however, was that as soon as the installer booted, I was faced with a garbled screen that could not be read in any way:

My problem using the FreeBSD installer

This turned out to be a problem of mismatching resolution between the framebuffer and the screen itself, and after a chat in the FreeBSD IRC I had the solution. To fix it I had to go to the boot options (pressing Esc) and run gop set 0 to make use of the largest screen resolution available. The installer then proceeded smoothly.

The FreeBSD installer is completely text-based, using TUI "dialog boxes" to guide you throughout the installation in a manner similar to how Debian does it, and it was virtually no different than using a graphical installer. It was so complete that it even allowed me to set up full disk encryption right on the spot, something that is not so common along the lesser-known Linux distributions.

In parallel, partly due to my frustration with the aforementioned screen problem, I installed FreeBSD in my recently-found Raspberry Pi B as well. This was a much quicker and easier route (the website kindly names exactly what is the file you need to download and burn), albeit you end up with a preconfigured system rather than a fully "from zero" one. But that was enough for me to get started in FreeBSD while I couldn't solve the problem on my laptop.

Using FreeBSD: same same, but different

Upon installation, FreeBSD feels familiar to my Linux console-only environment, but there are still some differences that still feel a little weird to me.

A meme that goes ~$ _ -> :D | ~% _ -> :O

Software management

The base system is pretty raw and basic, similar to a fresh installation of Arch Linux, so my first task was to install the stuff that I needed to get the ball rolling and do some work in my FreeBSD machine. Lack of apt or pacman made me a little lost at first, but then I quickly realized that FreeBSD complementary makes use of a relatively recent binary package manager called pkg, which brought me back to familiar grounds. pkg search <something> and pkg install program were all I needed to make FreeBSD more at home to me.

I tried my hand at the ports system that FreeBSD uses to install software from the source code, but only because I wanted to learn how it worked. Turns out that the process is surprisingly similar to how you install software via the Arch User Repository.

You have a "recipe" (Makefile in FreeBSD, PKGBUILD on Arch), some available files, some metadata and (FreeBSD only) a patching script that will take the generic source code and patch it to make it fully compatible with FreeBSD before the actual compilation begins. To install something via ports, then, it's as simple as:

cd /usr/ports/your/applications/directory; make install && make clean 

An advantage of ports is that whereas in the AUR you have to browse the online repository and clone the repository containing PKGBUILD manually, FreeBSD already contains the whole ports collection on disk. This makes it easier to update all your ports-installed software by issuing one command (portsnap fetch) instead of manually checking or depending on AUR helpers, but takes considerably more time to conclude (the /usr/ports directory is about 1GB here).

A drawback is that searching for software within the /usr/ports can be hard or confusing. Running find /usr/ports -name "*package*" can take quite a long time, or not return results at all, whereas in Arch this is a quick web search.

Configuration and management

A quite memorable mishap is that my laptop ran into an issue with the infamous PC speaker beep (why do computers still even have them, anyway?). Every time I pressed Tab for completion, a striking beep would cut the silence, and I almost gave up on the whole project due to this. Fortunately, good sense triumphed and it turns out that you can solve this by adding:

allscreens_kbdflags="-b quiet.off" 

To FreeBSD's /etc/rc.conf file.

Speaking of it, this rc.conf file is quite useful, and pretty much one of the only things you need to set up a good working environment in the console (called vt in FreeBSD). This is where you set up your fonts and any other console display settings, applying to all vts if you need. For example, this is how I set my font of choice:

allscreens_flags="-f /usr/share/vt/fonts/ter-u20n.fnt" 

This is also an example of one of FreeBSD's "selling points" in comparison to Linux: the configuration seems much more standardized and organized than in Linux so far. That rc.conf is where I configure everything that I need to do in the console. Programs and their associated files are neatly organized according to their prefixes and priorities (/bin/ and /etc/ are concerned only with boot-critical programs), whereas in Linux you may have to do some hunting to find out where some config file is.

It sounded strange to me that to configure something like bash I have to browse to /usr/local/etc, but that's really the logical way. I'm not saying that this immediately makes FreeBSD better, but it's way more logical.

General usage

Down in the details, sometimes the same programs I use in Linux behave different in FreeBSD. I have no idea why. Most notably, tmux's clipboard behaves differently when it comes to highlighting text to copy, with highlighting being triggered by only pressing space whereas on Linux it requires Ctrl+Space. Copying in FreeBSD is the Enter key, in Linux is Alt+W. Go figure.

Also, almost everything in FreeBSD so far also seems to be oriented towards servers - all the way from Hard Drive partitioning and RAID arragengement, having sshd enabled by default and to setting the famous jails (which I have not tried yet).

This is not necessarily bad, but is a little different from my experiences in Linux, where things from a desktop's point of view are given a little more priority (suspending and hibernating, for example). Perhaps this is the same feeling that Windows or Mac users get when switching to Linux, though. I also have not tried a graphical environment in FreeBSD yet, so I might be a little biased.

I still have not gotten used to the C shell that is the default in FreeBSD, but thankfully bash was available as well, so switching over was not an issue. Also, this might be an opportunity to try out a new shell as well (even zsh, maybe?)

Beautiful documentation that inspires

Finally, I cannot end this post without talking about how wonderful the FreeBSD documentation is. I'd say it's so wonderful that it actually inspires you to keep using it and learning more about the system.

First and foremost comes the FreeBSD Handbook, an extensive but very detailed document about every aspect of installing, configuring and using the OS. To me, the best thing about it is that it doesn't read like a traditional manual; instead, it's part tutorial, and part explanation that inspires you to try to apply those concepts to it. When reading it, you learn as you do, which is exactly what any learning process be.

The manual is also well structured and organized, with man sections clearly defined and concise explanation, sometimes even including an example usage. Most if not all commands referenced elsewhere in the FreeBSD documentation refer to the manual all the way to the section as well, like vt(4) to indicate that one should look up man 4 vt for more information.

The closest thing to this level of documentation I had found before was the Arch Wiki, which is, granted, much more didatic and much more complete (after all, it is a wiki). However, for a plain offline manual, the FreeBSD Handbook does an amazing job, reducing your needs to go into the IRC.

What now?

I still have way too much homework to do regarding FreeBSD, chiefly going graphical with it, and perhaps it will be alright. At any rate, I don't think I'm ready quite yet to leave my familiar Linux environment right now, but keeping both sounds like a great idea. Perhaps I'll leave my Raspberry Pi running FreeBSD to test its sturdiness.

And if anything, this study has taught me that setting up and using modern Operating Systems is not hard, but rather time-consuming. There's nothing hard in following prompts to install and configure software in the command-line any more than a graphical way, and "advanced" OSes are nothing more than a matter of getting down and doing some preparation before use. Keep learning, keep expanding and enjy the ride!

(And yes, this post was written entirely with FreeBSD!)


This post is number #6 of my #100DaysToOffload project. Follow my progress through Mastodon!


Last updated on 02/26/21