-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling of graphical user services and ordering #253
Comments
I guess what you're asking for is for the graphical target to be a non-process-based service, so yes, it has to be either triggered or have a dependency on another (process-based) service. I'm also assuming you want to be able to switch out window systems implementations / desktop environments and therefore don't want to just hardcode a dependency from the
Replace X in the above with the appropriate desktop session if you want to wait for it to start fully, which is probably better. Then you need:
Neither of those two latter can be done automatically right now, but it'd be pretty easy to add these features. Do you think that would work? |
hm, i guess that could work - i don't see a good way to remove the transient dependency though (it has to be there during the stop process to bring the services down) - but perhaps it can stay there until the next time it's retriggered? hm i guess not really because dependencies will start regardless of trigger status, so it really has to go - the target would have to reset its dependencies immediately after its stop for this to work |
also i think I'd probably still need a way to implement service lifetime that is bounded by something external - i could make the graphical session a service, but something still needs to start it, the implementation of which is probably going to be specific to each desktop... |
I'm thinking about adding this support directly in dinit, so that when you add the transient dependency via
I think the transient dependency handles this, since the graphical target depends on the desktop manager (or whatever) then it must stop if the manager stops. I.e. a service B which depends (with a hard dependency) on A is bound by A. Or am I not understanding you properly? |
well, i guess we could implement the whole main program (compositor or window manager for simple desktops, for complex desktops this is a bit more complicated, i think e.g. for gnome we'd need gnome-session) of the graphical session as a service - this wouldn't guarantee orderly shutdown though, since the program exiting will only trigger shutdown of graphical services after that, but perhaps that could be only a fallback (in case of e.g. a crash) and user-intended shutdown could be done by asking dinit to take down the service? (which would if i understand this correctly order things right - as it'd request stop of dependent services first?) implementing that can be tricky however - since i have my user dinit running separately from the login, it does not have access to the user console, environment, etc.
Besides that, in both cases, users generally expect their graphical environment to have started with the environment of the place they invoked it from. That probably means exporting all of the environment variables from the current console (or whatever) to the startup environment of the graphical env. Moreover, things like resource limits and so on should likely also be inherited... |
Exactly what I was thinking.
Right, if there is an "outside of dinit" way to shutdown a process (service) then dinit can't enforce ordering. I don't think there's any way around that; what should happen in this case is that the session, before it ends, needs to stop the
Right, these are the issues that come from implementing the session as a service. I think I understand what you are getting at. If the session isn't a service though, you need some way for dinit to automatically know when a non-service process terminates. One alternative: If you had the ability to attach an already-running process (the session manager) to a service ( Alternatively, if you could have the session manager open a pipe and pass the read end to dinit (this would require implementation) and associating that with The easiest solution for now is probably to have the session instance be a service, though you have to copy the environment to it when it is launched. Or just live with the possibility that the session crashes without |
I was thinking of perhaps two pieces of functionality:
the first one would allow implementation as a service, the second one would allow a compatible implementation that could be launched tranditionally your pipe idea would be worthwhile to have too, independently of this issue, as it would nicely cover other things i dunno about the process attachment one, i think it's better to prefer equivalent portable options when we can have them as for manually copying the environment, i don't like that because it reflects that in activation env of every subsequently launched service, which I'm not a fan of |
i more or less came up with a system that i can probably implement without extra stuff in dinit (but it will need extra stuff elsewhere...)
now other services:
now, the user service manager ( now for the graphical triggering:
this requires no transient dependency to deal with, and should provide reasonable enough behavior in a desktop-independent manner i will still have that means turnstile service backend will become somewhat more complex; right now it only performs startup and waits for a nice thing about this approach is that i can already implement some of the baseline requirements without needing the session type tracking - i.e. the graphical services and whatnot, it'll just require users to for the time being manually deal with exporting the vars + triggering graphical.target themselves from some kind of session script + shutting down graphical.target on logout from some other place (and of course, crashed desktops will not take down the graphical.target, but that's okay for now...) |
I'm currently thinking about what the best way to implement graphical user services would be.
Ideally I'd like to have a special user service (called e.g.
graphical.target
). This user service would be the sentinel marking when graphical services are allowed to start; depending on this service would ensure that enabled graphical services will not attempt startup until a graphical environment is up (and thus it is ensured that e.g.DISPLAY
andWAYLAND_DISPLAY
are in environment, etc)However, the implementation of the details of this is pretty complicated. Currently the only way dinit provides to block off a service from starting is using triggered services. I could make
graphical.target
a triggered service and that will block off graphical services from bringing it up until something lets it. However, using a trigger to permit statup does not solve the other part of the matter and that is shutdown.The
graphical.target
should go down when the graphical session shuts down, and it should take all its dependents with it. There are some possible approaches, all of them with problems. The most obvious one is thatgraphical.target
could be a service that is enabled by the user and begins activation as soon as user dinit comes up, then the trigger could be done from some kind of session script. Then to bring it down, some kind of shutdown script would untrigger it and forcibly bring it down. While this would probably typically work, it's not very robust as it provides zero guarantee that the graphical session won't die in the meantime without properly taking it down. (scoping it from the outside somehow would not help because it needs to be scoped on the inside, i.e. start after the environment is up and stop before the environment comes down)Ideally the pieces providing the graphical session would also be user services themselves; they could in theory trigger bringup of the
graphical.target
somehow. However, dinit has no way to represent this kind of thing at the moment.Thoughts?
The text was updated successfully, but these errors were encountered: