Bug 245167

Summary: sysutils/ezjail does not properly shutdown jails
Product: Ports & Packages Reporter: ml
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Only Me CC: erdgeist, lwhsu
Priority: --- Flags: bugzilla: maintainer-feedback? (erdgeist)
Version: Latest   
Hardware: Any   
OS: Any   

Description ml 2020-03-29 15:21:22 UTC
Issuing "ezjail stop {jailname}" does NOT run shutdown script inside the jail; instead it seems it just kills the jailed processes badly.
This can be a problem in several situations.

I was recently bitten by this, but see it was discussed several times earlier. E.g.:

The problem can be solved by changing jail_{jailname}_exec_stop in ${PREFIX}/etc/ezjail/{jailname}. This has to be done for every single jail.
Somewhere it is suggested this can be done globally, by putting ezjail_exec_stop="/bin/sh /etc/rc.shutdown"
in ${PREFIX}/etc/ezjail.conf, but this did not work for me.

I understand there is no global consensus on whether rc.shutdown should be called at jail stop; also I thinks FreeBSD base system's jail command defaults to NOT running it.
However, ezjail(7) says:
             The command to run inside the jail when stopping it. Defaults to
             the empty string, which means "/bin/sh /etc/rc.shutdown".

So either the default is really changed or the manual page should be corrected.