Re: nextboot warns it won't reset

From: Warner Losh <imp_at_bsdimp.com>
Date: Fri, 19 Jul 2024 02:19:12 UTC
On Thu, Jul 18, 2024, 7:10 PM Zhenlei Huang <zlei@freebsd.org> wrote:

>
>
> On Jul 19, 2024, at 4:45 AM, Gareth de Vaux <stable@lordcow.org> wrote:
>
> Hi all, nextboot warns as follows:
>
> # nextboot -k testkernel
> WARNING: loader(8) has only R/O support for ZFS
> nextboot.conf will NOT be reset in case of kernel boot failure
>
>
> This's on a ZFS zroot 12.4-STABLE system.
>
>
> You're encouraged to upgrade to supported releases ;)
>
>
> Does this mean that nextboot will not do its job?
>
>
> I think the WARNING is a good hint and explain why it does not work incase
> boot failure.
>
> The implementation of load desired kernel is write loader parameters to
> /boot/nexboot.conf , to indicate
> the loader(8) do its job, that is loading the desired kernel on next boot.
> Well it is a oneshot boot
> so the loader will try to disable these parameters by writing `nextboot_enable=NO`
> to  /boot/nexboot.conf.
>
> That is the magic. Apparently if loader(8) does not support write to
> filesystem, in this case the ZFS,
> it will fail to write /boot/nexboot.conf in case kernel boot failure.
> Thus subsequent boot the loader(8) would
> still try to boot from the oneshot `testkernel`.
>

However, ZFS has special support via properties in the BE that lets you do
boot once and nextboot stuff.

But even better are boot environments. That's a more comple solution that
supports bootnext features and more. See bectl...

Warner

I see a blog mentioning that nextboot will write metadata to the ZFS pool
> label,
> in which case maybe the warning is no longer applicable?
>
>
> That is implementation specific. Normally you can ignore the warning,
> unless you have trouble booting
> the kernel.
>
>
>
> Also I suspect I should rather run "nextboot -D" to revert the situation.
> Is this equivalent to removing /boot/nextboot.conf and/or this metadata in
> the
> ZFS pool label?
>
>
> I think normally you do not need that.
>
> Best regards,
> Zhenlei
>
>
>