6

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     root@farrell.cse.buffalo.edu:/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.

Peter Mortensen
  • 2,318
  • 5
  • 23
  • 24
John
  • 369
  • 1
  • 4
  • 13

2 Answers2

7

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.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • 2
    Exactly. What happened was, I set up full disk encryption, with a separate /boot/ partition. But during one freebsd-update from 9.1 to 9.2, I may accidentally deleted the /boot/ entry from fstab in merging, so ended up a bogus /boot/ in the encrypted /. So now I just moved aside that bogus /boot, recreated /boot entry in fstab, mount it, copy over latest /boot, reboot. Now dmesg and uname are all sporting 9.2-RELEASE-p7. Thank you! – John Jun 06 '14 at 20:38
  • Great! I'm glad I was able to help you. – Janne Pikkarainen Jun 06 '14 at 21:44
4

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • oh I have rebooted dozens of times after that. I added to the question above. thanks. – John Jun 06 '14 at 04:08
  • In that case you'll have to wait for a real FreeBSD expert to come along. I only play one on TV. – Michael Hampton Jun 06 '14 at 04:10
  • Thanks, there is no jail or virtual machine, it's just a straightforward installation of RELEASE that went through a couple freebsd-update. I appended to the question above. – John Jun 06 '14 at 05:03