<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    well, afaict from your description the information "A needs B" is
    totally implicit, there is no place where this info is available, so
    no way to pass that info to systemd.<br>
    <br>
    That means that the only way to fix that without explicitely telling
    someone about the dependency is to allow dbus to start units while
    its shutdown is pending<br>
    <br>
    this seems to be explicitely forbidden, so my guess is that there
    are very good reasons for that and there is little chances that
    there is a workaround...<br>
    <br>
    so, i'm not an expert, but I would be very suprised if there was a
    way to do that... an explicit "allow startup during termination"
    flag in the auto-activation .service file could be a way around but
    I don't think such file exists...<br>
    <br>
    <br>
    sorry<br>
    <br>
    <div class="moz-cite-prefix">On 08/01/2018 16:07, Michal Koutný
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:3cdad331-eebd-4242-690d-2e7ff62bec69@suse.com">
      <pre wrap="">Hello,
I'd like to ask your opinion on the following situation.

B.service exposes its API through D-Bus. A.service uses this API and
thus it has a dependency on B.service. This is implicit though -- and
we're happy we can rely on D-Bus activation and needn't to list all
dependencies explicitly.

As it comes, A.service needs B.service for proper termination. During
the shutdown transaction there is unspecified ordering of the two (since
the dependency is implicit only) and B.service is stopped before A.service.

A.service would attempt to D-Bus-activate B.service but that is rejected
because dbus-daemon will eventually stop too. Note this doesn't mean
dbus-daemon is already handling SIGTERM, it's because a dbus-daemon stop
job is pending [1]. A.service may thus cannot terminate properly.

I know this could be circumvented by explicitly specifying
After=b.service for the A.service but denies the elegance of the lazy
(implicit) activation.

Are there any better ways how to deal with this?

Thanks,
Michal Koutný

P.S. FTR, in my case A.service=libvirtd.service and
B.service=systemd-machined.service.

[1] <a class="moz-txt-link-freetext" href="https://github.com/systemd/systemd/blob/master/src/core/dbus.c#L169">https://github.com/systemd/systemd/blob/master/src/core/dbus.c#L169</a>

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
systemd-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <div>
        <link href="https://fonts.googleapis.com/css?family=Raleway"
          rel="stylesheet" type="text/css">
        <font face="Raleway, regular">
          <table style="padding:20px;margin-bottom:-10px" border="0">
            <tbody>
              <tr>
                <td style="font-size:13px; color:#ff8054; text-align:
                  center; padding-right:30px"> <a
                    href="http://www.smile.eu/"> <img
                      style="max-width:100%; height:auto"
src="http://ftp.smile.fr/client/Communication/signature/img/Logo-new.png"
                      alt="SMILE"> </a><br>
                  <br>
                  <p style="line-heigth:8px">20 rue des Jardins<br>
                    92600 Asnières-sur-Seine</p>
                </td>
                <td style="border-left: 1px solid #3b7ffe;
                  padding-left:20px; font-size:13px; color:#ff8054;">
                  <div style="color:#ff8054; font-size:14px;"> <b>Jérémy
                      ROSEN</b> </div>
                  <div style="color:#3b7ffe; font-size:13px;">
                    Architecte technique<br>
                    Responsable de l'expertise Smile-ECS </div>
                  <br>
                  <div style="color:#3b7ffe; font-size:13px;"> <span
                      style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/mail.png"
                        alt="email" width="12" height="10"> <a
                        href="mailto:jeremy.rosen@smile.fr"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">jeremy.rosen@smile.fr</a>
                    </span> <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/phone.png"
                        alt="phone" width="10" height="10"></span>
                    +33141402967 <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/web.png"
                        alt="url" width="12" height="12">
                      <a href="http://www.smile.eu"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">http://www.smile.eu</a> </span>
                  </div>
                  <br>
                  <div> <span><a style="margin-right:5px"
                        href="https://twitter.com/GroupeSmile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-twitter.png"
                          alt="Twitter" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.facebook.com/smileopensource"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-facebook.png"
                          alt="Facebook" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.linkedin.com/company/smile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-linkedin.png"
                          alt="LinkedIn" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://github.com/Smile-SA"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-github.png"
                          alt="Github" style="max-width:100%;
                          height:auto"></a></span> </div>
                </td>
              </tr>
            </tbody>
          </table>
          <br>
          <div> <a
href="http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature"><img
src="http://signature.smile.eu/assets/img/bandeau_mail_smile2017.gif.gif"
                alt="Découvrez l’univers Smile, rendez-vous sur
                smile.eu" border="0"></a></div>
          <br>
          <div style="color:#a3acb5; font-size:10px;"> <img
              src="http://ftp.smile.fr/client/Communication/signature/img/eco.png"
              alt="eco" width="13" height="11"> Pour la planète,
            n'imprimez ce mail que si c'est nécessaire </div>
        </font>
      </div>
    </div>
  </body>
</html>