Conflicting information about the running kernel version in FreeBSD
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
9.2-RELEASE-p7
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 [email protected]:/usr/obj/usr/src/sys/GENERIC 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.
One thing that comes to my mind is that your system would have a separate /boot
partition, which somehow was unmounted while you performed freebsd-update
. This made the new kernel to be copied to your /boot
directory inside the /
partition, not the actual /boot
.
Now, during boot, your bootloader is configured to use the actual /boot
and so the old kernel gets loaded.
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.