Web lists-archives.com

Re: systemd WantedBy for X login

On 19/05/19 6:40 PM, Sven Joachim wrote:
> On 2019-05-19 15:58 +1200, Aidan Gauland wrote:
>> I have a bunch of systemd user services for headless daemons that I want
>> to run in both console and graphical logins, which all work fine, but I
>> have one that I only want to start for graphical logins, and that works
>> when I start it manually, but it is not being started when I log in,
>> even though I have the WantedBy field set to graphical.target. I am
>> using lightdm and i3.
> How do you start lightdm?  It should only be started automatically in
> graphical.target.
I'm not sure.  I just installed the lightdm package and it is started
automatically at boot-time.
>> The other services' WantedBy field is set to
>> default.target. What is the correct way to specify that a service
>> should be started only for X logins?
> The wantedBy field is the correct place to specify that, but you also
> have to make sure that your X login is actually reached via
> graphical.target.
OK, good.  Is there a way to test this?

I just found this tidbit on the Arch wiki suggesting that the only valid
target for user services is default.target:

“When a systemd user instance starts, it brings up the target