FreeBSD is an amazing operating system
Published on 2020-01-20. Modified on 2020-01-21.
This is a small article about some of my adventures with FreeBSD and why I believe it is an amazing operating system.
Update 2020-01-21: Since I wrote this article it got posted on Hacker News, Reddit and Lobster, and a few people have emailed me with comments. I have updated the article with comments where I have found it suitable. As a side note I want to point out that I am not a FreeBSD developer, there may be things going on in the FreeBSD world that I know absolutely nothing about. I am also not glued to the FreeBSD developer mailing lists. I am not a FreeBSD "fanboy". I have been using GNU/Linux a ton more for the past two decades than FreeBSD, mainly due to hardware incompatibility (lacking or buggy drivers), and I love both Debian GNU/Linux and Arch Linux just as much as FreeBSD. However, I am concerned about the current development in GNU/Linux land as of late. Also this article is not about me trying to make anyone switch from something else to FreeBSD. It's about why I like FreeBSD and that I recommend you try it out if you're into messing with operating systems.
I think the year was late 1999 or mid 2000 when I one day was browsing computer books at my favorite bookshop and I discovered the book The Complete FreeBSD third edition from 1999 by Greg Lehey. With the book came 4 CD Roms with FreeBSD 3.3.
I had already familiarized myself with GNU/Linux in 1998, and I was in the process of migrating every server and desktop operating system away from Microsoft Windows, both at home and at my company, to GNU/Linux, initially Red Hat Linux and then later Debian GNU/Linux, which eventually became my favorite GNU/Linux distribution for many years.
When I first saw The Complete FreeBSD book by Greg Lehey I remember noticing the text on the front page that said, "The Free Version of Berkeley Unix" and "Rock Solid Stability", and I was immediately intrigued! What was that all about? A free Unix operating system! And rock solid stability? That sounded amazing.
I immediately bought the book and it became my favorite reading material for a long time (even when I wasn't doing anything Unix related).
I was surprised that I had never heard about FreeBSD before since it had existed since 1993, but at least another "Unix like" operating system wouldn't be completely foreign to me because of my experience with GNU/Linux, and it wasn't.
I did some test installs on different hardware and I loved FreeBSD right away. FreeBSD became my first FTP server run from home.
Later in 2000 I was employed by one of the biggest ISPs in my country and discovered to my surprise that the entire server and network structure was run on FreeBSD. The only computers that didn't run FreeBSD was the computers at the office where the sales people and secretaries worked, those ran Microsoft Windows. When I asked about the choice of operating system the system administrator said something like:
People who know what they are doing run FreeBSD! Everyone in the communication industry run FreeBSD!
I eventually got to experience the FreeBSD "Rock Solid Stability", mentioned in Greg Leheys book, first hand. FreeBSD was amazing. It was very performant and extremely stable. Every single customer that hosted at the ISP, and that was a lot of customers, was being served by FreeBSD, and it was running on everything from old 386 PCs to the latest Pentium 4 machines. The only time FreeBSD needed to be rebooted was when it had been upgraded in the base system. During the time I was there I never experienced a problem anywhere where FreeBSD was running.
Contrary to FreeBSD, GNU/Linux was viewed upon as a "toy" operating system. It was used only by some of the support staff for their private setups.
What I failed to realize back then was that FreeBSD was (and it still is) designed as a complete multi-purpose operating system meant to be setup and tuned according to specific use cases. When I occasionally installed FreeBSD it didn't always perform as well as a default Debian GNU/Linux installation for the same task. Even FreeBSD on my FTP server at home eventually got replaced by Debian GNU/Linux because FreeBSD had to be rebooted every third day or so otherwise the performance degraded a lot. Debian on the other hand performed without any "hick-ups".
Update 2020-01-21: People have been asking about what the specific problem with FreeBSD was, but I cannot remember the details exactly. I think it was something about the FreeBSD server running out of memory, but I'm not sure. Also I didn't try to solve the problem, I was too busy and just replaced FreeBSD with Debian. Also this was a very long time ago. Of course this was some kind of bug and I highly suspect that it was the FTP server software I was running and not even related to FreeBSD at all.
Update 2020-01-21: Someone commented on Hacker News with the following statement: "IMO, if it needs to be manually tuned, that's a bug, not a feature. (And I'm speaking as a FreeBSD developer on that.)" I disagree completely with that. There are many options which you cannot simply auto tune because the use cases are so different and you need to be able to set the specific options you need manually. There is a big difference between running a busy static fileserver with something like NGINX on top of FreeBSD, and then running a busy database server on FreeBSD, each setup may require specific tuning for your use case, whether this is in the filesystem or the kernel or something else.
Later in the years to come GNU/Linux also got better hardware support, and often when I wanted to install FreeBSD some stupid hardware didn't work. Hardware was very expensive back then and I didn't have the option to purchase hardware that I knew would work on FreeBSD. All of these issues eventually made me use GNU/Linux a lot more than FreeBSD. Today this is no longer as big a problem as FreeBSD has great support for most modern hardware, but GPU support is not as good as it is on Linux. The FreeBSD wiki provides some relevant information.
I still liked FreeBSD very much and I eventually ended up using FreeBSD as my main desktop computer for a very long time (while also still running several GNU/Linux distributions on other computers).
Some of the things I love about FreeBSD are:
- FreeBSD is a complete operating system.
- FreeBSD is very well thought out and very well designed. Once you get to understand how FreeBSD is setup and how it works, it is surprising how many details the developers have thought about.
- FreeBSD sets the kernel and the base system apart from third party packages.
This is unique to FreeBSD and none of the other BSDs do that.(Update 2020-01-21: I made a mistake when I wrote this. The other BSDs do the same. What I meant was that this is unique to BSD and not something you'll find in the GNU/Linux distributions). I have always loved this about FreeBSD, but unfortunately (in my humble opinion) this has been changing since 2016. The work is still not done, but it is slowly getting there. I personally wish this didn't have to change.
- All third party applications is installed in
/usr/local/and all third party application settings is installed in
/usr/local/etc/. Combined with the separation between the base system and third party applications, this makes it trivial to manage third party applications and if you need to change your setup you can simply delete all installed packages with
pkg delete -aand then start installing the ones that you want.
- FreeBSD is installed only with the features you enable (either during installation or manually) and nothing is running that you don't know about. FreeBSD is also opt-in, meaning that you have to enable something in order for it to run and work. Update 2020-01-21: Of course some very basic services are running by default, like cron, as these are a part of the basic operating system maintenance tools. cron does some basic log rotation if needed.
- The FreeBSD code is meticulously maintained and very well documented. Update 2020-01-21: Someone has disputed this. Perhaps this requires further investigation, but I was generally thinking about GNU/Linux as a comparison.
- FreeBSD has both the UFS and ZFS filesystems in the base install.
- FreeBSD comes with the rich storage system GEOM which allows you to use two networked machines for high-availability storage, use your choice of RAID level, or add features like compression or encryption.
- FreeBSD also has geli which is a block device-layer disk encryption system that uses the GEOM disk framework.
- FreeBSD service handling is very simple. Each service, whether part of the base system or installed from a port, comes with a script that is responsible for starting and stopping it (and often some other options). Default scripts reside in a default directory with default settings, like
/etc/default/rc.conf, but all settings can be overwritten by using
/etc/rc.conf. If you want to enable SSHd, you just add
/etc/rc.confand SSHd is enabled at boot, or you can use the command
service sshd enable, which is even easier and it does the same. The FreeBSD rc system that reads the configuration file understands dependencies between services and it can automatically launch them in parallel, or wait until one is finished before starting the things that it needs. You get all of the benefits of a modern configuration system, without a complex interface. Update 2020-01-21: Someone has stated that "the parallelism part is not true". I have never used this option, but it is described that way on the FreeBSD Advocacy Project, where it literally says: "The rc system that reads this file understands dependencies between services and so can automatically launch them in parallel..." If this is wrong the website needs a bug report.
- FreeBSD has both the ports system and pkg.
- FreeBSD has the amazing Jails system that allows you to run applications or entire systems in a sandbox that cannot access the rest of the system. Long before Docker was even though about, FreeBSD had Jails. Update 2020-01-21: FreeBSD also has the Bastille container management framework installable from both the ports and packages system.
- FreeBSD has Mandatory Access Control, from the TrustedBSD project, which allows you to configure access control policies for all operating system resources.
- FreeBSD has Capsicum which allows developers to implement privilege separation, reducing the impact of compromised code.
- FreeBSD also has the VuXML system for publishing vulnerabilities in ports, which integrates with tools such as pkg, so that your daily security email tells you about any known vulnerabilities in ported software.
- FreeBSD has security event auditing, using the BSM standard.
As mentioned previously, because FreeBSD is a real multi-purpose operating system with many different use cases, FreeBSD is very flexible and tuneable. Whether you want to run FreeBSD on your desktop computer or on your server, it provides many tuneable options that enables you to make it very performant. The options set out-of-the box may not suit your needs exactly, but then FreeBSD provides lots of documentation on how to get it to work as you need, and it provides a very helpful community with many people who has experience in dealing with many different situations and problems.
I believe it is important to understand that FreeBSD is not like a GNU/Linux distribution. FreeBSD is an operating system made by developers who are also system administrators. (Update 2020-01-21: At least it used to be like that, perhaps today to a lesser degree). This means that FreeBSD is supposed to be run by system administrators who understands how the system works. You cannot simply jump from something like Ubuntu, Fedora or OpenSUSE and then expect that you get the same experience on FreeBSD (I and a lot of other people would be extremely sad if that were the case).
A Linux distribution is a collection of tools written by different groups of people, often with conflicting interests and priorities.
A Linux distribution needs the Linux kernel, the GNU tools and libraries, perhaps additional third party software, documentation, the X Window System, a window manager, and a desktop environment, and it then needs to combine these different components into the resulting distribution. Different distributions focus on different goals, some put focus on the desktop while others put their main focus on servers, and again others try to provide a multi-purpose operating system, like Ubuntu.
FreeBSD is not like that. FreeBSD is a complete operating system produced by a team of people who are passionate about the work they do, there are no conflicting interests in the project. The people who maintain the kernel are also the people who maintain the C library, the ls, stat and other commands, and the different tools. FreeBSD also provides full documentation to everything related to the operating system.
Update 2020-01-21: If FreeBSD is to be used as a desktop operating system it too needs third party software, the X Window System, a window manager, and a desktop environment. My point is that FreeBSD is not a collection of tools written by different groups of people, often with conflicting interests and priorities, like that of the Linux kernel, the GNU C Library, etc.
Update 2020-01-21: Someone has pointed out that there do exist conflicting interests in the FreeBSD project as well and an example that springs to my mind is perhaps the conflict between Matthew Dillon who eventually forked FreeBSD into DragonflyBSD because he disagreed with other FreeBSD developers about performance issues. But my original statement has perhaps been misunderstood. I don't think issues like that in BSD is the same as conflicts between completely different projects like the Linux kernel and the GNU C library. A serious conflict in Linux land could result in a non-functional operating system, this cannot happen with the BSD projects because of the structure of the projects. On FreeBSD disputes are settled by the core team and by voting, and on OpenBSD Theo de Raadt, who is the project leader, has the final say. If someone disagrees, he either eventually accepts the final decision, or he has the freedom to fork the project, like Matthew ended up doing, and like Theo de Raadt ended up doing with NetBSD. This is very different from what's going on in GNU/Linux, which is what I meant to express.
Whether you're a GNU/Linux user who has been distro hopping for some time, or you're a GNU/Linux user who already have found his or hers favorite GNU/Linux distribution, or perhaps you're even a Microsoft Windows user or a MacOS user, in any case I highly recommend you try out FreeBSD. But before you do so, spend some real quality time studying the FreeBSD documentation, you will get the most out of the system if you understand something about how it works. Reach out to people on the IRC channels or the FreeBSD mailing lists or the FreeBSD forums, you will find many helpful people.
I also highly recommend the book Absolute FreeBSD by Michael W. Lucas, who is a network/security engineer with lots of experience working with high-availability systems on FreeBSD. Michaels book gets into a lot of details about the FreeBSD operating system. It is well written and contains many relevant details.
Michael W. Lucas, together with Allan Jude, has also written the FreeBSD Mastery: ZFS and FreeBSD Mastery: Advanced ZFS books for those interested in the ZFS filesystem running on FreeBSD. The second book is a follow-up to the first book, with more advances use cases. Both books are invaluable.
FreeBSD is an amazing operating system!