Re: nextboot warns it won't reset

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

>
>
> On Jul 19, 2024, at 10:19 AM, Warner Losh <imp@bsdimp.com> wrote:
>
>
>
> 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.
>
>
> Yes and NO.
>
> Yes for 13.x, 14.x and CURRENT. nextboot(8) will consults zfsbootcfg(8) to
> do the nextboot stuff if file system
> is ZFS.
>
> No for 12.x.  neither nextboot(8) nor nextboot.sh will do that. And it
> seems that loader(8) also do not get / set
> ZFS properties to enable / disable nextboot stuff.
>

I missed that detail and understand your comments about running a supported
release. It does indeed not work on 12.

Warner

> 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
>>
>
>
>
>