From nobody Thu Feb 24 19:00:27 2022 X-Original-To: freebsd-stable@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 482FC19D679E for ; Thu, 24 Feb 2022 19:00:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) (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 4K4MgJ3fYlz4S85 for ; Thu, 24 Feb 2022 19:00:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe2f.google.com with SMTP id g21so3176860vsp.6 for ; Thu, 24 Feb 2022 11:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TMjzeVbGXIvT01NjZ7tP+F/XizD5C+tihlglUs+bxes=; b=muKYaA/gtvdJ3p6u9OST2WjIxP3bhavMmN8PJ0afTcxjJ3X0KaV3zAgQPqSt4h39Eg eXiZ952JgIEA+J/QqnP+1Nn92gCpj2pDf5N6Nxu2KmdhMjl7jffZ/zMkS9eCqZU4bcKl WNZ+DphqqUHqrUOvG6WxZDFIe/HzTdY/lo0469hIBhcr/R9D2FnvnMcnUAMNW8wPsGxl IPkdxxuacJCb5TJPV/02/1SYUVwC12+v/+QCZRhWJ6zCYxJZHDEvG8NqLrWZlinAfWAy Gihw6/cx02P2I97UfGAiQJ3trvD44SFoZu/8ecRt3TEBPsjut0hRwLlSpv+/InvnmgDV kW9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TMjzeVbGXIvT01NjZ7tP+F/XizD5C+tihlglUs+bxes=; b=el4AMoXEdxJo3xprL+4VJaYi5ODhR8veAhHc0O0AeBNFKn1m2sIf1VnvCqgcmHHd2t WcbughUBzBjx3v4FS+6j7uoMvyMzOL7pHuiCj+Y214Y+vVyKB8zsUzoyHVsak9KVB0jb ftJ+ojUeOqITLKrAy3hvJynAr2anoOR5Ri3A89uym/XRuRvqhAqpY5lJ2Fa5+3Haqms7 eNHDAOSAONArgJSg276V+hFLpRNBOtmbJ1K00gPogxfszduIvLjMHx6TUZ0i3UZkki8I 81HYHtyEE32KpACRHX5EF9wZ8dfGycWObckIugcXmBgxPv+Gr9vYanAuQRPfpyontMtL kl3Q== X-Gm-Message-State: AOAM531nEy/UABjHw9v0D6t57sKTuVRx6Ul8AfApWgKyI58mbgH2MONR LSLhA4dp7P8HqcNqW+gGocSYxq7tluO6yYY8mO0MjKCtl/8= X-Google-Smtp-Source: ABdhPJxsimiwXmTkQWS9tEs1IiI5j9PH6Jvj87VnBD0OWM4sZ/iCh6ERcnI7+C3stm1PwMSJ7Mn5UQeEWQELt235wjU= X-Received: by 2002:a05:6102:3e8e:b0:31b:aaec:cece with SMTP id m14-20020a0561023e8e00b0031baaeccecemr1800824vsv.42.1645729238225; Thu, 24 Feb 2022 11:00:38 -0800 (PST) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: <20220224104322.Horde.akByDDeJzjTUIyGt_Few2RI@webmail.leidinger.net> <5715fdc2-fb94-99d4-7a11-fe0666807866@quip.cz> <6c9758cc-056f-c1d3-e2ff-45f0adbd2c2f@quip.cz> In-Reply-To: <6c9758cc-056f-c1d3-e2ff-45f0adbd2c2f@quip.cz> From: Warner Losh Date: Thu, 24 Feb 2022 12:00:27 -0700 Message-ID: Subject: Re: bootcode update after zpool upgrade To: Miroslav Lachman <000.fbsd@quip.cz> Cc: Alexander Leidinger , FreeBSD Stable Mailing List Content-Type: multipart/alternative; boundary="000000000000a427de05d8c8326c" X-Rspamd-Queue-Id: 4K4MgJ3fYlz4S85 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b="muKYaA/g"; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e2f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.56 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.44)[0.438]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-stable@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e2f:from]; MLMMJ_DEST(0.00)[freebsd-stable]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_SPF_NA(0.00)[no SPF record]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] X-ThisMailContainsUnwantedMimeParts: N --000000000000a427de05d8c8326c Content-Type: text/plain; charset="UTF-8" On Thu, Feb 24, 2022 at 11:51 AM Miroslav Lachman <000.fbsd@quip.cz> wrote: > On 24/02/2022 17:55, Warner Losh wrote: > > > > > > On Thu, Feb 24, 2022 at 4:49 AM Miroslav Lachman <000.fbsd@quip.cz > > > wrote: > > > > On 24/02/2022 10:43, Alexander Leidinger wrote: > > > Quoting Miroslav Lachman <000.fbsd@quip.cz > > > (from Wed, 23 Feb 2022 > > > > >> I am not sure what I should update. This machine is EFI boot only > > >> (this is the only one EFI machine we have). > > > > > >> Should I run: > > >> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd0 > > >> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd1 > > > > > > This is the bootcode zpool upgrade talks about. > > > > > >> Or should I update EFI partitions? (if so, then how?) > > > > > > The EFI partition contains the loader, not the bootcode. > > > > > > While we are at it, I'm still looking for the place where I can > find > > > which features the bootcode supports. Not all features are > > supported for > > > a root pool. > > > > Thank you for the clarification! > > > > > > If you've updated your ZFS pool and have an old system, you do need to > > update > > the EFI boot code. None of the mbr stuff is used for EFI booting. > > > > If you have an old installation, it may be small. So ideally, you'd copy > > over /boot/loader.efi > > to ESP:efi/boot/bootx64.efi. However, it may be too big if you have an > > ESP created by the > > old installer. In that case, you'll need to either create a new, larger > > ESP, or copying /boot/boot1.efi > > instead. > > This machine was installed 2 years ago as FreeBSD 11.2 and then upgraded > to 11.4 and 12.2. The last update was from 12.2-p9 to 12.2-p13 so the > machine was booting fine without modification of bootcode and with > FreeBSD 12.2-p9 but after the last update to -p13 I decided to run > "zpool upgrade". > > So the question is, do I need to update efi/boot/bootx64.efi? > If you've done a zpool upgrade from before the switch to OpenZFS, then yes. You do. > I tried to look at it: > > # mount -t msdosfs /dev/nvd0p1 /media/ > > # ll /media/efi/boot/ > total 385 > -rwxr-xr-x 1 root wheel 384K Apr 16 2018 BOOTx64.efi* > -rwxr-xr-x 1 root wheel 12B Apr 16 2018 startup.nsh* > > The BOOTx64.efi is old, from 11.2 install. > > The newer one in /boot/ looks bigger > > 478K Mar 24 2021 loader.efi > Yea. It is. > > And the second question is back on bootcode. I already run gpart bootcode: > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd0 > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd1 > If you are booting with UEFI, this code never executes. > But I found something in my notes from install time few years ago: > gpart bootcode -p /boot/boot1.efifat -i 2 /dev/nvd01 > > What really should be installed on freebsd-boot partition? > /boot/gptzfsboot or /boot/boot1.efifat > /boot/gptzfsboot, assuming that you are using legacy BIOS boot and not UEFI boot. If you are using UEFI boot, then the right answer is that it doesn't matter since it won't be used. > # gpart show > => 40 1953525088 nvd0 GPT (932G) > 40 409600 1 efi (200M) > 409640 1024 2 freebsd-boot (512K) > 410664 113624 - free - (55M) > 524288 20971520 3 freebsd-swap (10G) > 21495808 1932001280 4 freebsd-zfs (921G) > 1953497088 28040 - free - (14M) > > I am sorry for asking this questions but this is the only machine with > EFI I had and never did "zpool upgrade" on it. > Ah, if you've not done a zpool upgrade with the EFI machine, you needn't do anything to keep it working. > Is there a way to test if the machine will be bootable befor I try to > reboot it? The machine is not physically accessible to me so the > recovery from failed boot is very problematic. > In that case, don't update the boot blocks, and don't do a zpool upgrade. Warner --000000000000a427de05d8c8326c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Feb 24, 2022 at 11:51 AM Miro= slav Lachman <000.fbsd@quip.cz&g= t; wrote:
On 24/= 02/2022 17:55, Warner Losh wrote:
>
>
> On Thu, Feb 24, 2022 at 4:49 AM Miroslav Lachman <000.fbsd@quip.cz
> <mailto:000.f= bsd@quip.cz>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0On 24/02/2022 10:43, Alexander Leidinger wrote:
>=C2=A0 =C2=A0 =C2=A0 > Quoting Miroslav Lachman <000.fbsd@quip.cz
>=C2=A0 =C2=A0 =C2=A0<mailto:000.fbsd@quip.cz>> (from Wed, 23 Feb 2022
>
>=C2=A0 =C2=A0 =C2=A0 >> I am not sure what I should update. This = machine is EFI boot only
>=C2=A0 =C2=A0 =C2=A0 >> (this is the only one EFI machine we have= ).
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 >> Should I run:
>=C2=A0 =C2=A0 =C2=A0 >> gpart bootcode -b /boot/pmbr -p /boot/gpt= zfsboot -i 2 nvd0
>=C2=A0 =C2=A0 =C2=A0 >> gpart bootcode -b /boot/pmbr -p /boot/gpt= zfsboot -i 2 nvd1
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > This is the bootcode zpool upgrade talks abou= t.
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 >> Or should I update EFI partitions? (if so= , then how?)
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > The EFI partition contains the loader, not th= e bootcode.
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > While we are at it, I'm still looking for= the place where I can find
>=C2=A0 =C2=A0 =C2=A0 > which features the bootcode supports. Not all= features are
>=C2=A0 =C2=A0 =C2=A0supported for
>=C2=A0 =C2=A0 =C2=A0 > a root pool.
>
>=C2=A0 =C2=A0 =C2=A0Thank you for the clarification!
>
>
> If you've updated your ZFS pool and have an old system, you do nee= d to
> update
> the EFI boot code. None of the mbr stuff is used for EFI booting.
>
> If you have an old installation, it may be small. So ideally, you'= d copy
> over /boot/loader.efi
> to ESP:efi/boot/bootx64.efi. However, it may be too big if you have an=
> ESP created by the
> old installer. In that case, you'll need to either create a new, l= arger
> ESP, or copying=C2=A0/boot/boot1.efi
> instead.

This machine was installed 2 years ago as FreeBSD 11.2 and then upgraded to 11.4 and 12.2. The last update was from 12.2-p9 to 12.2-p13 so the
machine was booting fine without modification of bootcode and with
FreeBSD 12.2-p9 but after the last update to -p13 I decided to run
"zpool upgrade".

So the question is, do I need to update efi/boot/bootx64.efi?

If you've done a zpool upgrade from before the s= witch to OpenZFS, then yes. You do.
=C2=A0
I tried to look at it:

# mount -t msdosfs /dev/nvd0p1 /media/

# ll /media/efi/boot/
total 385
-rwxr-xr-x=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0384K Apr 16=C2=A0 2018 BOOT= x64.efi*
-rwxr-xr-x=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 12B Apr 16=C2=A0 2018 star= tup.nsh*

The BOOTx64.efi is old, from 11.2 install.

The newer one in /boot/ looks bigger

478K Mar 24=C2=A0 2021 loader.efi

Yea. = It is.
=C2=A0

And the second question is back on bootcode. I already run gpart bootcode:<= br> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd1
=

If you are booting with UEFI, this code never executes.=
=C2=A0
But I found something in my notes from install time few years ago:
gpart bootcode -p /boot/boot1.efifat -i 2 /dev/nvd01

What really should be installed on freebsd-boot partition?
/boot/gptzfsboot or /boot/boot1.efifat

= /boot/gptzfsboot, assuming that you are using legacy BIOS boot
an= d not UEFI boot. If you are using UEFI boot, then the right answer
is that it doesn't matter since it won't be used.
=C2= =A0
# gpart show
=3D>=C2=A0 =C2=A0 =C2=A0 =C2=A0 40=C2=A0 1953525088=C2=A0 nvd0=C2=A0 GPT= =C2=A0 (932G)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A040=C2=A0 =C2=A0 =C2=A0 409600=C2= =A0 =C2=A0 =C2=A01=C2=A0 efi=C2=A0 (200M)
=C2=A0 =C2=A0 =C2=A0 =C2=A0409640=C2=A0 =C2=A0 =C2=A0 =C2=A0 1024=C2=A0 =C2= =A0 =C2=A02=C2=A0 freebsd-boot=C2=A0 (512K)
=C2=A0 =C2=A0 =C2=A0 =C2=A0410664=C2=A0 =C2=A0 =C2=A0 113624=C2=A0 =C2=A0 = =C2=A0 =C2=A0 - free -=C2=A0 (55M)
=C2=A0 =C2=A0 =C2=A0 =C2=A0524288=C2=A0 =C2=A0 20971520=C2=A0 =C2=A0 =C2=A0= 3=C2=A0 freebsd-swap=C2=A0 (10G)
=C2=A0 =C2=A0 =C2=A021495808=C2=A0 1932001280=C2=A0 =C2=A0 =C2=A04=C2=A0 fr= eebsd-zfs=C2=A0 (921G)
=C2=A0 =C2=A01953497088=C2=A0 =C2=A0 =C2=A0 =C2=A028040=C2=A0 =C2=A0 =C2=A0= =C2=A0 - free -=C2=A0 (14M)

I am sorry for asking this questions but this is the only machine with
EFI I had and never did "zpool upgrade" on it.

Ah, if you've not done a zpool upgrade with the EFI m= achine, you needn't
do anything to keep it working.
=C2=A0
Is there a way to test if the machine will be bootable befor I try to
reboot it? The machine is not physically accessible to me so the
recovery from failed boot is very problematic.

In that case, don't update the boot blocks, and don't do a = zpool upgrade.

Warner=C2=A0
--000000000000a427de05d8c8326c--