jail already exists

Jamie Gritton jamie at FreeBSD.org
Wed May 22 21:58:20 UTC 2013


On 05/22/13 15:38, Tomasz Jaroszyk wrote:
> I use 9.1-PRERELEASE and have problem with jails.
> Sometimes one of them after shutdown do not want start again.
>
> szafir% sudo jail -rc reverse
> jail: "reverse" not found
> jail: reverse: jail 320 already exists
> szafir% pgrep -j 320
> szafir%
>
> I guess some file was not removed after shutdown but manual of jail(8) did
> say nothing about that.
>
> I have been changing jid when that happened but this is annoying.
> Any better solution?

If I had to guess at your jail.conf, I'd say that "reverse" has a
hard-coded jid of 320. Of course it'd be better if I didn't have to
guess :-).

It looks like the jail "reverse" doesn't currently exist, hence the "not
found" message. But *some* jail with a jid of 320 does exist. There's a
good chance that the 320 that does exist is the same jail as the
"reverse" that doesn't exist. That's because when removing, a dying jail
is usually disregarded. When adding a jail, a dying jail of the same
name can be disregarded, but not one with the same jid.

So if my guess is correct, the solution is jail(8)'s "-d" flag, or the
"allow.dying" jail parameter. An jail with active TCP connections will
generally sit around a while in the dying state, which can cause
problems with the "jail -rc" restart - but only if you try to force it
to a particular jid.

- Jamie


More information about the freebsd-jail mailing list