Should "freebsd-version" and "uname -a" give the same version number?

I just realised that freebsd-version and uname -a present different version numbers:

Code:
$ freebsd-version
10.1-RELEASE-p12
$ uname -a
FreeBSD freebsd 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015  root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

This machine was installed last November, I use the generic kernel. The upgrades from 10.1-RELEASE-p10 to 10.1-RELEASE-p11 to 10.1-RELEASE-p12 worked without an error.

Still I am confused: shouldn't the version numbers match? If yes, can I force freebsd-upgrade to upgrade the kernel?
 
No.

uname(1) shows the version as compiled into the kernel itself. If you use a binary update tool like freebsd-update(1), and the patch is in a userland program, then the kernel isn't touched and the patch level shown by uname(1) doesn't increment.

This was causing confusion, so they came out with the freebsd-version(8) tool. This shows the current patch level of the OS, and is incremented any time a patch is applied, whether it be via freebsd-update(8) or a manual compilation process.

Thus, only if you use the buildworld process for keeping the system up-to-date, should you use uname(1), as that's the only way to keep the data current. For all other setups, use freebsd-version(1).

Or, just always use freebsd-version(1) to keep things simple. :)
 
This diverging patch level is also shown by comparing the output of freebsd-version -k and freebsd-version -u.
 
Back
Top