[Bug 233637] bectl jail doesn't honour {jailID | jailName}

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Dec 19 11:35:01 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233637

--- Comment #2 from Rob <rob.fx907 at gmail.com> ---

(In reply to Dave Cottlehuber from comment #0)

I made a revision for the patch: https://reviews.freebsd.org/D18607

# bectl jail ${RELEASE}
unable to create jail.  error: 2

By default, bectl is setting the jail 'name' parameter to the boot environment
name, which causes the above error. 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.

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

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

Should now be possible to:

# echo $RELEASE
12.0-RC2-update
# bectl jail ${RELEASE}
...
# bectl unjail ${RELEASE}

The other examples:


I looked into the command line parsing a bit, it doesn't handle the format
<jailID | jailName> <bootenv> <utility [...]>.

The documentation should be:      
jail {-b | -U} [{-o key=value | -u key}]... <bootenv> [utility [argument ...]]

Looking at this example:

# bectl create next

/* bectl is looking for the prison boot environment */
/* next is the utility that will be executed for the jail */
# bectl jail prison next
specified boot environment does not exist
could not mount bootenv

from your example:
# bectl jail next ${RELEASE}
specified boot environment does not exist
could not mount bootenv

In the above command, bectl is looking for the 'next' boot environment, which
doesn't exist. IF it did though, ${RELEASE} is the utility that gets executed
for the jail command.

I can help with manpage additions or tests if it looks like this patch is in
the right direction.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list