`service jail stop` exits without stopping all jails

Hi,

I am running ~20 jails on single host. I noticed service jail stop won't shut down all of them. It will stop a few of them, then silently exit, leaving other jails running. I need to repeat the command a few times in order to stop them all.

Anyone else noticed this? Is there anything I can configure to make service jail stop shutdown all the jails?

Thank you in advance.

My jail.conf is quite rudimentary:

Code:
path           = "/usr/jail/${host.hostname}";
exec.prestart  = "/sbin/mount_nullfs -o ro /usr/local/etc/letsencrypt \
                  /usr/jail/${host.hostname}/usr/local/etc/letsencrypt";
exec.start     = "/bin/sh /etc/rc";
exec.stop      = "/bin/sh /etc/rc.shutdown jail";
exec.poststop  = "/sbin/umount /usr/jail/${host.hostname}/usr/local/etc/letsencrypt/";
exec.clean;
mount.devfs;

jail1_example_org {
  host.hostname    = jail1.example.org;
  host.domainname  = example.org;
  ip4.addr         = 'lo2|127.0.2.1/32';
  ip4.addr        += 'lagg0|192.0.2.1/32';
}

jail2_example_org {
  host.hostname    = jail2.example.org;
  host.domainname  = example.org;
  ip4.addr         = 'lo2|127.0.2.2/32';
  ip4.addr        += 'lagg0|192.0.2.2/32';
}
...
 
I don't know how to interpret the code, but:

grep -A 53 jail_stop\(\) /etc/rc.d/jail

<https://cgit.freebsd.org/src/log/libexec/rc/rc.d/jail> most recently, add ability to set watchdog timeout for a shutdown

Can option -j help you?

Code:
% service jail

Usage:
service [-j <jail name or id>] -e
service [-j <jail name or id>] -R
service [-j <jail name or id>] [-v] -l | -r
service [-j <jail name or id>] [-v] <rc.d script> start|stop|etc.
service -h

-j      Perform actions within the named jail
-e      Show services that are enabled
-R      Stop and start enabled /usr/local/etc/rc.d services
-l      List all scripts in /etc/rc.d and /usr/local/etc/rc.d
-r      Show the results of boot time rcorder
-v      Verbose

%
 
Code:
exec.stop      = "/bin/sh /etc/rc.shutdown jail";
Mine is only
exec.stop = "/bin/sh /etc/rc.shutdown";
and does work.

There are two timeouts involved. One goes into /etc/sysctl.conf and reads
kern.init_shutdown_timeout=780 # seconds
and that seems to configure only once in the base system.
And the other goes into /etc/rc.conf and reads
rcshutdown_timeout="660" # Seconds to wait before terminating rc.shutdown
and this may be needed in every jail.

Then, You may want to have a look at /var/log/jail_*_console.log and see what was actually done/tried when stopping the jail.
 
Back
Top