[systemd-devel] Xorg or Wayland Environment

Ed Greshko ed.greshko at greshko.com
Tue Sep 21 10:51:58 UTC 2021


On 21/09/2021 18:20, Colin Guthrie wrote:
> Ed Greshko wrote on 19/09/2021 12:11:
>> OK......
>>
>> I think I see the problem now.  I don't need Environment=.  But the issue is that, I assumed, "plasma-core.target" would be
>> reached only after a user logged in to plasma.
>>
>> I was wrong and the user's service is run earlier when the login screen appears.
>
> I'm slightly confused by the logic here. Why is a user's systemd even running before they've logged in? If the user has lingering enabled, then it might have a systemd instance from that, but it certainly shouldn't reach any plasma-core.target as the login GUI should be running as a different user to your user I would have thought?
>
> e.g. under gnome, the login GUI runs as the "gdm" user. That user has a systemd --user instance, and runs various things but only once a real user has logged in will it's own systemd instance start and reach the appropriate targets.
>
>> I need to find a way such that the service only runs when a user logs on to the plasma GUI.
>
> It seems a bit odd to me that your users' plasma-core.target has been run when your user hasn't even logged in yet. I think something is odd there, possible combined with user lingering and perhaps plasma-core being the default target for your user when it shouldn't be...
>
> Hope this helps you debug things.

Yes, that helped.

plasma-core.target isn't the correct target.  I switched to graphical-session.target.

I believe one issue remains.

On login, after a reboot, the app is started.  And, on logout the app is terminated.

The issue is that if the user logs out and logs back in the service is not run.

How to make sure the service is run each time the user logs in?




More information about the systemd-devel mailing list