Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Nov 2022 01:23:19 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: Odd sysctl -d kern.bootfile result
Message-ID:  <C54A958A-05E8-4999-9FDF-CB39E363ED45@yahoo.com>
In-Reply-To: <CACNAnaFrLTyO_vHN7ERKax901Qj=U6MksYPBR_6H=ndsY32w5A@mail.gmail.com>
References:  <B129E797-6041-48A5-B2A7-E7CB1C0E9989.ref@yahoo.com> <B129E797-6041-48A5-B2A7-E7CB1C0E9989@yahoo.com> <CACNAnaFrLTyO_vHN7ERKax901Qj=U6MksYPBR_6H=ndsY32w5A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Nov 12, 2022, at 20:42, Kyle Evans <kevans@freebsd.org> wrote:

> On Sat, Nov 12, 2022 at 10:16 PM Mark Millard <marklmi@yahoo.com> =
wrote:
>>=20
>> The context:
>>=20
>> # 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
>>=20
>> # 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.a=
md64/sys/GENERIC-NODBG
>> amd64 amd64 1400073 1400073
>>=20
>>=20
>> But . . .
>>=20
>> # sysctl -d kern.bootfile
>> kern.bootfile: Name of kernel file booted
>>=20
>> # sysctl -W kern.bootfile
>> kern.bootfile: /boot/kernel.old/kernel
>>=20
>> Looks wrong to me. (I've never explicitly assigned to kern.bootfile =
.)
>>=20
>=20
> 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.

Ahh: no, but, yes, sort of. For:

# bectl list
BE             Active Mountpoint Space Created
13S-amd64      -      -          4.96G 2021-08-20 16:57
13_0R-amd64    -      -          4.30G 2021-08-20 16:56
13_1R-amd64    -      -          3.76G 2022-03-10 12:38
main-amd64     NR     /          7.26G 2022-11-06 20:02
old-main-amd64 -      -          2.37G 2022-10-14 14:59

I normally boot main-amd64 but I also maintain the 13*-amd64's via
mounting and chrooting into the 13*-amd64 be's and doing buildworld
buildkernel and installkernel installworld while chrooted (no
reboot). (I generate and boot an updated main-amd64 first.) The:

kernel-install: .PHONY
. . .
                sysctl kern.bootfile=3D${DESTDIR}${KODIR}.old/"`basename =
"$$thiskernel"`" ; \

is apparently not local to the chroot's context but changes the
booted system's live value despite the live system not being
what was updated.

The be entry usage is not essential here. chroot'ing into a
directory tree used for the same sort of purpose for UFS
(or ZFS) would have the same issue if installkernel was
part of the activity.

I may consider saving and restoring kern.bootfile in my
13*-amd64 procedures so that kern.bootfile does not end up
being misleading.

Thanks for the note!

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C54A958A-05E8-4999-9FDF-CB39E363ED45>