I'm on 14.4-RELEASE. I run a few GUI applications as an unprivileged (non-root) account in vnet jails, starting the GUI application with
Things mostly work as I expect, but I have found that when the application exits, none of the jail's
Today I had the idea to try
Is this expected to be a reliable way to get the cleanups to happen? Specifically, my understanding is that a non-persistent jail gets destroyed when its last process terminates (at least that's what I think
(For completeness: the GUI applications I run don't appear ever to start any child processes that would have any reason to outlive their ancestor. So the lifetime of the top-most process in the jail delimits the lifetime of all processes inside the jail environment.)
command = "/path/to/program"; (vs., say, ssh'ing into a jail whose exec.start is /bin/sh /etc/rc).Things mostly work as I expect, but I have found that when the application exits, none of the jail's
exec.poststop commands nor the implicit cleanups for the mount or mount.devfs parameters will execute. It's a bit of a pain to do all the cleanups by hand, so I'd like that to be automatic.Today I had the idea to try
exec.poststart = "jail -r ${name}"; It seems to do just what I want, but I wonder if I'm doing something unsound here.Is this expected to be a reliable way to get the cleanups to happen? Specifically, my understanding is that a non-persistent jail gets destroyed when its last process terminates (at least that's what I think
jail(8) says for persist). Does the exec.poststart command count as one of the jail's processes? Or is there some chance of a race condition where the system destroys the jail before the exec.poststart command runs?(For completeness: the GUI applications I run don't appear ever to start any child processes that would have any reason to outlive their ancestor. So the lifetime of the top-most process in the jail delimits the lifetime of all processes inside the jail environment.)