[systemd-devel] Dependencies on DBus activated services during shutdown

Jérémy Rosen jeremy.rosen at smile.fr
Mon Jan 8 15:53:04 UTC 2018


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.

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

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...

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...


sorry

On 08/01/2018 16:07, Michal Koutný wrote:
> 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] https://github.com/systemd/systemd/blob/master/src/core/dbus.c#L169
>
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- 
SMILE <http://www.smile.eu/>

20 rue des Jardins
92600 Asnières-sur-Seine

	
*Jérémy ROSEN*
Architecte technique
Responsable de l'expertise Smile-ECS

email jeremy.rosen at smile.fr <mailto:jeremy.rosen at smile.fr>
phone +33141402967
url http://www.smile.eu

Twitter <https://twitter.com/GroupeSmile> Facebook 
<https://www.facebook.com/smileopensource> LinkedIn 
<https://www.linkedin.com/company/smile> Github 
<https://github.com/Smile-SA>


Découvrez l’univers Smile, rendez-vous sur smile.eu 
<http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature>

eco Pour la planète, n'imprimez ce mail que si c'est nécessaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180108/23ec6062/attachment.html>


More information about the systemd-devel mailing list