From nobody Tue Dec 24 16:09:03 2024
X-Original-To: questions@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 4YHfwB47Zfz5hPVZ
	for <questions@mlmmj.nyi.freebsd.org>; Tue, 24 Dec 2024 16:09:14 +0000 (UTC)
	(envelope-from chris@vindaloo.com)
Received: from yavin.vindaloo.com (yavin.vindaloo.com [173.199.117.73])
	(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 (2048 bits) client-digest SHA256)
	(Client CN "yavin.vindaloo.com", Issuer "Vindaloo Sign CA - 2026" (not verified))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4YHfw838CSz4Y6M
	for <questions@freebsd.org>; Tue, 24 Dec 2024 16:09:11 +0000 (UTC)
	(envelope-from chris@vindaloo.com)
Authentication-Results: mx1.freebsd.org;
	dkim=none;
	spf=pass (mx1.freebsd.org: domain of chris@vindaloo.com designates 173.199.117.73 as permitted sender) smtp.mailfrom=chris@vindaloo.com;
	dmarc=pass (policy=none) header.from=vindaloo.com
Received: from smtp.vindaloo.com (anza.vindaloo.com [IPv6:2001:470:1f07:26b:0:ac18:9004:0])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.vindaloo.com", Issuer "Vindaloo Sign CA - 2026" (verified OK))
	by yavin.vindaloo.com (Postfix) with ESMTPS id E3CDAB0116
	for <questions@freebsd.org>; Tue, 24 Dec 2024 11:09:04 -0500 (EST)
Received: from niamos.vindaloo.com (unknown [IPv6:2001:470:1f07:26b::14d:1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(Client did not present a certificate)
	by smtp.vindaloo.com (Postfix) with ESMTPSA id 69DB836;
	Tue, 24 Dec 2024 11:09:04 -0500 (EST)
Date: Tue, 24 Dec 2024 11:09:03 -0500
From: Christopher Sean Hilton <chris@vindaloo.com>
To: questions@freebsd.org
Subject: Error: "Loader need to be updated" on boot in various combinations
Message-ID: <Z2rcn4LkkY7HyzoC@niamos.vindaloo.com>
Mail-Followup-To: Christopher Sean Hilton <chris@vindaloo.com>,
	questions@freebsd.org
List-Id: User questions <freebsd-questions.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-questions
List-Help: <mailto:questions+help@freebsd.org>
List-Post: <mailto:questions@freebsd.org>
List-Subscribe: <mailto:questions+subscribe@freebsd.org>
List-Unsubscribe: <mailto:questions+unsubscribe@freebsd.org>
X-BeenThere: freebsd-questions@freebsd.org
Sender: owner-freebsd-questions@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Spamd-Result: default: False [-3.80 / 15.00];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	NEURAL_HAM_SHORT(-1.00)[-0.999];
	DMARC_POLICY_ALLOW(-0.50)[vindaloo.com,none];
	R_SPF_ALLOW(-0.20)[+ip4:173.199.117.73];
	MIME_GOOD(-0.10)[text/plain];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	RCPT_COUNT_ONE(0.00)[1];
	FREEFALL_USER(0.00)[chris];
	ASN(0.00)[asn:20473, ipnet:173.199.116.0/22, country:US];
	MISSING_XM_UA(0.00)[];
	MIME_TRACE(0.00)[0:+];
	RCVD_TLS_ALL(0.00)[];
	MLMMJ_DEST(0.00)[questions@freebsd.org];
	MID_RHS_MATCH_FROMTLD(0.00)[];
	FROM_EQ_ENVFROM(0.00)[];
	FROM_HAS_DN(0.00)[];
	R_DKIM_NA(0.00)[];
	RCVD_COUNT_TWO(0.00)[2];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	TO_DN_NONE(0.00)[];
	PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org];
	ARC_NA(0.00)[]
X-Rspamd-Queue-Id: 4YHfw838CSz4Y6M
X-Spamd-Bar: ---

I'm in the process of updating a set of machines from FreeBSD 13.2 and FreeBSD 13.3 to
13.4. If the machine starts on 13.2, then my process is:

    ```
    # freebsd-update upgrade -r 13.3-RELEASE
    ...
    # freebsd-update install; reboot
    ...
    # freebsd-update install

    ...
    # freebsd-update upgrade -r 13.4-RELEASE
    ...
    ```

I haven specifically watched, but I will next time, but when I do this I end up with a
machine that boots fine but sends the message:

- "Loader needs to be updated"

All of the machines are VMs running of VMware Fusion or ESXi so I can Snapshot the machines
leaving me free to do some experimentation in my search for a solution. However, searching
around the internet hasn't produced a solution to this problem. I'll give two examples:

One of the machines is an aarch64 VM with ZFS root filesystem.

    ```
    $ gpart show
    =>      40  83886000  nda0  GPT  (40G)
            40    532480     1  efi  (260M)
        532520      2008        - free -  (1.0M)
        534528  33554432     2  freebsd-swap  (16G)
      34088960  49795072     3  freebsd-zfs  (24G)
      83884032      2008        - free -  (1.0M)

    =>       40  268435376  nda1  GPT  (128G)
             40   33554432     1  freebsd-swap  (16G)
       33554472  234880944     2  freebsd-zfs  (112G)

    $ mount | egrep efi
    /dev/gpt/efiboot0 on /boot/efi (msdosfs, local)
    $
    ```

I've copied `/boot/loader.efi` to both `/boot/efi/efi/freebsd/loader.efi` and
`/boot/efi/efi/boot/bootaa64.efi`. The `efibootmgr -v` command reports that the
`.../freebsd/loader.efi` file is the one in use. Unfortunately, this didn't fix the problem.

----------------------------------------

My second machine is an amd64 VM with a UFS root filesystem:

    ```
    $ gpart show
    =>      40  33554352  da0  GPT  (16G)
            40      1024    1  freebsd-boot  (512K)
          1064   2096128    2  freebsd-ufs  (1.0G)
       2097192   8388608    3  freebsd-swap  (4.0G)
      10485800  12582912    4  freebsd-ufs  (6.0G)
      23068712   2097152    5  freebsd-ufs  (1.0G)
      25165864   8388528    6  freebsd-ufs  (4.0G)

    $
    ```

I found a [post on the FreeBSD
forums](https://forums.freebsd.org/threads/update-of-the-bootcodes-for-a-gpt-scheme-x64-architecture.80163/)
that suggested using gpart as follows:

    `gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0`

Again, since this is a virtual machine, and honestly not a hard one to rebuild, I took a
snapshot, fired off the gpart command, and again found the "Loader needs to be updated"
error message.

----------------------------------------

I understand that there are lots of different situations here. I'm willing to fork my
question into two questions to keep things easy to follow.


**Q:** _What's the root cause here?_ It seems like I'm not addressing the root cause.


-- 
Chris

      __o          "All I was trying to do was get home from work."
    _`\<,_           -Rosa Parks
___(*)/_(*)____.___o____..___..o...________ooO..._____________________
Christopher Sean Hilton                    [chris/at/vindaloo/dot/com]