Using OpenBSD for a Few Days — GNUcode.me

Using OpenBSD for a Few Days

by Joshua Branson — November 27, 2021

I love playing with my computer. I love tweaking things, adding new features, trying the latest gizmo, etc. This usually means that I end up breaking stuff on my computer, which is exactly what I did a few days ago! I normally find myself running Guix System these days, and a few days ago, I attempted to boot up my laptop and grub gave me this error:

error: file '/boot/grub/i386-pc/normal.mod' not found
Entering resque mode...
grub resque>

Great. Well luckily, I have a spare hard-drive laying around with OpenBSD installed on it! So now I get to go play with it! I have been using OpenBSD on my laptop for about 3 days now, and it has been a pleasant experience. The OpenBSD guys have built a stable and useable OS! It is almost a free OS as far as the Free Software Foundation is concerned, but it does include some nonfree firmware for wifi cards.

Installing OpenBSD was increadibly easy. Surprizingly, I could not get FreeBSD to install…no idea why. Anyway, I am running Xfce on OpenBSD, and it works fairly well. I will say that Guix System is clearly faster (probably 'cause linux is faster). In Guix things are snappier, but OpenBSD feels a little slower to start applications. Now I will admit that I am using a hard-drive on OpenBSD and a SSD on Guix system, so keep that in mind. Also I think OpenBSD has disabled hyperthreading (which you can enable with # sysctl hw.smt=1) in the name of security, so that could be why it feels a little slower.

Also OpenBSD has not embraced Wayland yet, which is ok. Though for an operating system that wants to be secure by default, I hope they choose to support Wayland eventually. OpenBSD does have weird X issues. Nothing major, but when I open gajim, sometimes it displays an Emacs buffer on startup, then switches to looking like gajim. Or when I click to chat with a person on Gajim, it can take half a second to open up the chat window. Again not a huge issue, but it is noticable.

I had to edit various files and install various packages to set up OpenBSD to the way that I liked. I already miss Guix's declaritive model of creating your operating system from one configuration file! Though most of guix's services are configured through /etc/rc.conf.local. Here were some of the things that I had to set up to get OpenBSD to work.

  • install various packages

    doas pkg_add -iv gajim netsurf firefox font-awesome xfce xfce-extras mpv emacs

OpenBSD has doas instead of sudo, which you should configure.

  • Get Xfce to start automatically after I logged in

    cat ~/.xsession exec startxfce4

  • Enable autologin. Don't ask me for a password

    cat /etc/X11/xenodm/xenodm-config | grep -A 1 -B 1 autoLogin DisplayManager*autoLogin: joshua

This one was weird, because I had to chmod u+w xenodm-config in order to modify the file. And this feels like cheating. I feel like the proper solution is to modify /etc/rc.conf.local, but the guides I found online suggested to just modify the xenodm-config file. After I edited the file I ran chmod u-w xenodm-config.

It's also a good idea to configure your login.conf. Specifically customize the staff section so your regular user has plenty of memory.

Since I have made my emacs config depend on Guix System, I could not use it in OpenBSD. So I thought, why not? I'll try out Doom Emacs, which I must admit is an awesome Emacs config. It's a little different using vim like keybindings with the dvorak keyboard layout, but it is not a bad as I thought it would be.

Honestly, I am very pleased with OpenBSD. When I first started looking at freedom respecting operating systems, I knew that I could try one of the *BSDs or a Linux distro. I still feel like my home is in Guix System, but I wish we were not dependent on Linux, which is becoming a bit of bloatware. The Linux kernel is approaching 30 millions lines of code. The FreeBSD/NetBSD kernels are approaching 9 million lines of code. Each have about 500 syscalls. In contrast, OpenBSD has a little more than 2 million lines of code and 330 syscalls. It just has a smaller attack surface.

If I was not convinced of the moral correctness of the FSF, then I probably would be an OpenBSD user today, but it's good to know that if Linux ever collapses under its weight, then I should be able to retreat to using OpenBSD! Though it would be nice to see OpenBSD get more funding to pay developers to work on it.

Bonus Paragraph!

So I realized later, that I had NOT broken my computer. I could still boot into Guix System, because I am running libreboot, which includes Grub as a payload. Apparently my libreboot setup, loads grub from the hard drive instead of using libreboot's payload. It would be nice to actually use the libreboot payload and skip loading grub from the hard drive. That's a project for a later date.