From owner-freebsd-stable@freebsd.org Fri Jul 10 19:25:15 2020 Return-Path: Delivered-To: freebsd-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67FA3371234 for ; Fri, 10 Jul 2020 19:25:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B3NKl26m3z3Y2p for ; Fri, 10 Jul 2020 19:25:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 24B701042C for ; Fri, 10 Jul 2020 19:25:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f179.google.com with SMTP id b185so6402024qkg.1 for ; Fri, 10 Jul 2020 12:25:15 -0700 (PDT) X-Gm-Message-State: AOAM530loS9bJaRhLItcOTNKFS+9iU/2bJUQUCDnIpGbFZpEvR21ieop M6RSotw7pajJUmmNXuwUTMwMJqp3YUfeDcvIeRY= X-Google-Smtp-Source: ABdhPJxaUlD5gWuy20ypeSNi9//cVc86V/Utnlz0zwtbVN/hMeVieSivPvccsXZH6mRZM7Zt9sZqj8DiHlJwHQGg/0o= X-Received: by 2002:a37:b987:: with SMTP id j129mr68839086qkf.120.1594409114610; Fri, 10 Jul 2020 12:25:14 -0700 (PDT) MIME-Version: 1.0 References: <20200709131201.GA3464@co.gvr.org> <20200709211854.GA11731@phouka1.phouka.net> In-Reply-To: <20200709211854.GA11731@phouka1.phouka.net> From: Kyle Evans Date: Fri, 10 Jul 2020 14:25:02 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: 12.1p7 no longer boots after doing zpool upgrade -a To: John Kennedy Cc: Guido van Rooij , FreeBSD-STABLE Mailing List Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 19:25:15 -0000 On Thu, Jul 9, 2020 at 4:20 PM John Kennedy wrote: > > On Thu, Jul 09, 2020 at 08:24:54AM -0500, Kyle Evans wrote: > > On Thu, Jul 9, 2020 at 8:12 AM Guido van Rooij wrote: > > > > > > I did a zpool upgrade -a to enable large_dnode and spacemap_v2. > > > After that, I did: > > > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0 > > > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada1 > > > and: > > > gpart bootcode -p /boot/boot1.efifat -i 1 ada0 > > > gpart bootcode -p /boot/boot1.efifat -i 1 ada1 > > > > > > Now the system no longer boots from either disk and drops to the efi shell. > > > > This method of updating the ESP is no longer recommended for new 12.x > > installations -- we now more carefully construct the ESP with an > > /EFI/FreeBSD/loader.efi where loader.efi is /boot/loader.efi. You will > > want to rebuild this as such, and that may fix part of your problem. > > So, I've got a stable box: > > FreeBSD 12.1-STABLE #156 r362983+cd7a9efd329c(stable/12): Tue Jul 7 07:42:17 PDT 2020 > > I've got almost the same situation, except I haven't shot myself in the foot yet. > My partitions: > > # gpart show nvd0 nvd1 > => 40 976773088 nvd0 GPT (466G) > 40 409600 1 efi (200M) > 409640 1024 2 freebsd-boot (512K) > 410664 984 - free - (492K) > 411648 16777216 3 freebsd-swap (8.0G) > 17188864 959584256 4 freebsd-zfs (458G) > 976773120 8 - free - (4.0K) > > => 40 976773088 nvd1 GPT (466G) > 40 409600 1 efi (200M) > 409640 1024 2 freebsd-boot (512K) > 410664 984 - free - (492K) > 411648 16777216 3 freebsd-swap (8.0G) > 17188864 959584256 4 freebsd-zfs (458G) > 976773120 8 - free - (4.0K) > > [... snip ...] > > If this was a Pre-UEFI, I would be expecting to do (only) something like: > > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd0 > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 nvd1 > > IE, might hit either drive, update the freebsd-boot partition by # on both, > and special note that the # is now one higher because of the EFI partition. > > The FreeBSD wiki still has the "old" way of doing it here... > > https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot > > ... but your newer way of doing it here: > > https://wiki.freebsd.org/UEFI > > So the newer way of doing it would be something like this, except I'd by updating > the file rather than looking at it's checksum/version? > > strings -a < /boot/loader.efi | grep -A1 'EFI loader' > FreeBSD/amd64 EFI loader, Revision 1.1 > (Tue Jul 7 07:33:24 PDT 2020 warlock@ouroboros.phouka.net) > > mount -t msdosfs /dev/nvd0p1 /mnt > md5 -r /boot/loader.efi /mnt/efi/boot/BOOTx64.efi > 9f64a96f3170e3327ca7dad1d574d852 /boot/loader.efi > cbff58cc8ee79ce7342f5be23ad14ba3 /mnt/efi/boot/BOOTx64.efi > strings -a < /mnt/efi/boot/BOOTx64.efi | grep -A1 'EFI loader' > FreeBSD/amd64 EFI loader, Revision 1.1 > |/-\ > umount -v /mnt > > mount -t msdosfs /dev/nvd1p1 /mnt > md5 -r /mnt/efi/boot/BOOTx64.efi > cbff58cc8ee79ce7342f5be23ad14ba3 /mnt/efi/boot/BOOTx64.efi > umount -v /mnt > > At least some of the checksum difference is because WITHOUT_REPRODUCIBLE_BUILD=YES. > Yes, this looks correct to me. > (Sorry for extra details, but I know when I was researching this, I ran > across a *lot* of examples where we didn't have a GPT dump and people > were just using partition #s and if you stomp on the wrong partition > you're going to have a bad day, so leaving some specific examples here.) > > So one recipe doesn't even seem to make the freebsd-boot partition, so is it > optional for a pure UEFI boot? Should we always gpart-bootcode it if it exists > and upgrade BOOTx64.efi when the EFI partition exists, or is there a few more > wrinkles we need to worry about? > Correct, freebsd-boot is not needed for a pure UEFI boot. I wouldn't necessarily bother updating the freebsd-boot partition unless you suspect you may need to switch back to legacy boot at some point; UEFI is now rock-solid on all of my systems, so I've personally found no such need and on many of them I've removed the old freebsd-boot bits. If you've got an ESP, you should update that manually. If you want to maintain the option of legacy boot, you should use gpart-bootcode for that but don't use it on the ESP with boot1.efifat. > In any case, is it a logical theory that my possible boot-order problem > is because drive order got swapped and maybe one wasn't properly updated? > They seem to be the same: > > # md5 /dev/nvd[01]p2 > MD5 (/dev/nvd0p2) = 2ded438a2c97ea551446cc2d1d3b498e > MD5 (/dev/nvd1p2) = 2ded438a2c97ea551446cc2d1d3b498e > > Ideally I'd like to have not boot through the UEFI boot menu every time. > > I'm not sure why the drive order seems to matter right now. > When you get booted back to the UEFI menu, is it a specific drive that you must select or do both equally work from that point? Thanks, Kyle Evans