[systemd-devel] Still confused with socket activation

Benjamin Berg benjamin at sipsolutions.net
Thu Feb 4 14:11:09 UTC 2021


On Thu, 2021-02-04 at 13:07 +0100, Reindl Harald wrote:
> Am 04.02.21 um 12:46 schrieb Benjamin Berg:
> > On Wed, 2021-02-03 at 16:43 +0100, Reindl Harald wrote:
> > > seriously - explain what you expect to happen in case of
> > > 
> > > Requires=a.service
> > > Before=a.service
> > > 
> > > except some warning that it's nonsense
> > 
> > So, one way I used it is as ExecStartPost= equivalent for a .target
> > unit. i.e. pull in a Type=oneshot service once a target has become
> > active in order to execute a simple command
> 
> "Requires=a.service" combined with "Before=a.service" is
> contradictory - 
> don't you get that?

Your statements will not become more informed by repeating them.

It looks to me like you are interpreting Requires= incorrectly. Of
course, one can see a contradiction in saying "B requires A in order to
run" and then also saying "start A after B is ready".

But systemd considers requirements and ordering as two independent
problems. As such "Requires=A" only means something like "unit A must
be added to the transaction together with B". A statement that does not
imply ordering.

Yes, this is a a very logical/mathematical meaning which may not be
what you intuitively expect. And it does have the unfortunate side
effect of sometimes confusing people and they forget to add a needed
After= that they thought was implied.

But, it is well defined what happens when combining Requires= with
Before=. There is no contradiction.

Benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210204/ec937f23/attachment-0001.sig>


More information about the systemd-devel mailing list