Re: Odd sysctl -d kern.bootfile result

From: Kyle Evans <kevans_at_freebsd.org>
Date: Sun, 13 Nov 2022 04:42:25 UTC
On Sat, Nov 12, 2022 at 10:16 PM Mark Millard <marklmi@yahoo.com> wrote:
>
> The context:
>
> # ls -Tldt /boot/kern*/kernel
> -r-xr-xr-x  1 root  wheel  40003240 Nov  6 16:32:05 2022 /boot/kernel/kernel
> -r-xr-xr-x  1 root  wheel  39990232 Jul  6 11:21:16 2022 /boot/kernel.old/kernel
> -r-xr-xr-x  1 root  wheel  31401824 Aug 19 03:16:29 2021 /boot/kernel.dbg/kernel
>
> # uname -apKU # Note: output line split for readability
> FreeBSD amd64_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #55
> main-n259064-f83db6441a2f-dirty: Sun Nov  6 16:31:55 PST 2022
> root@amd64_ZFS:/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG
> amd64 amd64 1400073 1400073
>
>
> But . . .
>
> # sysctl -d kern.bootfile
> kern.bootfile: Name of kernel file booted
>
> # sysctl -W kern.bootfile
> kern.bootfile: /boot/kernel.old/kernel
>
> Looks wrong to me. (I've never explicitly assigned to kern.bootfile .)
>

The usual suspect here is that you did an `installkernel` -- if it
replaces kern.bootfile, it moves the old kern.bootfile to
/boot/kernel.old and updates the sysctl to reflect the new location so
that it still accurately reflects the booted kernel.

Thanks,

Kyle Evans