Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Propagate After= from target to its dependencies #3750
Comments
martinpitt
added
RFE
pid1
labels
Jul 19, 2016
|
Define "its dependencies". A is After B, A Wants C, C Wants D. Should D be After B? |
|
Intuitively, and for this use case, yes. That's also the case for |
|
The obvious example how easy it is to break
I think such propagation should be restricted to units that are P.S. sorry messed up example. |
But dependencies are defined by the very existing of |
martinpitt
referenced this issue
Aug 1, 2016
Merged
units: add graphical-session-pre.target user unit #3848
|
Just discussed that with @poettering, and he generally agrees with the idea; we just need to find a good way to express this in a unit. I. e. there should be some kind of We can then use this to drop the hardcoding of In principle we could apply this for the various |
|
@martinpitt dropping the basic.target hardcoding would make it impossible to have services start as early as possible, but not start them in single user mode. In debian some firewalls and console-setup are setup like this |
This breaks indirect dependency. I.e. if I'd rather consider possibility to define default dependencies in configuration file (like I do think that idea of propagating dependencies is very useful, just not in this particular case. |
|
@martinpitt iirc this was solved differently in the end and hence we can close this rfe? |
|
I don't have a better solution for this, but if this is too difficult to implement I guess we'll have another round on updating all our user services to add the |
martinpitt commentedJul 19, 2016
Submission type
systemd version the issue has been seen with
This came up while discussing and implementing graphical sessions with systemd. There are a few "set up" services like gpg-agent (poking environment variables into D-Bus) or session-migration (updating obsolete gsettings keys after upgrade and the like) which need to run before the desktop and applications start. It is currently very hard to order a bunch of services after a bunch of "early" services with targets. This can be demonstrated with some user units:
So the intention is that
early.targetand its dependencies run first, thenlate.targetand its dependencies. But startinglate.targetimmediately startssome.serviceas there is nothing that would delay that service. Only thelate.targetitself waits forearly.target(but that is not the point here):With current systemd one would instead have to put the
After=early.targetinto every single*.service, of which there are a lot.On the system side the main divide that we have is
sysinit.targetand theDefaultDependencies=mechanism helps to implicitly addRequires/After=sysinit.targetto every unit inmulti-user. It would be nice to have a generalization of that, in the spirit oflate.targetsaying[Target]\nPropagateDependencies=yes(this is not a great property name, I know) so that all of its dependencies inherit the sameAfter=andBefore=as the target itself (maybe alsoRequires=andWants=, for consistency/symmetry).This would help to more elegantly model the use case above, and we could perhaps also use that to replace the in-code implementation of
DefaultDependencies=yeswith adding this flag tomulti-user.target.