Installing/removing packages in a boot environment, Can't find /boot/zfsloader

I am experimenting with boot environments and observing some very weird behavior related to installing/removing packages via pkg -c /tmp/path/to/be <command>. Any time I attempt to install/remove packages in a non-current boot environment using this incantation and then immediately bectl activate alt && reboot, the system fails to boot into the alternate boot environment, failing at unable to locate /boot/zfsloader. Strange. However, if I first just reboot (back into the current / default BE), and then activate the alternate BE, and reboot again, everything works just fine...it seems the only case that is failing is immediately activating and rebooting into the alternate BE.

Case 1: Fails before Loader, unable to locate /boot/zfsloader
Bash:
bectl create alt
bectl mount alt /tmp/alt
mount -t devfs devfs /tmp/alt/dev
pkg -c /tmp/alt install git nano sudo
bectl activate alt
reboot

Case 2: Works
Bash:
bectl create alt
bectl mount alt /tmp/alt
mount -t devfs devfs /tmp/alt/dev
pkg -c /tmp/alt install git nano sudo
reboot
...
bectl activate alt
reboot

Case 3: Works
Bash:
bectl create alt
bectl mount alt /tmp/alt
mount -t devfs devfs /tmp/alt/dev
pkg -c /tmp/alt install git nano sudo
reboot
... <select alt BE from loader>

I am testing this on a popular firewall/routing appliance distribution based on FreeBSD12.3-STABLE, so there are a lot of variables to consider. However, I have no problems installing and removing packages this way on upstream FreeBSD12.3-STABLE. So, I'm merely asking for any direction you might be able to share.
 
Did you try whether it works if you umount the manual mounts before doing bectl activate?
Yes. No difference in behavior.

This process works well for me.

/boot should follow the current BE
Yes it should. In fact, if I browse the /tmp/alt/boot directory, everything is there. However, the loader doesn't see it.
 
Back
Top