FreeBSD is an original operating system you can install on Raspberry Pi to experiment a bit outside Linux. But the process is not always easy if you are used to working on Debian-like systems.
Today, we’ll see how to install it on a Raspberry Pi, to configure it and use it like almost like any other operating system.
FreeBSD is an open-source operating system, available on Raspberry Pi since 2014. It’s a good solution for any usage (server or desktop)
It’s not based on Linux, as they develop their code for everything. Even if there are many similarities, it includes several differences, more or less visible.
To help you as much as possible, I will start by an introduction to FreeBSD, then I’ll show you how to install it, and finally, everything you need to know to use it the way you want.
Note: I’m not an expert in BSD systems. I’m a fan of Pfsense which is based on FreeBSD, but I never really used it beside that. The goal here is only to share with you my notes about this system.
FreeBSD is not a new system, far from that. The first release comes in 1993! (same year as Debian).
The main goal is to offer a lightweight system, with critical part related to stability. So you can use it almost anywhere.
FreeBSD works on two branches :
- STABLE: The main branch, each new major version is released from the STABLE branch (RELEASE)
- CURRENT: It’s the development branch, to get the latest improvements, but less speed and stability.
FreeBSD can be used in any situation. It’s fast, stable and secure. So it’s perfect for a Raspberry Pi, but also for a server or a desktop usage.
By the way, the FreeBSD FAQ is pretty clear about this:
Can FreeBSD replace my current operating system?FreeBSD documentation
For most people, yes.
We’ll see in the next parts how to install it on your Raspberry Pi, but it’s also a solid system for your computer or on server.
FreeBSD has been adopted by many companies over the world.
I already told you about Pfsense, but other brands like IBM, Apple or Sony are using parts of the FreeBSD code (for example, the PlayStation 4 system is a fork from FreeBSD).
Some NAS operating systems are also based on FreeBSD (FreeNAS for example).
FreeBSD vs Linux
As I told you in introduction, FreeBSD is not a Linux-based system.
Systems on Linux, are all using the same kernel and basic drivers, and then add many applications to offer a specific solution at the end.
FreeBSD don’t use this base, they develop and release everything, including the kernel and drivers.
However, the differences while using it are minimal (I will show you the main ones).
But you may have some commands working differently on Linux and FreeBSD.
So, why do I need to try FreeBSD if it’s almost the same thing?
As always when I test systems, the main goal here is to experiment, and see how it works. So you’ll get more details at the end.
But in theory, FreeBSD is a minimal system that should be faster, more secure and with less compatibility issues than most Linux systems.
We’ll see now if this is true for the Raspberry Pi version 🙂
Install FreeBSD on Raspberry Pi
In this part, we’ll see how to install a basic FreeBSD system on your Raspberry Pi.
Raspberry Pi 4
During writing this tutorial, the Raspberry Pi 4 is not yet supported on the RELEASE version (12.x). But it works on CURRENT version (13.x).
So, if you have a Raspberry Pi 4, consider taking the latest version available. Currently, the 13.x and above are the only working for Raspberry Pi 4.
Unfortunately, if t’s a CURRENT version, it’s a debug one, with less stability and performances issues. But for a test it’s ok.
The other option is to use a custom firmware, available here on GitHub, and replace the files on the SD card for the RELEASE version.
FreeBSD offers pre-built images for the ARM and ARM64 architecture.
The ARM64 version is working fine on Pi 3B+ and 4, I didn’t test on other models.
Here is the general link to the FTP server: https://download.freebsd.org/ftp/
Once here, you have two choices:
- Download the RELEASE version:
- Open the releases subfolder and go to ISO-IMAGES.
- Select the version you want to install (12.1 for example).
- Then, find the image corresponding to your Raspberry Pi model.
If you have the Raspberry Pi 3 (look for arm architecture, and the last part of the name correspond to the Raspberry Pi model).
- Download the CURRENT version:
- Go to snapshots and then ISO-IMAGES.
- Select the version you want (13.0 for example).
- Same thing here, find the FreeBSD images corresponding to your model, for example:
Currently, there is no specific version for the Raspberry Pi 4, so take the RPI3 one.
Download the file you need on this server, and feel free to ask in the comments if you are lost with this, or if I need to update it for the latest versions.
SD card preparation
Once you have the image on your computer, the installation part is similar to what you may already know with other systems.
My favorite tool to create SD card is Etcher, here is how to use it:
- Download Etcher on the official website here if needed.
It’s available on any system (Windows, Linux, macOS).
I didn’t try on FreeBSD 🙂
- Install it and start the application, the window looks like this:
- Click on “Select image” and browse to the FreeBSD image location (you don’t need to extract the files).
- Insert your SD card into your computer.
Etcher will select it automatically.
- Then, click on “Flash!” to start the SD card creation.
After a few minutes, your SD card is ready to use.
On the first boot, a terminal prompt will appear where you need to log in.
There are two users available by default:
- freebsd is the default user, the password is freebsd
- root is the administrator, the password is root
Connect with root for now and continue to the next part.
If you want, SSH is enabled by default, so you can absolutely continue from your computer once the network cable plugged.
But the root user is not accessible directly with SSH. You need to connect with “freebsd” and then use “su” to switch to the root user.
There is no sudo command available by default.
Configure FreeBSD on Raspberry Pi
Once installed and logged in, it’s time to check that everything is configured properly.
With the tool I show you just after, you can manage almost everything in your configuration, but the “Packages” part didn’t work for me (didn’t found the server).
So we have to do this manually.
The package management tool on FreeBSD is “pkg”.
It works almost the same thing as “apt” or any other tool in command line.
I’ll show you how to use it later, but for now, you have to install it with this command (with the root user):
pkg clean -a && pkg upgrade -f
There is a tool on FreeBSD to manage most of the configuration from the terminal (a bit like “raspi-config” on Raspberry Pi OS).
To open it, enter the command:
The main menu looks like this:
Use the arrows to scroll to the part that you need to change, and follow the instructions to configure it (if you are connected with SSH, the mouse is working).
For example, to change the root password (which is recommended), go to “Root Password” and enter the new one.
The network will work directly with an Ethernet cable if there is a DHCP server on the network (your router probably).
If not, you can go to “Networking Management” in bsdconfig and set a static IP
The Wi-Fi is not supported yet, as the driver is not included in the image.
You can try a USB stick to fix this (my DLINK model didn’t work, but maybe there is something to install).
Note: Personally, I’m using a Wi-Fi extender to plug Ethernet cable on systems that doesn’t support Wi-Fi for Raspberry Pi. This one on Amazon is working perfectly in this case if you are interested.
Users and groups
As I told you, two users are already there after the first boot: freebsd and root. But you can obviously change this as you want.
In the “Login/Group Management” from bsdconfig, you can:
- Manage users:
- Add Login to create a new user.
- Edit/View Login to see a list of current accounts on the system. In addition to the two we are using, there are many more. You can also change them in this submenu. For example, I recommend editing the password for freebsd too.
- Delete Login: only do this once you have tested that everything is working without it. For example, you can create a “pi” account and remove “freebsd”.
- Manage groups:
- It’s almost the same thing as for the users.
- You don’t really need this except for specific applications.
- To add a user in a group, you’ll probably use the Edit/View Login menu.
For your information, the “wheel” group add the permission to use “su”.
So, if you create a new user (like “pi” in my example), you need to add it in the “wheel” group if you want it to switch to the administrator account.
In this last part, I’ll share with you a few other things that may be important depending on your current level on FreeBSD.
The pkg command
We already used the “pkg” command to manage packages that is the main change with Debian.
Here is a few examples on how to use it:
- pkg update: update the depository sources
- pkg upgrade: upgrade the packages you are already using on the system
- pkg search <string>: find the package you want to install, example:
- pkg install <package>: install the package you want, example:
pkg install nano
- pkg remove <package>: uninstall any package on the system
- pkg help: get a list of all other options available
As you can see, it’s really close from apt, yum or any other package management tool you might know. So, it should not be complicated to switch for pkg.
By default, the only text editors pre-installed on the system are vi and ee.
Personally, I don’t really like these editors, so I installed nano with:
pkg install nano
If you prefer, vim is also available:
pkg install vim
And probably other ones, try “pkg search” if you want to check for your favorite 🙂
If you need help using these tools, I have two cheat sheets that you might like:
- 35 most useful nano commands and shortcuts
- Vim tutorial on Raspberry Pi (it’s for Raspbian, but the end should help you)
As the root user is directly available after the installation, the sudo command is not installed automatically with the system. But you can install it later if needed, here is how to do this:
- Install the “sudo” package:
pkg install sudo
- To add the permission to use it to one user, open the sudoers file:
- Edit the file as needed, for example, to add all the permissions to freebsd, add this line:
freebsd ALL=(ALL) ALL
On the next login, freebsd will be able to use sudo with any administrator command, for example:
I have spent several hours trying to install a graphic interface, but unfortunately, I can’t achieve it.
Many graphic interfaces are available in the repository: Gnome 3, KDE, XFCE4, LXDE, etc.
But none of them worked, even on the latest version.
The error is always the same: it doesn’t start automatically, and when I start it manually I get an error like “No screen found”.
I find several useful links that I’ll share with you, and if anyone manages to do this, I will edit this post with the solution:
- The FreeBSD wiki page about desktop environments
- Xorg for FreeBSD on Raspberry Pi
- Install MATE on Raspberry Pi
That’s it, you now have a pretty good overview of the FreeBSD system on Raspberry Pi.
Basically, it’s a powerful system, I found it really fast in the RELEASE version, even on Raspberry Pi 3. But it drives me crazy to not find a solution for the desktop environment. Also, the lack of support for Raspberry Pi in general (like the Wi-Fi), might be an issue for some of you.
Personally, I didn’t really find an interest to keep it on my Raspberry Pi, I have my habits on Raspberry Pi OS / Debian like systems, and I don’t have any project right now where it could be useful.
But it’s just my opinion after this quick test, what about you?