Conflicting information about the running kernel version in FreeBSD

John asked:

I asked a related question about uname before and now want to ask from another angle, because the following simple yet obvious conflicting outputs may mean there is something many people did not think of (me included). I’m running FreeBSD 9 RELEASE; please see the following commands:

# sysctl kern.bootfile
kern.bootfile: /boot/kernel/kernel

# strings /boot/kernel/kernel |grep RELEASE|grep 9
@(#)FreeBSD 9.2-RELEASE-p7 #0: Tue Jun  3 11:05:13 UTC 2014
FreeBSD 9.2-RELEASE-p7 #0: Tue Jun  3 11:05:13 UTC 2014

The above kernel file suggests the running kernel is 9.2-RELEASE-p7. But…

# dmesg
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012

# uname -a
FreeBSD localhost.localdomain 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012  amd64

So dmesg and uname says it’s 9.1-RELEASE.

I also did an extensive find / -type f -exec grep -l "9.1-RELEASE" {} ;, but I found no possible kernel file that contains 9.1-RELEASE.

What could lead to the above conflict, and what kernel am I actually running?

Please note I run RELEASE and ran freebsd-update to do a binary update, so no compiled kernel is involved. And I have rebooted multiple times after freebsd-update. And the system is not in jail, etc., just the only system on that computer.

My answer:

You have probably upgraded the system from 9.1 to 9.2 but failed to reboot it.

You might also have simply booted a previous kernel, but given the output you’ve shown, this seems much less likely.

One other possibility comes to mind, that the system is actually inside a jail, running on a 9.1 system, so that while the jail is upgraded to 9.2, the host system is still running 9.1.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.