Solved Need help recovering unbootable zfs system

After a power failure, my system booted with the following message:

IMG_2491.jpeg
\

Some googling on the unsupported feature: com.delphix:head_errlog message led me to this helpful post: https://unixdigest.com/tutorials/upgrading-to-freebsd-14-how-to-fix-a-broken-bios-bootcode.html

I followed the instructions and executed the gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 {mydrive} for my system, but I accidentally chose -i 1 which is my efi partition instead of my freebsd-boot partition. Now when I boot I don't get the above message but instead the machine boots straight to the BIOS, which doesn't list any drives to boot from.

How can I recover to a bootable system?

More details: here is some of the output from gpart show. nda0 and nda1 are my OS disks, configured in a ZFS mirror.

IMG_2493.jpeg
 
At first, you probably upgraded your zpool without updated your efi loader.
Now, you destroyed the efi partition.
You have to: reformat it, create some directories in it and copy the right loader.
Code:
newfs_msdos /dev/nda0p1
mount -t msdosfs /dev/nda0p1 /mnt
mkdir -p /mnt/efi/boot
cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
umount /mnt
It's not clear if you destroyed the partitions on both disks or on only one. You may have to repeat this steps on nda1p1. It's not clear either on which disk the efi firmware is booting.
 
At first, you probably upgraded your zpool without updated your efi loader.
Now, you destroyed the efi partition.
You have to: reformat it, create some directories in it and copy the right loader.
Code:
newfs_msdos /dev/nda0p1
mount -t msdosfs /dev/nda0p1 /mnt
mkdir -p /mnt/efi/boot
cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
umount /mnt
It's not clear if you destroyed the partitions on both disks or on only one. You may have to repeat this steps on nda1p1. It's not clear either on which disk the efi firmware is booting.
Thanks for the quick response! I tried this but I’m still stuck booting into the bios. Previously the bios had an option to choose to boot with efi, but that option is still missing after my initial incorrect command.
 
I guess both zfs' patitions are in a mirror pool which contain your system /, the swaps doesn't matter at the moment, but both EFI and boot are neither mirrored. (The installer sets up a mirror looking like partition table on both disks, but unless you do a hardware raid, but a ZFS mirror raid only, which I presume you do, only the zfs partitions are mirrored by zfs (and maybe the swaps if you said so in installer), but not EFI and boot.)
So you may be capable to boot from at least one of your disks, if you install the correct bootcode into the not yet messed up disk.
Perhaps you may check and change your BIOS settings if it's capable to boot from the other disk.
Otherwise you may need to switch the disks on their ports (you're using labels for the pool?), or remove the one you messed up.
After your system is back up and running, don't forget to clean up, get correct EFI and boot partitions with updated bootcode on both disks.
 
Wait, Emrion ’s answer was exactly the right thing to do. I was viewing on mobile and didn’t see that the cp command changed the name of loader.efi, so it didn’t see anything.

Changing the name in the boot partition worked, and now the system is back up.

Thank you so much Emrion!
 
Back
Top