Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Feb 2022 12:00:27 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Miroslav Lachman <000.fbsd@quip.cz>
Cc:        Alexander Leidinger <Alexander@leidinger.net>,  FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: bootcode update after zpool upgrade
Message-ID:  <CANCZdfrBLxEajZNQhU-k=JP9L98ghZDE%2BQeaFRVjXvbC8GhsSw@mail.gmail.com>
In-Reply-To: <6c9758cc-056f-c1d3-e2ff-45f0adbd2c2f@quip.cz>
References:  <20220224104322.Horde.akByDDeJzjTUIyGt_Few2RI@webmail.leidinger.net> <5715fdc2-fb94-99d4-7a11-fe0666807866@quip.cz> <CANCZdfoSrYSv0jJtiT9W=m%2B8ZuwJQ2shUTR0q4sbx9BJPPZeCw@mail.gmail.com> <6c9758cc-056f-c1d3-e2ff-45f0adbd2c2f@quip.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
--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
> > <mailto:000.fbsd@quip.cz>> wrote:
> >
> >     On 24/02/2022 10:43, Alexander Leidinger wrote:
> >      > Quoting Miroslav Lachman <000.fbsd@quip.cz
> >     <mailto: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

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Thu, Feb 24, 2022 at 11:51 AM Miro=
slav Lachman &lt;<a href=3D"mailto:000.fbsd@quip.cz">000.fbsd@quip.cz</a>&g=
t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 24/=
02/2022 17:55, Warner Losh wrote:<br>
&gt; <br>
&gt; <br>
&gt; On Thu, Feb 24, 2022 at 4:49 AM Miroslav Lachman &lt;<a href=3D"mailto=
:000.fbsd@quip.cz" target=3D"_blank">000.fbsd@quip.cz</a> <br>
&gt; &lt;mailto:<a href=3D"mailto:000.fbsd@quip.cz" target=3D"_blank">000.f=
bsd@quip.cz</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 24/02/2022 10:43, Alexander Leidinger wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Quoting Miroslav Lachman &lt;<a href=3D"mailt=
o:000.fbsd@quip.cz" target=3D"_blank">000.fbsd@quip.cz</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:000.fbsd@quip.cz" targ=
et=3D"_blank">000.fbsd@quip.cz</a>&gt;&gt; (from Wed, 23 Feb 2022<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; I am not sure what I should update. This =
machine is EFI boot only<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; (this is the only one EFI machine we have=
).<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; Should I run:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; gpart bootcode -b /boot/pmbr -p /boot/gpt=
zfsboot -i 2 nvd0<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; gpart bootcode -b /boot/pmbr -p /boot/gpt=
zfsboot -i 2 nvd1<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; This is the bootcode zpool upgrade talks abou=
t.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; Or should I update EFI partitions? (if so=
, then how?)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; The EFI partition contains the loader, not th=
e bootcode.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; While we are at it, I&#39;m still looking for=
 the place where I can find<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; which features the bootcode supports. Not all=
 features are<br>
&gt;=C2=A0 =C2=A0 =C2=A0supported for<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; a root pool.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Thank you for the clarification!<br>
&gt; <br>
&gt; <br>
&gt; If you&#39;ve updated your ZFS pool and have an old system, you do nee=
d to <br>
&gt; update<br>
&gt; the EFI boot code. None of the mbr stuff is used for EFI booting.<br>
&gt; <br>
&gt; If you have an old installation, it may be small. So ideally, you&#39;=
d copy <br>
&gt; over /boot/loader.efi<br>
&gt; to ESP:efi/boot/bootx64.efi. However, it may be too big if you have an=
 <br>
&gt; ESP created by the<br>
&gt; old installer. In that case, you&#39;ll need to either create a new, l=
arger <br>
&gt; ESP, or copying=C2=A0/boot/boot1.efi<br>
&gt; instead.<br>
<br>
This machine was installed 2 years ago as FreeBSD 11.2 and then upgraded <b=
r>
to 11.4 and 12.2. The last update was from 12.2-p9 to 12.2-p13 so the <br>
machine was booting fine without modification of bootcode and with <br>
FreeBSD 12.2-p9 but after the last update to -p13 I decided to run <br>
&quot;zpool upgrade&quot;.<br>
<br>
So the question is, do I need to update efi/boot/bootx64.efi?<br></blockquo=
te><div><br></div><div>If you&#39;ve done a zpool upgrade from before the s=
witch to OpenZFS, then yes. You do.</div><div>=C2=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">
I tried to look at it:<br>
<br>
# mount -t msdosfs /dev/nvd0p1 /media/<br>
<br>
# ll /media/efi/boot/<br>
total 385<br>
-rwxr-xr-x=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0384K Apr 16=C2=A0 2018 BOOT=
x64.efi*<br>
-rwxr-xr-x=C2=A0 1 root=C2=A0 wheel=C2=A0 =C2=A0 12B Apr 16=C2=A0 2018 star=
tup.nsh*<br>
<br>
The BOOTx64.efi is old, from 11.2 install.<br>
<br>
The newer one in /boot/ looks bigger<br>
<br>
478K Mar 24=C2=A0 2021 loader.efi<br></blockquote><div><br></div><div>Yea. =
It is.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">
<br>
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<br>
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd1<br></blockquote>=
<div><br></div><div>If you are booting with UEFI, this code never executes.=
</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But I found something in my notes from install time few years ago:<br>
gpart bootcode -p /boot/boot1.efifat -i 2 /dev/nvd01<br>
<br>
What really should be installed on freebsd-boot partition?<br>
/boot/gptzfsboot or /boot/boot1.efifat<br></blockquote><div><br></div><div>=
/boot/gptzfsboot, assuming that you are using legacy BIOS boot</div><div>an=
d not UEFI boot. If you are using UEFI boot, then the right answer</div><di=
v>is that it doesn&#39;t matter since it won&#39;t be used.</div><div>=C2=
=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">
# gpart show<br>
=3D&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 40=C2=A0 1953525088=C2=A0 nvd0=C2=A0 GPT=
=C2=A0 (932G)<br>
=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)<br>
=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)<br>
=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)<br>
=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)<br>
=C2=A0 =C2=A0 =C2=A021495808=C2=A0 1932001280=C2=A0 =C2=A0 =C2=A04=C2=A0 fr=
eebsd-zfs=C2=A0 (921G)<br>
=C2=A0 =C2=A01953497088=C2=A0 =C2=A0 =C2=A0 =C2=A028040=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 - free -=C2=A0 (14M)<br>
<br>
I am sorry for asking this questions but this is the only machine with <br>
EFI I had and never did &quot;zpool upgrade&quot; on it.<br></blockquote><d=
iv><br></div><div>Ah, if you&#39;ve not done a zpool upgrade with the EFI m=
achine, you needn&#39;t</div><div>do anything to keep it working.</div><div=
>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Is there a way to test if the machine will be bootable befor I try to <br>
reboot it? The machine is not physically accessible to me so the <br>
recovery from failed boot is very problematic.<br></blockquote><div><br></d=
iv><div>In that case, don&#39;t update the boot blocks, and don&#39;t do a =
zpool upgrade.</div><div><br></div><div>Warner=C2=A0<br></div></div></div>

--000000000000a427de05d8c8326c--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrBLxEajZNQhU-k=JP9L98ghZDE%2BQeaFRVjXvbC8GhsSw>