Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jun 2010 16:32:16 -0600
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        Jacob Whatley <jwhatley@rhyton.com>
Cc:        freebsd-jail@FreeBSD.org
Subject:   Re: jid's not refreshing after jail shutdown
Message-ID:  <4C16ADF0.7010800@FreeBSD.org>
In-Reply-To: <009001cb0bc6$a2641810$e72c4830$@com>
References:  <009001cb0bc6$a2641810$e72c4830$@com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
jail's jid.

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).

- Jamie



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C16ADF0.7010800>