misc/165886: Using jail name in rctl(8) doesn't work - jail id works

Thomas Steen Rasmussen thomas at gibfest.dk
Fri Mar 9 18:30:12 UTC 2012


>Number:         165886
>Category:       misc
>Synopsis:       Using jail name in rctl(8) doesn't work - jail id works
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 09 18:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Steen Rasmussen
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
>Environment:
FreeBSD osd-asrock 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu Mar  8 13:24:23 UTC 2012     root at osd-asrock:/usr/obj/usr/src/sys/RCTL  amd64

>Description:
Using jail name in rctl(8) doesn't work - jail id works. Observe:

[root at osd-asrock ~]# jls
   JID  IP Address      Hostname                      Path
     1  10.20.13.1      memtest1                      /usr/jails/memtest1
     2  10.20.13.2      disktest1                     /usr/jails/disktest1
[root at osd-asrock ~]# rctl -hu jail:memtest1
cputime=0
datasize=0
stacksize=0
coredumpsize=0
memoryuse=0
memorylocked=0
maxproc=0
openfiles=0
vmemoryuse=0
pseudoterminals=0
swapuse=0
nthr=0
msgqqueued=0
msgqsize=0
nmsgq=0
nsem=0
nsemop=0
nshm=0
shmsize=0
wallclock=0
[root at osd-asrock ~]# rctl -hu jail:1
cputime=3
datasize=6788k
stacksize=0
coredumpsize=0
memoryuse=8292k
memorylocked=0
maxproc=4
openfiles=0
vmemoryuse=71M
pseudoterminals=0
swapuse=0
nthr=4
msgqqueued=0
msgqsize=0
nmsgq=0
nsem=0
nsemop=0
nshm=0
shmsize=0
wallclock=1348

The problem also happens when setting the limits - if I set the limit using the jail name, the actions are not applied.

>How-To-Repeat:
Try using jail name in a rctl command, like this one from the rctl(8)  manpage:

           rctl -hu jail:www

     Display resource usage information for jail named "www".

Observe that all zeroes are returned instead of the expected values.
>Fix:
>From the source I am guessing the function resolve_ids() should have contained code to resolve the jail name to the jail id - but it doesn't. Adding code to resolve the jail name to id using jail_getid() in the same way jexec(8) didn't help. 

In fact, testing revealed that jexec(8) is also unable to resolve the jail name:

# jls
   JID  IP Address      Hostname                      Path
     1  10.20.13.1      memtest1                      /usr/jails/memtest1
     2  10.20.13.2      disktest1                     /usr/jails/disktest1
# jexec memtest1 sh
jexec: jail "memtest1" not found
#

So I guess this is the basic problem.

These jails are installed with ezjail, if that matters.
Further info and testing available on request :)

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list