From nobody Wed Sep 7 00:13:29 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MMjQt2DRzz4c25n for ; Wed, 7 Sep 2022 00:13:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MMjQs4gdnz47mY for ; Wed, 7 Sep 2022 00:13:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe2b.google.com with SMTP id d126so13288946vsd.13 for ; Tue, 06 Sep 2022 17:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=tttq3CkPU1Z7OPk0C07hjzt2vTqZbb9PhRQ3O7+74W0=; b=3WS+3vECiG8uC0k612pHlm5QLP1EphwQ2FILASr57MXZwWgKtiofFGKzXJvtSO1rFV TzFSey/LkQC1w1WYjSzYdke02eiUdQ1flZORiRuErESh/jT81PSyQ2cF3e8hJcl9i7cj p1pb2Ct2q9Oiz9i2aD6EhmSfwb8mg83xyOJ1edZeKFVshZFirmcZ7xYFbxMegtEhgTaI uPcueaVnXZR3frsEx0X0mKK6xEh8tzlV5s/DkN1MF1R4bHWWhoSvI/D2JjwPz0cg0Q06 rQ/SVfm+p54SZKFW9YiddwsiwFbisEJGVlylrQZhkfy3+pnDmDASpvevHdF0mB48pClP j/Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=tttq3CkPU1Z7OPk0C07hjzt2vTqZbb9PhRQ3O7+74W0=; b=n2Bc4EC4WO+jvTJBlDntxatW5+Nu0TNMV/X50ncZ2r7pd8uhdg9CiLBNDZkQQbz2P+ tZYanLVpjKo68r1wOqRQp/pJj23w85+a7yIu4oMSWHZUxpj6G9ESfos6oFspiP6VVP31 iayVH6TNTrxMDSaEMFfJzd8Hfreic8cZR294UjPKZBWEYVel1b5k0G1Zb0CnOyNxghrN c+wd2MoephWrZsaAGHr+z6TUVypZOmr+x5f80NYOR217d2TUfPj/yUImJKHHTp2a8ARE +Hz/OtjB0ESXm2LUvFZbOD9HXJ0/Nnqggarvb2jfowF5u8dfjU17o243hAQfB+lF9tB3 bA9Q== X-Gm-Message-State: ACgBeo2TmYhh/Y4Er8uSonEtIt9aARV2Bwlw5uyrnNvfPeDT9u9ekGPe 93d2k3p/iJGElFVg1dUMKwxfCZtEYiDlq5Uq5YhM7g== X-Google-Smtp-Source: AA6agR77DgX6j4lTRjDg++4aBIksnZzUEy52xEpstV6EIjvMAC+KnxsswJQbABjdUi2K7GwU2FfTozuUf/UxQqhz7cA= X-Received: by 2002:a67:ac45:0:b0:388:a1ff:7e89 with SMTP id n5-20020a67ac45000000b00388a1ff7e89mr335347vsh.42.1662509620829; Tue, 06 Sep 2022 17:13:40 -0700 (PDT) List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 References: <1098569247.12297.1662500507113@localhost> <1146974959.11767.1662503463234@localhost> In-Reply-To: <1146974959.11767.1662503463234@localhost> From: Warner Losh Date: Tue, 6 Sep 2022 18:13:29 -0600 Message-ID: Subject: Re: kernel update broke -current To: Ronald Klop Cc: freebsd-arm , Mark Millard Content-Type: multipart/alternative; boundary="00000000000062b97b05e80b2f52" X-Rspamd-Queue-Id: 4MMjQs4gdnz47mY X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=3WS+3vEC; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e2b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e2b:from]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; R_SPF_NA(0.00)[no SPF record]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; RCPT_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[bsdimp.com]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FREEMAIL_CC(0.00)[freebsd.org,yahoo.com] X-ThisMailContainsUnwantedMimeParts: N --00000000000062b97b05e80b2f52 Content-Type: text/plain; charset="UTF-8" On Tue, Sep 6, 2022 at 4:31 PM Ronald Klop wrote: > > *Van:* Ronald Klop > *Datum:* 6 september 2022 23:42 > *Aan:* freebsd-arm , Warner Losh , > Mark Millard > *Onderwerp:* Re: kernel update broke -current > > > *Van:* Warner Losh > *Datum:* 6 september 2022 18:13 > *Aan:* Mark Millard > *CC:* freebsd-arm > *Onderwerp:* Re: kernel update broke -current > > > > On Mon, Sep 5, 2022 at 4:21 PM Mark Millard wrote: > >> Warner Losh wrote on >> Date: Mon, 05 Sep 2022 20:07:33 UTC : >> >> > On Sun, Sep 4, 2022 at 4:51 PM void wrote: >> > >> > > On Sun, Sep 04, 2022 at 07:31:59PM +0000, void wrote: >> > > > >> > > >On Sun, 4 Sep 2022, at 19:07, Warner Losh wrote: >> > > >> You need a newer boot loader... >> > > > >> > > >I was thinking - getting latest -current image, booting to it then >> > > >copying the contents of /boot from the image onto the mounted zpool >> ... >> > > > >> > > >feasible? >> > > >> > > Seems only EFI/ needed replacing from a recent snapshot. I thought it >> might >> > > be all of /boot but I was wrong. Thank you Mark! >> > > >> > >> > Yes. You'll need to update EFI/BOOT on your ESP. The rest of /boot is >> > updated >> > when you do an installworld. >> >> One of the oddities of the update sequence instructions is >> the lack of coverage of the likes of: >> >> Load Path: /efiootootaa64.efi >> >> What step of the sequencing for the overall system update? >> When is such an update required? (Here the example would >> be: Before rebooting when the ZFS pool(s) possibly used to >> boot gain new features?) When is it not required to update >> the loader in the ESP (or analogous)? Even just knowing >> the stage at which one should do the update indicates some >> about when to figure out if an update is needed and so >> prompts to be ready. >> > > Today: > > make installworld installkernel > mount -t msdos /dev/ /boot/efi > > and then one of three scenarios > > (1) You have the old boot1.efi. This will *always* be in > ESP:EFIBOOTBOOT${ARCH}.EFI. > (see uefi(8) for the values of ARCH). You can automatically detect this > for most installations > that were done since about FreeBSD 12: > % sudo efivar | grep Boot1 > cfee69ad-a0de-47a9-93a8-f63106f8ae99-Boot1Path > cfee69ad-a0de-47a9-93a8-f63106f8ae99-Boot1Dev > > In this case you would do: > > % sudo cp /boot/boot1.efi /boot/efi/efi/boot/boot${ARCH}.efi and you are > done. > > Please note: If your system was installed a long time ago, you should also > check to see if > you have a LoaderPath variable set: > % sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath > /boot/loader.efi > > When Boot1 isn't set and it is set to the above value (or something > similar), then you are > booting with a really old copy of boot1.efi. You will need to update it > and may need to arrange > for a larger ESP since FreeBSD's boot1.efifat was a tiny image that was > hard to grow. Steal > space from swap for a larger ESP, etc. Documenting that is beyond the > scope of this email. > > (2) You are booting with loader.efi and it is in the bug-compatibility > place. Some UEFI BIOSes > don't respect or can't set BootXXXX variables set by efibootmgr(8). In > that case, many people > are booting from the 'compatibiltiy' location for removable devices. This > will almost always be > a single boot scenario because you can't easily boot other systems like > this (well, unless 'quit' > works from the OK prompt to go to the next one on the list, but I > digress). You will see something like: > > % sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath > cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath > EFIBOOTBOOTX64.EFI > (or AA64) > > when you are booting this way. In this case the update command is: > > % sudo cp /boot/loader.efi /boot/efi/efi/boot/boot${ARCH}.efi > > to upgrade. Some people may be doing this already on systems that can > support efibootmgr(8) and > they can of course upgrade to using that, though that's also beyond the > scope of this email. > > (3) You are booting on a working system with a FreeBSD installed by the > boot loader, or some other > custom arrangement. In that case, you'll see something like: > sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath > cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath > EFIFREEBSDLOADER.EFI > > (or some other place for custom setups: I assume if you are doing that you > know enough to > update my instructions as appropriate). To update, you'd do > > % sudo cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi > > Automating all these cases is, needless to say, tricky. > > >> Part of the sequencing gets into having needed to do a >> installworld to have a from-same-build content replacement >> for the likes of /efiootootaa64.efi . So installkernel >> already done, a reboot already done, and an installworld >> having been done as well in order to have something to >> copy over. (There are no pointers to alternate places to >> get copies that I know of. One can find copies in the >> build tree when one builds from source locally. So waiting >> is not really required for that context.) >> > > Yea, I have a branch that has an 'installboot' target that updates the boot > loader regardless, but given the 50-odd combinations of ways we can > boot, it's a bit bogged down. > > >> This also make it seem that updating ZFS pool features >> should wait until after a system upgrade that spans both >> the loader and kernel being ready for the new features, >> even if compatibility with other systems is not a worry. >> > > Yes. ALWAYS update your boot blocks before zpool update. > > >> Do any of the system upgrade instructions cover such >> relationships? Do any of the ZFS pool upgrade instructions >> cover such? Does zpool or the like suggest such issues >> when it reports there are new features that could be >> enabled? >> > > See above. :) > > >> Part of what I expect happened here was contributed to by >> a lack of being prompted to even think about the relevant >> issues, leading to a pool feature upgrade that had not >> been prepared for. >> > > Yea, so far 100% of the 'help, I upgraded and now the boot loader > can't see zfs pool' issues have been 'I didn't upgrade my loader.efi > properly after zpool upgrade.' It was mandatory when we had the > OpenZFS rebase, but it is also necessary every few OpenZFS > updates from upstream as nnew features are enabled. > > I'd love for someone to add this information to the handbook, and I'd > happily review such an effort. I have time to do a brain dump, but not > to make it pretty / formatted for asciidoctor and won't for some time. > > Warner > > >> === >> Mark Millard >> marklmi at yahoo.com >> >> > > Interesting. > Does the loader pass a hint to the kernel about which loader was used to > load the kernel? > > Regards, > Ronald > > > > Oh I pressed send too soon. I now understand all the tools you already > mentioned. > Sorry for the noise. > boot1.efi and loader.efi set the UEFI environment variables I used above. No further hints are passed into the kernel... Warner --00000000000062b97b05e80b2f52 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Sep 6, 2022 at 4:31 PM Ronald= Klop <ronald-lists@klop.ws&= gt; wrote:

<= p>Van: Ronald Klop <ronald-lists@klop.ws>
Datum= : 6 september 2022 23:42
Aan: freebsd-arm <= freebsd-arm@fr= eebsd.org>, Warner Losh <imp@bsdimp.com>, Mark Millard <marklmi@yahoo.com>
Onder= werp: Re: kernel update broke -current


Van: Warner Losh <imp@bsdimp.com>
Datum: 6 september 2022 18:13
Aan: Mark Millard <marklmi@yahoo.com><= br>CC: freebsd-arm <freebsd-arm@freebsd.org>
Onderw= erp: Re: kernel update broke -current



On Mon, Sep 5, 2022 at 4:21 PM Mark Millard <marklmi@yahoo.com> wrote:
Warner Losh <imp_at_bsdimp.com> wrote = on
Date: Mon, 05 Sep 2022 20:07:33 UTC :

> On Sun, Sep 4, 2022 at 4:51 PM void <void@f-m.fm> wrote:
>
> > On Sun, Sep 04, 2022 at 07:31:59PM +0000, void wrote:
> > >
> > >On Sun, 4 Sep 2022, at 19:07, Warner Losh wrote:
> > >> You need a newer boot loader...
> > >
> > >I was thinking - getting latest -current image, booting to it= then
> > >copying the contents of /boot from the image onto the mounted= zpool ...
> > >
> > >feasible?
> >
> > Seems only EFI/ needed replacing from a recent snapshot. I though= t it might
> > be all of /boot but I was wrong. Thank you Mark!
> >
>
> Yes. You'll need to update EFI/BOOT on your ESP. The rest of /boot= is
> updated
> when you do an installworld.

One of the oddities of the update sequence instructions is
the lack of coverage of the likes of:

Load Path: /efiootootaa64.efi

What step of the sequencing for the overall system update?
When is such an update required? (Here the example would
be: Before rebooting when the ZFS pool(s) possibly used to
boot gain new features?) When is it not required to update
the loader in the ESP (or analogous)? Even just knowing
the stage at which one should do the update indicates some
about when to figure out if an update is needed and so
prompts to be ready.

Today:
<= br>
make installworld installkernel
mount -t msdos /dev= /<mumble-esp> /boot/efi

and then one of thre= e scenarios

(1) You have the old boot1.efi. This w= ill *always* be in ESP:EFIBOOTBOOT${ARCH}.EFI.
(see uefi(8) for t= he values of ARCH). You can automatically detect this for most installation= s
that were done since about FreeBSD 12:
% sudo efivar = | grep Boot1
cfee69ad-a0de-47a9-93a8-f63106f8ae99-Boot1Path
cf= ee69ad-a0de-47a9-93a8-f63106f8ae99-Boot1Dev

In= this case you would do:

% sudo cp /boot/boot1.efi= /boot/efi/efi/boot/boot${ARCH}.efi and you are done.

<= div>Please note: If your system was installed a long time ago, you should a= lso check to see if
you have a LoaderPath variable set:
% sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath
/boot/loader.efi

When Boot1 isn't set = and it is set to the above value (or something similar), then you are
=
booting with a really old copy of boot1.efi. You will need to update i= t and may need to arrange
for a larger ESP since FreeBSD's bo= ot1.efifat was a tiny image that was hard to grow. Steal
space fr= om swap for a larger ESP, etc. Documenting that is beyond the scope of this= email.

(2) You are booting with loader.efi and it= is in the bug-compatibility place. Some UEFI BIOSes
don't re= spect or can't set BootXXXX variables set by efibootmgr(8). In that cas= e, many people
are booting from the 'compatibiltiy' locat= ion for removable=C2=A0devices. This will almost always be
a sing= le boot scenario because you can't easily boot other systems like this = (well, unless 'quit'
works from the OK prompt to go to th= e next one on the list, but I digress). You will see something like:
<= div>
% sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99= -LoaderPath
cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath
EFIBOOT= BOOTX64.EFI
(or AA64)

when you are booting this w= ay. In this case the update command is:
% sudo cp /boot/loader.efi /boot/efi/efi/= boot/boot${ARCH}.efi

to upgrade. Some people may be doing this already on syste= ms that can support efibootmgr(8) and
they = can of course upgrade to using that, though that's also beyond the scop= e of this email.

(3) You are booting on a working system with a FreeBSD installed= by the boot loader, or some other
custom a= rrangement. In that case, you'll see something like:
sudo efivar --utf cfee69ad-a0de-47a9-93a8-f63106f8ae99-Loader= Path
cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderPath
EFIFREEBSDLOADER= .EFI

(= or some other place for custom setups: I assume if you are doing that you k= now enough to
update my instructions as app= ropriate). To update, you'd do

% sudo cp /boot/loader.efi /boot/efi/efi/freeb= sd/loader.efi

Automating all these cases is, needless to say, tricky.
=C2= =A0
Part of the sequencing gets into having needed to do a
installworld to have a from-same-build content replacement
for the likes of /efiootootaa64.efi . So installkernel
already done, a reboot already done, and an installworld
having been done as well in order to have something to
copy over. (There are no pointers to alternate places to
get copies that I know of. One can find copies in the
build tree when one builds from source locally. So waiting
is not really required for that context.)

Yea, I have a branch that has an 'installboot' target that updat= es the boot
loader regardless, but given the 50-odd combinations = of ways we can
boot, it's a bit bogged down.
=C2=A0=
This also make it seem that updating ZFS pool features
should wait until after a system upgrade that spans both
the loader and kernel being ready for the new features,
even if compatibility with other systems is not a worry.

Yes. ALWAYS update your boot blocks before zpool update.<= /div>
=C2=A0
Do any of the system upgrade instructions cover such
relationships? Do any of the ZFS pool upgrade instructions
cover such? Does zpool or the like suggest such issues
when it reports there are new features that could be
enabled?

See above. :)
=C2=A0=
Part of what I expect happened here was contributed to by
a lack of being prompted to even think about the relevant
issues, leading to a pool feature upgrade that had not
been prepared for.

Yea, so far 100% of = the 'help, I upgraded and now the boot loader
can't see z= fs pool' issues have been 'I didn't upgrade my loader.efi
=
properly after zpool upgrade.' It was mandatory when we had the
OpenZFS rebase, but it is also necessary every few OpenZFS
updates from upstream as nnew features are enabled.

<= div>I'd love for someone to add this information to the handbook, and I= 'd
happily=C2=A0review such an effort. I have time to do a br= ain dump, but not
to make it pretty / formatted for asciidoctor a= nd won't for some time.

Warner
=C2= =A0
=3D=3D=3D
Mark Millard
marklmi at yahoo.com



Interesting.=C2=A0
Does the loader pass a hint to t= he kernel about which loader was used to load the kernel?

Regards,
Ronald



Oh I pressed send too soon. I now understand all the tools= you already mentioned.
Sorry for the noise.
boot1.efi and loader.efi set the UEFI=C2=A0environment variable= s I used above. No further hints
are passed into the kernel...

Warner
--00000000000062b97b05e80b2f52--