manager: fix job mode when signalled to shutdown etc
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Mon, 31 Jul 2017 16:36:58 +0000 (17:36 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 31 Aug 2017 15:17:42 +0000 (16:17 +0100)
commitd60cb656fc63c24b430421764b7d0322857d34fd
treeb478c333c32584706e498bf5b319d902877a5bdc
parentc75fbadac6bbbf8aa2b7c87be09dbea1f7715188
manager: fix job mode when signalled to shutdown etc

The irreversible job mode is required to ensure that shutdown is not
interrupted by the activation of a unit with a conflict.

We already used the correct job mode for `ctrl-alt-del.target`.  But not
for `exit.target` (SIGINT of user manager).  The SIGRT shutdown signals
also needed fixing.

Also change SIGRTMIN+0 to isolate default.target, instead of starting
it.  The previous behaviour was documented.  However there was no reason
given for it, nor can we provide one.  The problem that isolate is too
aggressive anywhere outside of emergency.target (#2607) is orthogonal.
This feature is "accessible by different means and only really a safety
net"; it is confusing for it to differ from `systemctl default` without
explanation.

`AllowIsolate=yes` is retained on poweroff.target etc. for backwards
compatibility.

`sigpwr.target` is also an obvious candidate for linking to a shutdown
target.  Unforunately it is also a possible hook for implementing some
logic like system V init did, reading `/etc/powerstatus`.  If we switched
to starting `sigpwr.target` with REPLACE_IRREVERSIBLY, attempts to run
`systemctl shutdown` from it would fail, if they had not thought to set
`DefaultDependencies=no`.  We had provided no examples for `sigpwr`, and
the whole idea is cruft to keep legacy people happy.  For the moment, I
leave `sigpwr` alone, with no risk of disrupting anyone's
previously-working, half-working, or untested setup.

Fixes #6484.  See also #6471
man/systemctl.xml
man/systemd.xml
src/core/manager.c