The Monkey Blog

On OpenBSD - From A Linux User

ยท 2120 words ยท 10 minutes to read
Tags: openbsd os

How I Got Here ๐Ÿ”—

I’ve been a Linux user for almost ten years now. For the first 5 years it was only on servers, then for the last 5 years it was on desktops as well as servers. I’ve tried out various distributions, messed up plenty of installs, and fixed some of those mess ups. Overall I would say that the experience has shaped how I use computers today. At the moment, my main desktop is an Arch Linux install. I don’t think it’s really much of a flex to do the arch install it’s easy, I just like having up to date software available as soon as possible.

On my laptop, however, I’ve been using Debian. Which was a pain in the ass for having an outdated set of programs when I’m used to the nature of arch. I don’t need things fully up to date 24/7, but some programs would be years out of date, and that drove me mad. and I finally snapped and wiped it to put a new OS on there.

I’ve tried so many linux distros and wanted to do something new. That’s where openBSD came in. I’ve heard a lot about openBSD for years now and (some) people herald it as one of the best OS options that exist. So I thought fuck it, why not just give it a go? What’s the worst that could happen? Here’s my story

The OpenBSD Experience ๐Ÿ”—

Installation ๐Ÿ”—

Disk Partitioning ๐Ÿ”—

Off the bat one of the first things you’ll notice when installing openBSD is how similar the install process is to Alpine Linux. The installer will ask you a series of straightforward questions which you answer, and it guides you through with sensible defaults… For most things.

One thing I want to point out is the wild partitioning scheme. On my laptop it created a total of 12 partitions (woah!) which is hard to get my head around. The reasonings for this, according to the OpenBSD install on Disk partitioning 1, are the following:

  • Security: Some of OpenBSD’s default security features rely on filesystem mount options such as nosuid, nodev, noexec or wxallowed.
  • Stability: A user or a misbehaved program can fill a filesystem with garbage if they have write permissions for it. Your critical programs, which hopefully run on a different filesystem, do not get interrupted.
  • fsck(8): You can mount partitions that you never or rarely need to write to as readonly most of the time, which will eliminate the need for a filesystem check after a crash or power interruption.

Output of my lsblk command, showing a LOT of partitions in use.

Instead of altering the partition scheme, I just went with the default scheme to fulfill these goals as the project intended. Will I regret this down the road? I have no idea, but we’ll find out if my install lives long enough for that to become a problem.

Networking ๐Ÿ”—

If you just plug your machine into an ethernet port it just works. If you’re doing wireless… We’ll cover that in the post install section actually, since I didn’t fix that until then!

GUI ๐Ÿ”—

X11 ๐Ÿ”—

During install, it will ask you if you want to enable the X server, along with adding the xenodm display manager. This by default will install the Calm Window Manager (known as cwm) which is… Certainly an experience. I might toy with it more later on, but it left a lot to be desired for me. Mainly since I mainly use i3 and bspwm as my window managers.

The default window manager for OpenBSD, CWM. AKA Calm Window Manager

Getting X installed is that easy though - just enable it in the install process!

What About Wayland? ๐Ÿ”—

Wayland is not offered in the default install process, and only recently got OpenBSD support in May of ‘24 2. I’ll cover my experience with Wayland further on in the article (hint: It didn’t work well for me).

Notable Mentions ๐Ÿ”—

During install you will create a root password, a user account, and are asked if you want to encrypt your whole disk. Naturally using a “secure” distro means I did encrypt my disk. Anything else that I haven’t covered here during the install process… I forgot by now.

Post-Install Configuration ๐Ÿ”—

A Note On Sudo ๐Ÿ”—

OpenBSD does not use sudo out of the box. Instead, it comes with doas, which is a replacement for sudo that is highly debated in nerd circles. By default nobody but root can use doas and users need to be added to the /etc/doas.conf file directly, or added to a group that gains access to doas. To do this, I like to create a wheel group and add users to that as needed. That just feels more natural to me given how Linux’s sudo works. The steps to do give a group doas rights goes as follows:

# Do this all as the root user
groupadd wheel
# Note that we don't do -aG like you typically would on linux
usermod -G wheel <USER_NAME>
echo "permit persist :wheel" >> /etc/doas.conf

The permit options gives the users root abilities, the persist option means you won’t get asked for a password EVERY SINGLE TIME you run doas, and :wheel stands for the wheel group.

Networking ๐Ÿ”—

Drivers ๐Ÿ”—

So out of the box on my laptop, wifi did not work. I had missed the section of the installation that talks about bootstrapping the wifi drivers to the install media! However, in the same section of the guide 3, I saw that you can just install the drivers manually post installation.

On the install page, there is a link to openbsd’s firmware for all editions of OpenBSD 4. If you’re reading this blog post as a guide, let me give you a heads up: Download the drivers you “think” you need, put them on a flash drive (and don’t forget to add the SHA256.sig to the same drive!), mount it on your OpenBSD machine, and run fw_update -p /mnt/flashdrive. It will attempt to install all the missing drivers, some of which you might have missed downloading in the first place. The output tells you exactly which drivers you need, so go ahead and download those again onto the flash drive and try again. For my intel based thinkpad, those drivers were:

  • intel-firmware
  • inteldrm-firmware
  • iwx-firmware
  • uvideo-firmware
  • vmm-firmware

After you do this, reboot your computer. Then you can go ahead and connect to your wifi.

Connecting To the Internet with ifconfig ๐Ÿ”—

First, enter just ifconfig on it’s own to get the name of your wifi adapter. Then, run the following command to connect to your wifi:

ifconfig <WIRELESS_ADAPTER_NAME> join <WIFI_SSID_NAME> wpakey <WIFI_PASSWSORD>

Bam you did it. That’s it! No iwctl, no wpa_supplicant, no network_manager needed. This just works.

Ensuring DHCPCD is running ๐Ÿ”—

To run dhcpcd just enable it with the command rcctl enable dhcpcd. This will start your DHCP server on the next reboot. Which, at this point, you should do now! Speaking of rcctl, I should go into that next.

General Usage ๐Ÿ”—

Managing Init Services With rcctl ๐Ÿ”—

In case you didn’t figure it out by now, OpenBSD does not use systemd. It uses a BSD-style init system, which has no run-levels and no inittab. It’s just a collection of shellscripts in a folder housed under /etc/init.d. The syntax for managing services is similar to other init systems, IE rcctl start/stop/enable/disable <SERVICE_NAME> will do what you expect it to do. The main difference with this versus systemd however are:

  1. systemd does a LOT MORE than just init services. All the fancy features you may be accustomed to with systemd are not present in OpenBSD.
  2. Writing new units is a lot different than making a unit file in systemd

I won’t go into the specifics of how to write unit files here, since I haven’t had to yet. If you are interested, check out any of the default init scripts available on an an openBSD system. Here’s one for dhcpcd.

daemon="usr/sbin/dhcpd"

. /etc/rc.d/rc.subr

rc_configtest() {
    # use rc_exec here since daemon_flags may contain arguments with spaces
    rc_exec "${daemon} -n ${daemon_flags}"
}

rc_reload=NO

rc_pre() {
    touch /var/db/dhcpd.leases
}

rc_cmd $1

Installing Packages ๐Ÿ”—

Given you are using a unix-like system, you may be wondering at this point how to do simple things like installing packages. Well good news, it’s incredibly easy. In fact all you have to do is type doas pkg_add <PKG_NAME>. That’s it! Want to search if a package is available? Just use pkg_info -Q <PKG_NAME>. You will get a list of all matching results - or no results if nothing matches! Nifty!

Differences From Linux ๐Ÿ”—

Now this is the part I’m sure most of you are really wondering about. How is using OpenBSD compared to using any Linux distro? The answer is…. /drumroll/… Hardly different at all! Once you get the inital setup out of the way, everything is very straightforward! You can install a lot of the same applications from linux onto openbsd. And they work the same. In fact I would almost argue that after initial setup, OpenBSD is a much smoother and easier experience.

OpenBSD is Easier? How? ๐Ÿ”—

I should preface this by saying “easy” as in easier than arch and gentoo. If you want a smooth, clean, out of the box experience, you should just use Ubuntu / Fedora / any more well known distro that does everything for you. However for my use case, OpenBSD is a nice mix of personal customization and “it just works”.

Let’s take the sound server setup as an example. On linux, you have to choose between alsa, pulseaudio, or pipewire. On openBSD I just had sound of the box, I never set anything up. Is this a drawback? Possibly, if you have specific audio requirements only pipewire can handle. For me, it doesn’t matter at all.

The options you have are more limited compared to linux, but the options you get tend to “just work” for me at least.

Negatives about the OpenBSD experience ๐Ÿ”—

Battery Life ๐Ÿ”—

If you’re on a laptop - expect lower battery life. On debian I could get around 7 hours on a full charge. On OpenBSD I get around 4. This is a dealbreaker for some people, but I don’t really go outside with my laptop very often. And even when I do, plugs are available damn near everywhere at this point. This is a huge issue for some though, and will make them not want to mess with OpenBSD on a laptop at all. Which is totally valid, it’s just not an issue for me.

The Wayland Question ๐Ÿ”—

I brought this up earlier in the article, but while wayland does officially have OpenBSD support, I had very mixed results with it. Sure, I could get sway to start, but the mouse support appears to be broken (for my laptop anyways) on some applications. I couldn’t click anything in any web browser, whether it was Firefox (Yes I had MOZ_ENABLE_WAYLAND=1 set) or qutebrowser. Which is kind of a dealbreak for me at least. If I can’t click, I won’t use wayland.

This is likely to change over time, I wouldn’t be surprised if sometime in 2025 wayland becomes more usable on OpenBSD. Perhaps what I ran into was a sway issue specifically, that was the only wayland compositor I tried to use. But alas, it doesn’t appear to be “quite there” for daily driving yet.

Online Documentation ๐Ÿ”—

I put this under negatives which might seem contradictory to what you’ve heard. The OpenBSD website is great and tells you how to do a lot of maintenance. The manpages are pretty good as well to figure out what you want to do. But as soon as you get to a topic not covered by either, you may be in for a lot of searching and trial / error. The programs themselves that are on linux usually work the same way on OpenBSD so it’s not too big of a problem. However, I ran into an issue that I’m still unclear about. That being enabling hardware accelerated video on web browsers for sites like youtube. I have no idea if my setup is working, and there doesn’t seem to be a lot of coverage on the topic online. I’m sure I’ll run into more as I continue to use the OS, but time will tell.

Conclusion ๐Ÿ”—

I think anyone who likes tinkering with linux should test out OpenBSD and just see how it works for them. You’d be surprised how similar it is! It’s almost like just using another linux distro at some times. And the small papercuts you may have using it are a learning experience :)! I don’t really have much else to add, I covered the major differences above and my opinion is that it’s totally neat and cool. Also the OpenBSD 7.6 artwork is really nice!

Official artwork for openbsd 7.6, showcasing the openbsd mascot rowing a boat.

Footnotes ๐Ÿ”—

Categories