an9wer

What Version of OpenBSD am I Running

Posted:

2025-04-08

Recently, I caught up with two OpenBSD system updates, one is 7.7-beta released on 2025-03-01, and the other is 7.7 (dropping the "-beta") released on 2025-03-30 - note that neither of them is the final 7.7 release, which is expected sometime in late April. After upgrading my OpenBSD to these two releases, the first thing that came to my mind was how to check the version of OpenBSD that I am running.

Does uname Help? - Not Really

On the 7.7-beta system:

$ uname -rsv
OpenBSD 7.7 GENERIC#590

On the 7.7 system:

$ uname -rsv
OpenBSD 7.7 GENERIC#616

uname does not provide much information about the system - at least, it does not tell me whether I am running a beta version or not. It seems possible, though a bit difficult, to infer that from the build number (e.g., 590, 616, as shown in the output above), which is just some digitals incremented automatically with each build.

Does sysctl Help? - That's it

On the 7.7-beta system:

$ sysctl kern.version
OpenBSD 7.7-beta (GENERIC) #590: Fri Mar 14 11:30:35 MDT 2025
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC

On the 7.7 system:

$ sysctl kern.version
OpenBSD 7.7 (GENERIC) #616: Mon Apr  7 22:51:48 MDT 2025
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC

It is obvious that there are more details from sysctl compared to uname, and most importantly, I can determine if am in -beta or not.

The same system version details can also be found in the system messages. I assume during startup, the system reads the kernel variable KERN_VERSION and prints it out. To check it out:

$ head -n2 /var/run/dmesg.boot

Thanks for reading :)