Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 2024 12:49:13 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Gareth de Vaux <stable@lordcow.org>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: nextboot warns it won't reset
Message-ID:  <9CCA0BFB-70D3-4E21-8BA7-3E9F35110E8D@FreeBSD.org>
In-Reply-To: <CANCZdfoy4pXW1USst7=G6fx1-pGiAxFV1ORNCA7zDuEUQqARyg@mail.gmail.com>
References:  <Zpl_ApIOpRkUNpnq@lordcow.org> <01D917DB-7E47-46D7-AD22-AD09C4F89A96@FreeBSD.org> <CANCZdfoy4pXW1USst7=G6fx1-pGiAxFV1ORNCA7zDuEUQqARyg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_84D08D30-9414-451B-ACA2-C530FE1DB7F8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Jul 19, 2024, at 10:19 AM, Warner Losh <imp@bsdimp.com> wrote:
>=20
>=20
>=20
> On Thu, Jul 18, 2024, 7:10=E2=80=AFPM Zhenlei Huang <zlei@freebsd.org =
<mailto:zlei@freebsd.org>> wrote:
>=20
>=20
>> On Jul 19, 2024, at 4:45 AM, Gareth de Vaux <stable@lordcow.org =
<mailto:stable@lordcow.org>> wrote:
>>=20
>> Hi all, nextboot warns as follows:
>>=20
>> # 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
>>=20
>>=20
>> This's on a ZFS zroot 12.4-STABLE system.
>=20
> You're encouraged to upgrade to supported releases ;)
>=20
>>=20
>> Does this mean that nextboot will not do its job?
>=20
> I think the WARNING is a good hint and explain why it does not work =
incase boot failure.
>=20
> 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=3DNO` to  /boot/nexboot.conf.
>=20
> That is the magic. Apparently if loader(8) does not support write to =
filesystem, in this case the ZFS,=20
> 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`.
>=20
> 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.

>=20
> But even better are boot environments. That's a more comple solution =
that supports bootnext features and more. See bectl...
>=20
> Warner=20
>=20
>> 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?
>=20
> That is implementation specific. Normally you can ignore the warning, =
unless you have trouble booting
> the kernel.
>=20
>>=20
>>=20
>> 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?
>=20
> I think normally you do not need that.
>=20
> Best regards,
> Zhenlei




--Apple-Mail=_84D08D30-9414-451B-ACA2-C530FE1DB7F8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Jul 19, 2024, at 10:19 AM, Warner Losh &lt;<a =
href=3D"mailto:imp@bsdimp.com" class=3D"">imp@bsdimp.com</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta =
charset=3D"UTF-8" class=3D""><div dir=3D"auto" style=3D"caret-color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><div class=3D""><br class=3D""><br =
class=3D""><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Thu, Jul 18, 2024, 7:10=E2=80=AFPM Zhenlei Huang =
&lt;<a href=3D"mailto:zlei@freebsd.org" =
class=3D"">zlei@freebsd.org</a>&gt; wrote:<br class=3D""></div><blockquote=
 class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; =
border-left-width: 1px; border-left-style: solid; border-left-color: =
rgb(204, 204, 204); padding-left: 1ex;"><div style=3D"word-wrap: =
break-word; line-break: after-white-space;" class=3D""><br class=3D""><div=
 class=3D""><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Jul 19, 2024, at 4:45 AM, Gareth de Vaux &lt;<a =
href=3D"mailto:stable@lordcow.org" target=3D"_blank" rel=3D"noreferrer" =
class=3D"">stable@lordcow.org</a>&gt; wrote:</div><br class=3D""><div =
class=3D""><div class=3D"">Hi all, nextboot warns as follows:<br =
class=3D""><br class=3D""># nextboot -k testkernel<br class=3D"">WARNING: =
loader(8) has only R/O support for ZFS<br class=3D"">nextboot.conf will =
NOT be reset in case of kernel boot failure<br class=3D""><br =
class=3D""><br class=3D"">This's on a ZFS zroot 12.4-STABLE system.<br =
class=3D""></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D"">You're encouraged to upgrade to =
supported releases ;)</div><br class=3D""><blockquote type=3D"cite" =
class=3D""><div class=3D""><div class=3D""><br class=3D"">Does this mean =
that nextboot will not do its job?<br =
class=3D""></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D"">I think the WARNING is a good hint and =
explain why it does not work incase boot failure.</div><div class=3D""><br=
 class=3D""></div><div class=3D"">The implementation of load desired =
kernel is write loader parameters to /boot/nexboot.conf , to =
indicate</div><div class=3D"">the loader(8) do its job, that is loading =
the desired kernel on next boot. Well it is a oneshot boot</div><div =
class=3D"">so the loader will try to disable these&nbsp;<span style=3D"" =
class=3D"">parameters by writing `</span><font class=3D""><span =
class=3D"">nextboot_enable=3DNO` to &nbsp;</span></font><span style=3D"" =
class=3D"">/boot/nexboot.conf.</span></div><div class=3D""><span =
style=3D"" class=3D""><br class=3D""></span></div><div class=3D""><span =
style=3D"" class=3D"">That is the magic. Apparently if loader(8) does =
not support write to filesystem, in this case the =
ZFS,&nbsp;</span></div><div class=3D""><span style=3D"" class=3D"">it =
will fail to write&nbsp;</span><span style=3D"" =
class=3D"">/boot/nexboot.conf in case kernel boot failure. Thus =
subsequent boot the loader(8) would</span></div><div class=3D""><span =
style=3D"" class=3D"">still try to boot from the oneshot =
`testkernel`.</span></div></div></div></blockquote></div></div><div =
dir=3D"auto" class=3D""><br class=3D""></div><div dir=3D"auto" =
class=3D"">However, ZFS has special support via properties in the BE =
that lets you do boot once and nextboot =
stuff.</div></div></div></blockquote><div><br class=3D""></div><div>Yes =
and NO.</div><div><br class=3D""></div><div>Yes for 13.x, 14.x and =
CURRENT.&nbsp;<span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, =
0);" class=3D"">nextboot(8) will&nbsp;</span><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">consults =
zfsbootcfg(8)</span><span style=3D"caret-color: rgb(0, 0, 0); color: =
rgb(0, 0, 0);" class=3D"">&nbsp;to do the nextboot stuff if file =
system</span></div><div><span style=3D"caret-color: rgb(0, 0, 0); color: =
rgb(0, 0, 0);" class=3D"">is ZFS.</span></div><div><br =
class=3D""></div><div>No for 12.x. &nbsp;neither nextboot(8) nor =
nextboot.sh will do that. And it seems that loader(8) also do not get / =
set</div><div>ZFS properties to enable / disable nextboot =
stuff.</div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D""><div dir=3D"auto" style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><div dir=3D"auto" class=3D""><br =
class=3D""></div><div dir=3D"auto" class=3D"">But even better are boot =
environments. That's a more comple solution that supports bootnext =
features and more. See bectl...</div><div dir=3D"auto" class=3D""><br =
class=3D""></div><div dir=3D"auto" class=3D"">Warner&nbsp;</div><div =
dir=3D"auto" class=3D""><br class=3D""></div><div dir=3D"auto" =
class=3D""><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" =
style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1px; =
border-left-style: solid; border-left-color: rgb(204, 204, 204); =
padding-left: 1ex;"><div style=3D"word-wrap: break-word; line-break: =
after-white-space;" class=3D""><div class=3D""><blockquote type=3D"cite" =
class=3D""><div class=3D""><div class=3D"">I see a blog mentioning that =
nextboot will write metadata to the ZFS pool label,<br class=3D"">in =
which case maybe the warning is no longer applicable?<br =
class=3D""></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D"">That is implementation specific. =
Normally you can ignore the warning, unless you have trouble =
booting</div><div class=3D"">the kernel.</div><br class=3D""><blockquote =
type=3D"cite" class=3D""><div class=3D""><div class=3D""><br =
class=3D""><br class=3D"">Also I suspect I should rather run "nextboot =
-D" to revert the situation.<br class=3D"">Is this equivalent to =
removing /boot/nextboot.conf and/or this metadata in the<br class=3D"">ZFS=
 pool label?<br class=3D""></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D"">I think normally you do not need =
that.</div><div class=3D""><br class=3D""></div><div class=3D""><div =
style=3D"" class=3D"">Best regards,</div><div style=3D"" =
class=3D"">Zhenlei</div></div></div></div></blockquote></div></div></div><=
/div></blockquote></div><br class=3D""><div class=3D"">
<div><br class=3D""></div>

</div>
<br class=3D""></body></html>=

--Apple-Mail=_84D08D30-9414-451B-ACA2-C530FE1DB7F8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9CCA0BFB-70D3-4E21-8BA7-3E9F35110E8D>