[systemd-devel] Issue on Ordering of systemd services during boot

Jérémy ROSEN jeremy.rosen at smile.fr
Wed Dec 11 07:41:28 UTC 2019


You probably have another problem lurking behind...

A.service is of Type=Simple. That means that systemd doesn't know when
A.service is ready and will lauch B.socket as soon as A has been launched.
B being a socket, it has no delay so will be ready instantly.

You probably want to change Type to something more suiting to your
use-case...


Le mar. 10 déc. 2019 à 09:21, Colin Guthrie <gmane at colin.guthr.ie> a écrit :

> I presume B.socket is some kind of network socket rather than filesystem
> path? Either that or A.service provides the filesystem for the socket path?
>
> That being the case, you've got an ordering cycle here as B.socket has
> WantedBy=sockets.target which is order before multi-user.target which is
> needed by A.service.
>
> Take the WantedBy out of the B.socket (and ensure you remove any
> symlinks that were created when it was installed/enabled - better to do
> "systemctl disable B.socket" before editing the unit!) and replace it
> with multi-user.target too (like A.service) and this should remove the
> ordering cycle and give more deterministic behaviour.
>
> HTHs
>
> Col
>
>
> TARANA, YASHASHVI wrote on 10/12/2019 07:07:
> > Hi,
> >
> >
> >
> > I have a systemd service /A.service/ and socket /B.socket /and its
> > corresponding service /B./service with the following content:
> >
> >
> >
> >                /A.service/
> >
> >                               [Unit]
> >
> >                               Description=A.service
> >
> >
> >
> >                               [Service]
> >
> >                               ExecStart=/root/test start
> >
> >                               RemainAfterExit=true
> >
> >                               ExecStop=/root/test stop
> >
> >                               Type=simple
> >
> >
> >
> >                               [Install]
> >
> >                               WantedBy=multi-user.target
> >
> >
> >
> >                /B.socket/
> >
> >                               [Unit]
> >
> >                               Description=B.socket
> >
> >                               *After=A.service*
> >
> > *BindsTo=A.service*
> >
> >
> >
> >                               [Socket]
> >
> >                               ListenDatagram=XXXX
> >
> >                               Accept=No
> >
> >
> >
> >                               [Install]
> >
> >                               WantedBy=sockets.target
> >
> >
> >
> >
> >
> >                /B.service/
> >
> >                               [Unit]
> >
> >                               Description=B.service
> >
> >                               Requires=B.socket
> >
> >
> >
> >                               [Service]
> >
> >                               Type=simple
> >
> >                               ExecStart=/root/test1
> >
> >                               StandardInput=socket
> >
> >
> >
> >                               [Install]
> >
> >                               WantedBy=multi-user.target
> >
> >
> >
> >
> >
> > I need /B.socket/ to start only after /A.service/ during boot. However,
> > even after setting */After=A.service/*//and */BindsTo=A.service/*//in
> > /B.socket/, sometimes /B.socket/ is starting before /A.service/.
> >
> >
> >
> > Please let me know if I am missing something.
> >
> >
> >
> >
> >
> > Thanks and Regards,
> >
> > Yashashvi
> >
> >
> >
> >
> > _______________________________________________
> > systemd-devel mailing list
> > systemd-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> >
>
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>   Tribalogic Limited http://www.tribalogic.net/
> Open Source:
>   Mageia Contributor http://www.mageia.org/
>   PulseAudio Hacker http://www.pulseaudio.org/
>   Trac Hacker http://trac.edgewall.org/
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


-- 
[image: SMILE]  <http://www.smile.eu/>

20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique

[image: email] jeremy.rosen at smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

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

[image: Découvrez l’univers Smile, rendez-vous sur smile.eu]
<https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20191211/fd323c45/attachment.htm>


More information about the systemd-devel mailing list