How to terminate a lot of jails correctly

Alfred Bartsch bartsch at
Wed Sep 22 11:20:03 UTC 2010

S.N.Grigoriev wrote:
> 20.09.10, 13:37, "Erik Stian Tefre" <erik at>:
>>> I use a server (FreeBSD 8.1R amd64) with two dozens of jails configured.
>>  > I've found out that only a few of them are terminated normally (via
>>  > /etc/rc.shutdown) during the system shutdown. FreeBSD reports that
>>  > 20sec interval has elapsed and simply kills all the jails that are not yet
>>  > terminated. I would like to know in what way can I fix it using the system
>>  > tools only (not ezjail, Qjail etc).
>>  Increasing rcshutdown_timeout in /etc/rc.conf may help. The default
>>  value is set to 30 seconds in /etc/defaults/rc.conf.
> Erik,
> thank you for your tip. The only drawback of that approche  is absence of
> ability to calculate a timeout. Try and error only.
to avoid such trial and error, we always set 'rcshutdown_timeout=""'
in /etc/rc.conf on all our servers.

"man init" reads:
When shutting down the machine, init will try to run the
/etc/rc.shutdown script. This script can be used to cleanly terminate
specific programs such as  innd (the InterNetNews server). If this
script does not terminate within 120 seconds, init will terminate it.
The timeout can be configured via the sysctl(8) variable

So disabling the variable 'rcshutdown_timeout' should expand the timeout
of every single rc-script to a total of 2 minutes for all rc-scripts. If
this is not sufficient, try increasing "kern.init_shutdown_timeout".
Alfred Bartsch

More information about the freebsd-stable mailing list