14.0 with zfs mirror on root - can't uefi boot from second disk

From: bram <bram_at_diomedia.be>
Date: Mon, 17 Jun 2024 14:10:36 UTC
Hi all,

I couldn't find much information on this in Google,
I'm hoping someone can shed some light on this and recommend me on what 
to do next.

I noticed on a FreeBSD server with 14.0 (I can't boot with just the 
second drive connected (no option in the bios)
As far as I can tell this relates to this, 
https://reviews.freebsd.org/D42150
Additionally the installer creates gpt/gptboot0 + efiboot0 for the first 
drive and gpt/gptboot1 + efiboot1 for the second drive.
It was able to fix this with:
newfs_msdos /dev/nda1p1 # format efi partition on second drive
mount_msdosfs /dev/nda1p1 /mnt # mount efi of second drive
cp -r /boot/efi/* /mnt/efi # copy files from first to second drive
efibootmgr -c -L FreeBSD-Disk1 -l /boot/efi/efi/boot/bootx64.efi # give 
a name that shows up in the bios
efibootmgr -B -b 0001 # remove uefi os
gpart modify -l efiboot0 -i1 /dev/nda0 # without this the system goes 
into single user mode because it searches for efiboot0, not efiboot1
Swap drive cables and reboot
efibootmgr -c -L FreeBSD-Disk2 -l /boot/efi/efi/boot/bootx64.efi
efibootmgr -B -b 0001 # remove another uefi os from the list

I can both from both drives with the other one disconnected from the 
computer.

Replacing a drive required
gpart backup nda0 | gpart restore -F /dev/nda1 # copy partition table
gpart modify -l efiboot0 -i1 /dev/nda1
newfs_msdos /dev/nda1p1
mount_msdosfs /dev/nda1p1 /mnt
cp -r /boot/efi/* /mnt/efi
zpool replace nda1p4 nda1p4

On a second server my efibootmgr naming was gone after swapping 
drives/cables.

In fstab there is this line:
/dev/gpt/efiboot0               /boot/efi       msdosfs rw              
2       2
causing the system to go into single user mode when booting from the 
secondary drive after the efi files were copied, the system would boot 
just fine without this line what is the reason to keep this mounted by 
default ?

I tried a fresh install with FreeBSD 14.1 and here I have the same 
issue, the system is able to boot from the first drive but can't boot 
with the first drive removed.

thx in advance
Bram