jid's not refreshing after jail shutdown
jamie at FreeBSD.org
Mon Jun 14 22:34:36 UTC 2010
On 06/14/10 07:36, Jacob Whatley wrote:
> On 8.0 Release, our system is setup so that we specify the jid when a jail
> is built, which we make numerical (ie, 1001, 1002, etc..). This works great
> for consistency and for setup scripts. However, we are running into a
> problem that after shutting down a jail (or group of jails) using 'jail -r
> <jid>', when we attempt to start the jail(s) anew, we get the error:
> jail: jail<jid indicated> already exists
> Running jls shows no active jail for that jid. Is there something that we
> can do to flush whatever buffer is holding the old jid data, so that we may
> restart a dead jail with the same jid? Incidentally, this happens more often
> than not, but occasionally and after a few minutes we can run 'jail -c
> .....' and it will not bomb.
After you remove a jail, it still exists in a hidden state until nothing
in the kernel refers to anymore. There one big thing that can hold on to
a jail for a few minutes are it's been removed: TCP timers. Once the
last tcp connection times out, the jail is let go and you can re-use its ID.
You can see these half-dead jails with the "-d" flag to jls(8).
Unfortunately, you can't shortcut that timeout, or change an existing
There is one thing you can do, that may fit your needs. With the "-d"
flag to jail(8), you can make changes to such a dying jail, including
setting the "persist" parameter which will bring it back to life, or
running a command which will make it alive until the command completes
(as with a normal newly created jail). Even though the jail appears to
not exist, it actually does and so you'll need to use the "-m" flag to
modify an existing jail. Of course it may have gone away, so you're best
off with "-cm". You also have to be aware that any other parameters
you've set before may be still in that state (if the jail hasn't gone
away and you're bringing it back to life) or may not (if it went away
and you're creating a new one).
More information about the freebsd-jail