<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 15.01.2018 um 20:07 schrieb Kai Uwe
      Broulik:<br>
    </div>
    <blockquote type="cite"
      cite="mid:10993570.0XT2v1e5zC@kaiuwe-desktop">
      <pre wrap="">Hi,
</pre>
    </blockquote>
    Thanks for your replay<br>
    <blockquote type="cite"
      cite="mid:10993570.0XT2v1e5zC@kaiuwe-desktop">
      <blockquote type="cite">
        <pre wrap="">We found out, that running a process with a systemd inhibitor as root e.g

</pre>
        <blockquote type="cite">
          <pre wrap=""># systemd-inhibit --what=shutdown --mode=block sleep 365d
</pre>
        </blockquote>
      </blockquote>
      <pre wrap="">Try mode "delay", this will temporarily delay the action until you release 
your inhibition. Typically used for certain cleanup tasks, like disconnecting 
the network, before sending the computer to sleep but according to 
documentation this works also for "shutdown" command. Check out the Logind 
inhibition documentation [1].
</pre>
    </blockquote>
    Sadly the mode "delay" is no option: since there is a globally set
    timeout for any delay, which is per default set to 5 sec and can be
    changed in /etc/systemd/logind.conf by setting InhibitDelayMaxSec.
    Setting this to a very high value would probably mean a high risk of
    breaking other uses cases (set to sleep?).<br>
    <br>
    Another Problem is, that in order to prevent the system from being
    shutdown the inhibitor has to be set by root (or at least by a
    different user than the dbus command is sent). In my opinion this is
    a implementation flaw in systemd and contradicts some uses cases
    listed at the beginning of <a class="moz-txt-link-freetext"
      href="https://www.freedesktop.org/wiki/Software/systemd/inhibit/">https://www.freedesktop.org/wiki/Software/systemd/inhibit</a><br>
    <br>
    At this point it would be extremely complicated to use inhibitors to
    achieve our goal. The only way would be a system daemon which sets a
    block inhibitor for shutdown and watches all user sessions and
    releases the inhibitor only if there is no user session running.
    This would however render the shutdown button in plasma useless.<br>
    <br>
    <blockquote type="cite"
      cite="mid:10993570.0XT2v1e5zC@kaiuwe-desktop">
      <pre wrap="">As for the warning when shutting down with multiple users, I  that might be an 
SDDM limitation/bug/missing feature.</pre>
    </blockquote>
    Probably this is how KDM worked with utmp or ConsoleKit before.
    Correct me if I am wrong, but in the old days the user session would
    always reuse the x-server from the display manager. So naturally
    when the user session ends the display manager would naturally
    regain control. <br>
    <br>
    But now the kdisplaymanager code send messages to logind via dbus,
    which then just killes the session. Any code after the comment in
    "startkde":<br>
    <span class="pl-c"><span class="pl-c">> #</span>Anything after
      here is logout/shutdown<br>
      is definitely </span><span class="pl-c">not executed on shutdown.<br>
      <br>
    </span>
    <blockquote type="cite"
      cite="mid:10993570.0XT2v1e5zC@kaiuwe-desktop">
      <pre wrap="">
Cheers,
Kai Uwe

[1] <a class="moz-txt-link-freetext" href="https://www.freedesktop.org/wiki/Software/systemd/inhibit/">https://www.freedesktop.org/wiki/Software/systemd/inhibit/</a>

</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>