[systemd-devel] Allow stop jobs to be killed during shutdown

Lennart Poettering lennart at poettering.net
Mon Jan 27 06:48:50 PST 2014


On Sun, 26.01.14 12:09, Andrey Borzenkov (arvidjaar at gmail.com) wrote:

> > > Any advices on how to do that?
> > > I have both the issue (reproducible on each shutdown) and will to debug.
> > 
> > Well, enable the debug shell, and then from there try to figure out why
> > things are stuck. i.e. whether it is systemd --user that really never
> > exits. Or whether it actually exits but PID 1 doesn't notice it. And
> > then if you figured out which of the two cases, you'd have to figure out
> > why that is...
> > 
> I finally managed to reproduce it with user instance running with debug
> level (before *any* attempt to add debugging, strace, whatever resulted
> in problem disappearing).
> 
> It seems that /bin/kill -RTMIN+24 is being killed itself. I wonder - is
> it possible that it is the same SIGTERM that is used by PID 1 to stop
> user at 0service?

Ah, bummer! Yikes!

Thanks for tracking this done, this really sounds like you nailed the
problem. Now, how to fix it?

Hmm, so, I would claim this is a shortcoming of
KillMode=control-group, which is the default for everything. There has
been an item on the TODO list to maybe introduce a KillMode=mixed
setting, which would send SIGTERM only to the main process, and the
SIGKILL later on to all processes. I am pretty sure that this would
solve the issue at hand quite nicely here, because the systemd user
instance would get a nice chance to clean up its own act, before the
systemd system instance would make tabula rasa...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list