How to stop Redshift from starting automatically?

Today, I did a fresh install of openSUSE LEAP 15. Things went smoothly for the most part, however, I noticed that two packages are behaving slightly differently than they used to in openSUSE LEAP 42. Namely, ‘syncthing’ and ‘redshift’. Both of these packages are configured by default to auto start with each session. Moreover, every time I kill redshift, it auto re-spawns immediately. Basically, I could not stop redshift from running except by uninstalling it!

For syncthing, I am okay with that behavior. I usually add an “Autostart” entry for syncthing manually. Now, I don’t need to do that. However, for redshift, this is not the desired behavior, and I cannot seem to turn it off.

Where are the configurations for those behaviors? And, how to disable it for redshift?

Hi
It’s a systemd service (two of them), so;


su -
systemctl status redshift
systemctl status redshift-gtk

(stop and disable as required)
systemctl stop redshift
systemctl stop redshift-gtk

systemctl disable redshift

systemctl disable redshift-gtk
exit

Thank you malcolmlewis.

The exact command you suggested did not work, however, after adding “–user” to the command it seemed to work (at first).

> systemctl status redshift
Unit redshift.service could not be found.

> systemctl stop redshift --user
> systemctl disable redshift --user
> systemctl status redshift --user
● redshift.service - Redshift display colour temperature adjustment
   Loaded: loaded (/usr/lib/systemd/user/redshift.service; disabled; vendor preset: enabled)
   Active: inactive (dead) since Sun 2018-05-27 14:35:36 EDT; 3min 46s ago
     Docs: http://jonls.dk/redshift/                      
 Main PID: 2415 (code=exited, status=0/SUCCESS) 

The stop command seems to work correctly. Unforturnately, after a restart the service is running again!

> systemctl status redshift --user
● redshift.service - Redshift display colour temperature adjustment
   Loaded: loaded (/usr/lib/systemd/user/redshift.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-05-27 14:44:10 EDT; 44s ago
     Docs: http://jonls.dk/redshift/
 Main PID: 2005 (redshift)
   CGroup: /user.slice/user-1000.slice/user@1000.service/redshift.service
           └─2005 /usr/bin/redshift

PS: I have not installed redshift-gtk, nor is the service for it present.

Hi
Try masking the service;


systemctl mask redshift --user

Thanks again malcolmlewis. Your suggestion did work.

I tried to investigate this further, and find out which service was causing redshift to start. What I found was a service called ‘default.target’.

> systemctl list-dependencies redshift --user --reverse
redshift.service
● └─default.target
> systemctl list-dependencies default.target --user
default.target
● ├─redshift.service
● ├─syncthing.service
● └─basic.target
●   ├─paths.target
●   ├─sockets.target
●   │ └─dbus.socket
●   └─timers.target

Could someone explain to me what this mysterious ‘default.target’ service is?

It’s the target the system is supposed to boot too, similar to the “default runlevel” in per-systemd times.

If a service is enabled to be started on boot, it is added to the default.target’s dependencies.

Btw, your problem is a known bug, all user systemd services are enabled by default although they shouldn’t be.
https://bugzilla.opensuse.org/show_bug.cgi?id=1090480
https://bugzilla.opensuse.org/show_bug.cgi?id=1090785
(the latter apparently has been fixed meanwhile in Factory, no idea whether an update for SLE/Leap 15.0 is planned or not)

Thank you, wolfi323. I am trying to get a better understanding of how things are being done under-the-hood. So, if instead of masking the redshift service, I wanted to exclude redshift from being started by the target.default, how do I do that?

And what is the advantage of using default.target to start a service, instead of simply enabling the service?

Masking is the way to prevent a service from being started.

Actually “disable” should work too, but it may still be started if another service wants to have it.

And what is the advantage of using default.target to start a service, instead of simply enabling the service?

Difference?
That’s exactly what enabling a service actually does. It adds it to the services to be started by default.target.