Re: s6-supervise behaviour

From: Laurent Bercot <>
Date: Thu, 5 May 2016 20:00:07 +0200

On 05/05/2016 13:19, Eric Vidal wrote:
> So i have a questions about s6-supervise behaviour. Well, i have 2
> tty running, i logged on X from tty1. I kill the s6-supervise pid for
> tty2. Well, as expected, tty2 restarts. I do the same thing for tty1,
> obviously the X crash :), but tty1 never restarts. Can you explain
> the flow for s6-supervise when a crash occurs ?

  I have no idea why tty1 never restarts. It should. If it doesn't, then
either something is preventing the old process from properly dying, or
something is preventing the new process from starting. Check your logs
(the catch-all logger, if you set one up, or /dev/console, depending on
how you run s6-svscan).

  It all depends on how you start X, too. My wild guess is that when you
kill the supervised process under tty1, you kill your startx, and your
user session, but the X server remains and has tty1 allocated, so it
prevents your getty from grabbing tty1 again.

> I see in your example a option which confuse me : forbacktickx -ep

  -e is a compatibility option that is now the default, I should remove it
from the examples. It does nothing.

> One more, if i do not make a mistake when i call from a shell
> s6-svscanctl -6 /dir_supervised, supervision tree will be terminated
> and s6-svscan will execute into the /service/.s6-svscan/finish script
> with the reboot argument (easy to read on your page :)). So all is
> ok, the system reboot as expected. But i doesn't understand where i
> need to call rc.tini before PID 3. I see a calling in the file
> /.s6-svscan/SIGINT but i doesn't understand the flow. Can you explain
> me?

  You have two ways of doing stuff:

  - either you don't care in what order your supervised services are killed,
and you just want to dismantle the supervision tree. In that case, you can
reboot your system with s6-svscanctl -6 /run/service, your services will be
killed and stage 3 will be run directly. All is well.

  - or you need a "clean shutdown" procedure, and need to do a few things
before tearing down the supervision tree. For instance, if you're using
s6-rc, you'd want to bring down your services first and kill the supervision
tree later, because s6-rc invocations require the supervision tree to be
  In that case, you don't call s6-svscanctl -6 /run/service directly; instead,
you send a SIGINT to your s6-svscan process (which may, or may not, be
process 1). s6-svscan will then run the /run/service/.s6-svscan/SIGINT
script. That script will call /etc/rc.tini first, and *then* call
s6-svscanctl -6 /run/service. The point is that anything you need to do
*before* the supervision tree is dismantled, you write down in /etc/rc.tini.
(Typically, if you're using s6-rc, /etc/rc.tini can simply perform
"s6-rc -da change", which brings down all the services.)

  In all cases, /run/service/.s6-svscan/finish is the *last* script that will
be executed, *after* the supervision tree is down.

Received on Thu May 05 2016 - 18:00:07 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC