Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 2009 00:54:32 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        Ed Schouten <ed@80386.nl>
Cc:        FreeBSD Arch <arch@freebsd.org>
Subject:   Re: Setting the jail identifier from /etc/rc.conf
Message-ID:  <86ljj4s6hj.fsf@ds4.des.no>
In-Reply-To: <20091021222054.GJ1293@hoeg.nl> (Ed Schouten's message of "Thu, 22 Oct 2009 00:20:54 %2B0200")
References:  <20091021222054.GJ1293@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Ed Schouten <ed@80386.nl> writes:
> I haven't played with Jails for a long time, but I wanted to figure out
> how hard it is to make init spawn getties for certain jails. It
> shouldn't be too hard (jexec foo /usr/libexec/getty), but I can't seem
> to find a way to set the jid to a certain value from within rc.conf.

The jid is a number assigned by the kernel which increases monotonically
for every jail created.  If you stop and restart a jail, it will get a
new jid.  If you're thinking of the jail name as specified in rc.conf,
that's internal to the rc script - it is not passed to the kernel.  The
kernel's idea of the jail name defaults to the string representation of
the jid (i.e. a jail with jid 4 is named "4" unless otherwise specified
on the command line).  There is no rc.conf variable for it, but you can
add "-n foo" to jail_foo_flags.

(it seems /etc/rc.d/jail hasn't quite caught up with the new jail(8)
command line syntax)

Currently, your best bet is probably to read the jid from
/var/run/jail_${foo}.id, which is created by the rc script when it
starts the jail.

> It also seems jids cannot contain dots, which means I cannot set the jid
> equal to the hostname of the jail.

The jail name can not contain dots because jails can nest, and dots are
used to separate components in the fully qualified name of a jail.  If
you start a jail named "foo", and within "foo" start a jail named "bar",
then the fully qualified name of the inner jail is "foo.bar".

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86ljj4s6hj.fsf>