FreeBSD – from the Linux user’s perspective (introduction)

With this (and the next) post we’re going to take a look at FreeBSD, assuming some basic Linux experience. The goal is to provide an easy introduction and to show where that system behaves differently from Linux. And we’ll also touch the subject of strengths and weaknesses of FreeBSD.

What is FreeBSD?

Linux is a Unix-like Operating system and the same is true for FreeBSD. The difference is that FreeBSD is a direct offspring of BSD-Unix whereas Linux was coded from scratch and did never have any code in common with Unix. So compared with Linux, FreeBSD is clearly “more Unix”. But why don’t we just say that it IS a Unix since it once was? Because of legal trouble…

Technically, FreeBSD is a much improved BSD-Unix. But there’s one problem: UNIX is a trademark. In order to call your system a Unix, it must comply with the Unix specifications. FreeBSD did this and probably still does for the largest part. That’s just the first requirement, though! The other is that you need to have your OS certified – which is not exactly a cheap thing to do. IBM did this for AIX, HP for HP-UX, etc. FreeBSD, being a non-commercial community project, needs the money it receives from donations for other things. And so – for legal reasons – FreeBSD is not a Unix but just a “Unix-like” system.

However it has come from Unix and it feels like Unix (with quite some things a little different from Linux). So if you don’t like the stiff term “Unix-like” you can of course think of your FreeBSD as a Unix system in contrast to Linux.

FreeBSD’s goal as stated by the project, is to provide a general purpose, secure and highly scalable operating system that is available free of charge. Sounds a lot like Linux so far, doesn’t it? Yeah, it does. But please keep in mind that this doesn’t make FreeBSD the boring rip-off. FreeBSD was there first! But even if you’d argue that it’s obsolete, now that Linux does extremely well in just about all areas (and admittedly better in quite some), there’s one more point. FreeBSD is meant to be available free of charge and under a permissive license!

Linux is GPL’ed. That makes it available for free and ensures that the code will always be open, because the license enforces these things. FreeBSD, licensed under the BSD license, does not do this. You are free to do things with it which the GPL does not allow. A whole lot of people don’t care (they have probably never even thought about licensing) and quite some people applaud the GPL’s approach. Others however prefer BSD-style licenses. It’s a matter of taste and a philosophic question that cannot really be decided once and for all.

I’ve written a short post on an introduction to licenses more than a year ago. It was meant to have a follow-up article but I didn’t find the time to write that one, yet.

System structure

The whole operating system is integrally connected. Where a Linux distro is actually “the Linux kernel plus (a lot of) packages”, FreeBSD is different. Programs from upstream are imported into the system repository and often patched. The versions are chosen to play together nicely with all the other components of the system.

This operating system consists of two parts: kernel and world, the latter being the userspace part of it. The actual software you install on top of the OS is separated from it: Files are put into /usr/local so they don’t mix with those that belong to the base system – which is quite a clean thing.

Traditionally FreeBSD has come with the ports system. If you want to install an application which is not part of the OS, you change into the respective directory of the ports tree and run make install clean. The Makefiles (and a few other files as well) then take care that the source code is downloaded, extracted and configured, that patches are applied, the program is compiled and installed. You do not need to know anything about how to get a program to work on FreeBSD. If somebody already wrote a port, it’s as easy as issuing that make command. The port will also ensure that any dependencies needed are present on the system and, in case any is missing, they are automatically built and installed by the ports system, too.

But that’s not all. Ports for many programs are created to allow you to select which features to compile a program with. A simple menu-driven UI let’s you check and uncheck features for each port. And of course it allows for clean removal of installed software using make deinstall. Also the ports tree often offers you various versions of a program to choose from. Want Apache 2.4 or probably rather 2.2? Or perhaps you need gcc. Feel free to choose any of 4.6, 4.7, 4.8, 4.9 and 5.1!

This allows for easy customizing of the software you install: You get exactly what you need and want. If you have no special needs for some programs and don’t want to compile it on your computer, you can of course use pre-built binary packages like on Linux. And the best thing: Since the ports system actually builds packages, you can mix the two as they play together nicely and won’t conflict!

Some strong points

FreeBSD has a world-class network stack – which is absolutely no wonder since TCP/IP was in fact developed on BSD Unix! This is one example where FreeBSD is superior to Linux.

Another nice feature are the so-called secure levels together with the extended file flags. The later open up some interesting possibilities: You could, for example, set the file flag “append only” on a log file. The log is not “read only” – it can be written to. So new log entries can be appended to the file. But it is impossible to either delete the file or remove content that’s already in it! If an attacker (who does not want you to notice that he broke into your system) tries to cover his tracks this can be extremely frustrating as there is no way he can get rid of anything that’s in the log!

That is… As long as he doesn’t just remove the file flag. But to make that impossible as well, FreeBSD has secure levels. You can always add file flags. But you can only remove them when the system is in secure level 0. And here’s the show-stopper: Once set to higher than 0 secure levels cannot be reduced. Not even by root and not even by yourself with physical access to your server! There’s exactly one way to get rid of a secure level greater than 0: Reboot… And a reboot won’t go unnoticed easily, right?

One more very cool feature are jails. Think of them as hardened chroot environments with a lot of extras (like IP addresses for a jail). They are kept strictly separate from the rest of the system (and from other jails). You have heard about all that “container” stuff that’s currently en vogue in Linux, haven’t you? No need for that on FreeBSD! If you want a secure environment (or several) for single applications – just jail them. FreeBSD offers this possibility for ages now (but to be fair I should mention that they were available on Solaris (where they are called “zones” even earlier).

And perhaps you have heard good things about the ZFS filesystem or about DTRACE. FreeBSD comes with both of them and they are considered stable. And of course there’s much more to it. But let’s leave that for the next post where we’ll get our hands on FreeBSD, right?

For those of you who are interested, here’s a little Unix history (it’s good to know because it helps understand why things are how they are today – but if you don’t care at all you can of course skip it).

Unix history

In 1964 AT&T, GE (General Electric) and the MIT (Massachusetts Institute of Technology) teamed up to create a sophisticated new operating system they called Multics. It was extremely innovative and pioneered many features in computing. A lot of people thought however that it was overly complex and not quite the system they wanted.

Eventually AT&T pulled out of the project and started another one in 1969 which followed the converse idea: Simplicity over complexity! This operating system is known as “research Unix”. In the following years various versions were completed and licensed especially to universities for little money (because AT&T was not allowed to compete on the software market at that time due to their telephone monopoly). During that time it was a matter of course that you got the source code when you bought software. For that reason students of computer science could look at the code – and modify it.

Coded in assembler first, it was soon re-written in the new programming language C which forever remains closely tied to Unix. Thanks to the availability of the code, the universities kept producing patches with new functionality for Unix and gave it away for free to anybody who had licensed the base product (Unix). At the center of this development was Berkeley University which collected these patches and patch sets. They created new Unix releases from those which were called “Berkeley System Distribution” or BSD for short. The first one was 1BSD in 1978 which was based on AT&T’s Unix Sixth Edition from 1975.

The university created the major releases 2BSD, 3BSD and 4BSD over the years. These grew in popularity fast and quite often Unix from AT&T was bought and put aside only to be able to actually use BSD legally! In 1986 4.3BSD was released (based on Unix System V from 1983). The year 1992 saw the release of a short-lived project which nevertheless had a huge impact: 386BSD or Jolix (named after its creators, Lynne Jolitz and William Jolitz). It was an effort to port 4.3BSD to the 80386 PC.

Now the BSD story repeated in a smaller scale: 386BSD enthusiasts created patches for the system and an unofficial patchkit was provided from it. Due to a difference in opinion the patchkit maintainers broke away from 386BSD and founded the FreeBSD project. About the same time another group of 386BSD users started they own project derived from that 386BSD: NetBSD was born.

The original BSD project ended in 1994 with a strange last release called 4.4BSD-lite. It was a crippled release that could not even run on its own! The reason was a lawsuit from the Unix System Laboratories. Formed after AT&T’s forced break-up, they finally could compete on the PC market and began to offer Unix for high prices. It goes without saying that the existence of BSD was a thorn in their side – and they meant to remove it!

But greed is not a good advisor and in the end the case was settled out of court. Why? Because the university proved that over the years almost all of AT&T’s code had been replaced. BSD was almost a system completely of its own! But that’s not all. In fact AT&T had taken the free code from BSD and used it in their newer Unix releases. While there’s nothing wrong with that, they didn’t give the BSD credit for their work. And by failing to do that it turned out that they were violating the BSD licence themselves!

It is the legal struggle and uncertainty that followed from the case which can be seen as one reason why Linux gained more and more attention: If you chose any BSD derivative you never know what might happen some day…

What’s next?

Next in line is a FreeBSD tutorial that puts focus on getting the system installed and exploring what’s different from Linux.

Advertisements

BSD, HURD and Arch?

Today we’ll deal with Arch Linux’s principles transferred to other operating systems.

The Arch Way

Arch Linux’s slogan is: A simple, lightweight distribution. There are many people who want an operating system which truly fits their needs – and nothing else. Arch is usually a good choice for them due to its light-weight core system which can easily be expanded in any direction needed.


The Arch Linux logo

Sure, there are quite some other distribution worth considering. Gentoo, of course, which allows for even deeper customization thanks to its mighty USE-flag and portage system! But many people prefer to go without the hassle of compiling everything. This is often when Arch Linux comes in as it provides binary packages. If it has to be even more lightweight, there are a few distributions which are really fairly minimal. Alpine Linux is very interesting in this regard and some others like Damn Small Linux and Puppy come to mind.

In most cases though, Arch Linux is a very good choice. And that shows: This distribution has attracted many users over the years and is in the top 10 of the distrowatch rating. Why that? Probably because people like The Arch Way of putting together a distro.

Other Distros

Apart from classic Arch Linux there are some other Arch-based distribution. For example there’s ArchBang which combines Arch Linux with the OpenBox WM to provide a light-weight desktop upon installation.


The ArchBang logo

Then there’s Manjaro Linux, an Arch-based distribution which provides graphical tools for everything and aims to be beginner-friendly.


The Parabola logo

Others are Parabola, a distro using the fully free Linux-libre kernel, Arch Linux for ARM and ConnochaetOS, a fully free system that supports the i586 architecture.

If you’re interested in more of them, here‘s a list on the Arch Linux wiki.

Other kernels

Actually people seem to like The Arch Way so much that they miss it even when working with a system which is not Linux-based. For that reason some projects have arisen which kind of copy the Arch principles over to other systems!

There are for example ArchHurd and ArchBSD.

ArchHurd

The former is not exactly a new project – it was founded in early 2010. It made a lot of progress in a short time but seemed to have stalled by the end of 2011. There’s no news item on the project site after August of that year and while still new packages were created that also came to a halt about one year later. In the meantime even the wiki had disappeared.


The ArchHurd logo

Fortunately the project isn’t dead and after a while during which it only lived on in mailing list posts, at least the wiki is back again (which actually was the cause that made me write the previous and this post after I discovered it). Currently progress is still very slow which is due to problems with updating glibc. After the new toolchain is built the whole core repository needs to be rebuilt. So there’s enough work to be done there.

The new wiki has a severe spam problem right now. But I’m sure that can be taken care of sooner or later. And the most important thing is surely that the project is still alive!

ArchBSD

The other project is still very new. While the idea exited for a while, the site for it was put up in January 2013. ArchBSD is progressing nicely and considering the short time it exists, it already got pretty far in bringing the familiar Arch feeling to an OS using the FreeBSD kernel!


The Arch BSD logo

Right now it’s far to early to say whether this blend is to survive on the long run or not. Currently it looks good with quite some development taking place. And compared to ArchHurd it also has much newer packages in general (which however is no wonder since it started with later ones).

What’s next?

In the next post I’ll take a brief look at ArchHurd and ArchBSD.

A look beyond the Linux teacup – Unix-likes

Yes, I know. I said that I’d play with a new version of the DDD when I wrote the previous entry. Well, I did. Actually I made some nice progress on it, too. However there’s one little issue which ruined the whole thing for me: A new version of the tool which I use to build the live-image (ArchISO). The ability to produce isos for just one architecture (i686 in my case) was dropped and now it can only build dual isos – which are of course twice as big! I found a patch but still could not get things working. For that reason I decided to postpone it.

For quite a while I’ve been interested in things that lie just a few meters behind die Linux “border”: Other Unix-like systems. And just recently I made some discoveries – two of which I’ll cover with the next post and a third one which may be the topic to the one thereafter. But first let’s discuss a few basics.

Attractiveness of Linux

We live in very interesting times when it comes to operating systems: The quasi-monopoly of Microsoft’s Windows for home PCs is taking severe blows. No, I don’t want to predict that they are done for. On the opposite: I think that they will manage to hold extremely high market shares for quite a while in the future. And I also don’t want to talk about mistakes of Microsoft (like Vista or 8’s “Metro”/”NewUI”).

What does really shake the monopoly is the fact that Linux is becoming a real alternative. It has been in the server sector for a long time now and for the above-average user in general, too. But now one of the (at least commercially) most important frontiers is crossed: Linux is getting fit for gaming.

That’s why more and more computer users are “giving it a try”. Fortunately there are quite some distros today which require little to no previous Linux knowledge and let you complete the installation without having to know what run levels are or how mount points work. While this can rightly be called a good thing, it does have two sides (like all things do). Linux systems can be extremely convenient these days (just think of the superior package management when combined with some kind of “software center” as Ubuntu has one!). This however bears the risk of a “new generation” of “Linux users” who are content with just having an “easy” and quite stable system.

Unix-likes

It’s those people who didn’t really get that technically the term “Linux” refers to the kernel only (a little more on that in a minute). There’s more than one operating system which works somewhat or even very close to how Unix functions. That’s why people talk of a Unix-like system or *nix. Some systems comply with the entire POSIX standard of Unix and some are even certified to be rightfully called Unix. Especially the later however is more of a commercial thing. If you’re new to all this, you’ll be astounded just how many “true” Unices there are – not even to talk about the Unix-likes!

People often distinguish between a certified Unix, functional Unix (the typical Unix-like which tries to emulate the functions provided by Unix) and a genetic Unix (which derived from the source code of a Unix system).

Just like noted before, there are quite some members of the large family of Unix-likes. Just a few examples:

  • BSD
  • Linux
  • Mac OS X
  • Minix
  • NeXTSTEP
  • Solaris
  • SunOS
  • System V
  • Xenix

Some of these can actually be regarded as sub-categories. For example there are several BSDs which derived from 386BSD:

  • NetBSD
  • FreeBSD
  • OpenBSD
  • DragonFly BSD

Kernel

What’s a kernel? Think of it as the “core” of your OS if you’re not yet familiar with that term. The kernel is what really interacts with the actual hardware. The before-mentioned superficial Linux user may not care (or even know it), but strictly speaking Linux means the kernel only and thus refers to an operating system component rather than an entire OS. Usually “Linux distributions” pack together the Linux kernel and the GNU operating system basis (plus some or even a lot of other applications).

It’s important to know of the two different areas in system memory: Kernel space and user space. Why is that relevant? Simply because without it you won’t understand the difference in kernel design. The kernel is almighty (and has to be) while the applications running in user space can also be run underprivileged (and thus can’t do harm to your system). People typically distinguish between the kernel and the userland (the programs running in user space).

There are different approaches when it comes to classify a kernel. Linux is a so-called monolithic kernel which means that it’s “one big thing”. Most of the important things low-level things are handled by the kernel. Linux is modular, though. It can load and unload kernel modules (like drivers) while running without having to restart the system. Another idea is that of a micro kernel (e.g. Minix). Here the kernel is only doing the most basic stuff and everything else is provided by user space programs.

What’s next?

For people who don’t stop with a just working system and instead like to dig a little deeper there are some other playgrounds besides Linux-based systems. As collected above, there’s a great many of other Unix-like systems which use another kernel and a (sometimes slightly) different userland. The next blog entry will present two of them: BSD and HURD.