Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2018 11:34:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 233637] bectl jail doesn't honour {jailID | jailName}
Message-ID:  <bug-233637-227-sc3mNzMixl@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-233637-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-233637-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233637

--- Comment #2 from Rob <rob.fx907@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 environm=
ent
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 j=
ail
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 o=
ne
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:=20=20=20=20=20=20
jail {-b | -U} [{-o key=3Dvalue | -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, whi=
ch
doesn't exist. IF it did though, ${RELEASE} is the utility that gets execut=
ed
for the jail command.

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-233637-227-sc3mNzMixl>