This is about bug 233637 and the patch is based off r342069
By default, bectl is setting the jail 'name' parameter to the
boot environment name, which causes an error when the boot
environment name is not a valid jail name. With the attached fix,
when no name is supplied, the default jail name will be the
jail id - this is is the same behavior as the jail command.
During testing, when I started using the jail id as the default
name, the jail would execute with no errors. However, bectl
wasn't able to unjail a boot environment because it was
failing to match the boot environment path with an existing
jail path. The source of this problem was two bugs.
- in 'bectl_locate_jail', 'mountpoint' is used to resolve the boot environment path, but really 'mounted' should be used. 'mountpoint' is the path where the zfs dataset will be mounted. 'mounted' is the path where the boot environment is mounted.
- in 'bectl_search_jail_paths', 'jail_getv' would fail after the first call. Which is fine, if the boot environment you're unjailing is the next one up. According to 'man jail_getv', it's expecting name and value strings. 'jail_getv' is being passed an integer for the lastjid. The attached patch uses a string for the lastjid instead.
link to bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233637