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

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Nov 29 14:30:30 UTC 2018


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

            Bug ID: 233637
           Summary: bectl jail doesn't honour {jailID | jailName}
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: dch at freebsd.org

So great to have this in base now.

TLDR this looks like a manpage addition, and/or a command line parsing bug. I'm
happy to contribute text for the manpage changes, although it may need some
massaging for man format.

I want to create a named jail of an existing BE that has a name that is also an
invalid jail name.

According to my reading of bectl(8) this should work, passing in a name or jid
as the first parameter after:

# bectl create next
# bectl jail prison next
specified boot environment does not exist
could not mount bootenv

The outcome I wanted, to create a jail with a known name/tag works just fine if
I *don't* specify a parameter, however if you *need* to specify a parameter
because the BE name is not a valid jail name, then we have a problem:

for example: If the BE name is e.g. 12.0-RC2 then it's not possible to use
bectl at all:

# bectl list
BE              Active Mountpoint Space Created
default         NR     /          2.13G 2018-11-27 10:34
12.0-RC2-update -      -          636K  2018-11-29 13:59
# echo $RELEASE
12.0-RC2-update
# bectl jail ${RELEASE}
unable to create jail.  error: 2
# bectl jail next ${RELEASE}
specified boot environment does not exist
could not mount bootenv
# mount |grep be_; jls
zroot/ROOT/12.0-RC2-update on /tmp/be_mount.WVe0 (zfs, local, noatime,
nfsv4acls)
   JID  IP Address      Hostname                      Path

Finally, it is actually still possible via:

# bectl jail -o name=next ${RELEASE}

# man bectl 

     jail {-b | -U} [{-o key=value | -u key}]... {jailID | jailName} <bootenv>
               [utility [argument ...]]
               Creates a jail of the given boot environment.  Multiple -o and
               -u arguments may be specified.  -o will set a jail parameter,
               and -u will unset a jail parameter.

               By default, jails are created in interactive mode and /bin/sh
               is executed within the jail.  If utility is specified, it will
               be executed instead of /bin/sh.  The jail will be destroyed and
               the boot environment unmounted when the command finishes exe-
               cuting, unless the -U argument is specified.

               The -b argument enables batch mode, thereby disabling interac-
               tive mode.  The -U argument will be ignored in batch mode.

               The name, host.hostname, and path may not actually be unset.
               Attempts to unset any of these will revert them to the default
               values specified below, if they have been overwritten by -o.

               All key=value pairs are interpreted as jail parameters as
               described in jail(8).  The following default parameters are
               provided:

               allow.mount          true
               allow.mount.devfs    true
               enforce_statfs       1
               name                 bootenv
               host.hostname        bootenv
               path                 Set to a path in /tmp generated by
                                        libbe(3).

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


More information about the freebsd-bugs mailing list