From nobody Thu Feb 24 22:21:20 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 B139B19DCB91 for ; Thu, 24 Feb 2022 22:21:26 +0000 (UTC) (envelope-from SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4K4S6s2jdmz4tCB for ; Thu, 24 Feb 2022 22:21:25 +0000 (UTC) (envelope-from SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id A755128417; Thu, 24 Feb 2022 23:21:23 +0100 (CET) Received: from illbsd.quip.test (ip-78-45-215-131.net.upcbroadband.cz [78.45.215.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id E936A28411; Thu, 24 Feb 2022 23:21:21 +0100 (CET) Subject: Re: bootcode update after zpool upgrade To: Warner Losh Cc: Alexander Leidinger , FreeBSD Stable Mailing List References: <20220224104322.Horde.akByDDeJzjTUIyGt_Few2RI@webmail.leidinger.net> <5715fdc2-fb94-99d4-7a11-fe0666807866@quip.cz> <6c9758cc-056f-c1d3-e2ff-45f0adbd2c2f@quip.cz> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: <0e01195b-dff0-7b8c-acd9-06135cb52eeb@quip.cz> Date: Thu, 24 Feb 2022 23:21:20 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 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 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4K4S6s2jdmz4tCB X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of "SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz" has no SPF policy when checking 94.124.105.4) smtp.mailfrom="SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz" X-Spamd-Result: default: False [2.17 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.952]; NEURAL_SPAM_LONG(0.92)[0.922]; MLMMJ_DEST(0.00)[freebsd-stable]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=rzo6=TH=quip.cz=000.fbsd@elsa.codelab.cz]; RECEIVED_SPAMHAUS_PBL(0.00)[78.45.215.131:received] X-ThisMailContainsUnwantedMimeParts: N On 24/02/2022 20:00, Warner Losh wrote: > > > 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 think this is the case, zpool (and bootx64.efi) was created with 11.2 and now upgraded under 12.2. I am not sure if 12.2 is OpenZFS based (I thought it is in 13.0) > 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. Yes, this machne boots with UEFI only. As I ran gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 /dev/nvd01 am I right I must run gpart bootcode -p /boot/boot1.efifat -i 2 /dev/nvd01 to fix it now? Or for what is boot1.efifat useful? > # 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. I did. I did "zpool upgrade" on other machines as well but they were legacy BIOS based with simple GPT and there were not any problem. That's why I run "zpool upgrade" on this UEFI based machine too and right after that I realized there can be some problem. > 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. Yes, I think I will never zpool upgrade on this machine again. Kind regards Miroslav Lachman