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



## rcmcdonald (Mar 10, 2022)

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`

```
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

```
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

```
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.


----------



## skunk (Mar 10, 2022)

Did you try whether it works if you `umount` the manual mounts before doing `bectl activate`?


----------



## mer (Mar 10, 2022)

This process works well for me.








						Upgrade FreeBSD with ZFS Boot Environments
					

I am known as a strong ZFS Boot Environment supporter … and not without a reason. I have stated the reasons ‘why’ many times but most (or all) of them are condensed here – &…




					vermaden.wordpress.com
				




/boot should follow the current BE


----------



## rcmcdonald (Mar 11, 2022)

skunk said:


> Did you try whether it works if you `umount` the manual mounts before doing `bectl activate`?


Yes. No difference in behavior.



mer said:


> This process works well for me.
> 
> 
> 
> ...


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


----------



## grahamperrin@ (Mar 12, 2022)

Lateral thinking.



rcmcdonald said:


> the loader



Might there be an issue with the loader itself … more specifically, the appliance's loader's expectation of _the name of_ the file to load?

<https://www.google.com/search?q="unable+to+locate++/boot/zfsloader"&tbs=li:1#unfucked> _unique_.



rcmcdonald said:


> everything is there.



What things, exactly? ls please, thanks.


----------

