Redshift service unit not working

This problem I can’t solve for several days. Studied systemd, service units, archwiki, examples, blog posts, forum posts on various forums… tried removing and reinstalling redshift, tried different commands with different options, different service files, nothing helps… What am I doing wrong?

The problem is to start redshift as service unit for systemd: to set the same color temperature for day and night and start redshift on login/startup

This is the service file located at /etc/systemd/system/redshift.service

[Unit]
Description=Redshift display colour temperature adjustment
Documentation=http://jonls.dk/redshift/
After=display-manager.service

[Service]
User=%i
Type=simple
Environment=DISPLAY=:1
ExecStart=/usr/bin/redshift
Restart=always

[Install]
WantedBy=default.target

config file located at /home/username/.config/redshift/redshift.conf:

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=4700
temp-night=4700
location-provider=manual

[manual]
lat=90.00
lon=1.00

systemctl status redshift
○ redshift.service - Redshift display colour temperature adjustment
Loaded: loaded (/etc/systemd/system/redshift.service; disabled; vendor preset: disabled)
Active: inactive (dead)
systemctl start redshift --now
systemctl status redshift
× redshift.service - Redshift display colour temperature adjustment
Loaded: loaded (/etc/systemd/system/redshift.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-04-20 13:47:41 MSK; 9s ago
Docs: http://jonls.dk/redshift/
Process: 5874 ExecStart=/usr/bin/redshift (code=exited, status=1/FAILURE)
Main PID: 5874 (code=exited, status=1/FAILURE)
systemd[1]: redshift.service: Scheduled restart job, restart counter is at 5.
systemd[1]: Stopped Redshift display colour temperature adjustment.
systemd[1]: redshift.service: Start request repeated too quickly.
systemd[1]: redshift.service: Failed with result ‘exit-code’.
systemd[1]: Failed to start Redshift display colour temperature adjustment.
systemctl --user daemon-reload
systemctl --user start redshift.service --now
Failed to start redshift.service: Unit redshift.service has a bad unit file setting.
systemctl --user status redshift.service
○ redshift.service - Redshift display colour temperature adjustment
Loaded: bad-setting (Reason: Unit redshift.service has a bad unit file setting.)
Active: inactive (dead)

Try with this:

[Unit]
Description=Redshift display colour temperature adjustment
Documentation=http://jonls.dk/redshift/
After=graphical-session.target

[Service]
ExecStart=/usr/bin/redshift
Restart=always

[Install]
WantedBy=graphical-session.target
1 Like

Is a systemd unit really needed?
:thinking:

what de you using? I always set it to autostart (works a treat in cinnamon/lqxt/kde for me) and no need to go near any sysd stuff.

I tried. It is not working:

systemctl daemon-reload
systemctl start redshift.service --now
systemctl enable redshift.service --now
Created symlink /etc/systemd/system/graphical-session.target.wants/redshift.service → /etc/systemd/system/redshift.service.
Unit /etc/systemd/system/redshift.service is added as a dependency to a non-existent unit graphical-session.target.
systemctl status redshift.service
× redshift.service - Redshift display colour temperature adjustment
Loaded: loaded (/etc/systemd/system/redshift.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-04-20 14:59:30 MSK; 23s ago
Docs: http://jonls.dk/redshift/
Process: 7308 ExecStart=/usr/bin/redshift (code=exited, status=1/FAILURE)
Main PID: 7308 (code=exited, status=1/FAILURE)
CPU: 3ms

systemd[1]: redshift.service: Scheduled restart job, restart counter is at 5.
systemd[1]: Stopped Redshift display colour temperature adjustment.
systemd[1]: redshift.service: Start request repeated too quickly.
systemd[1]: redshift.service: Failed with result ‘exit-code’.
systemd[1]: Failed to start Redshift display colour temperature adjustment.

Just as @pebcak and @Gavin1 hinted, redshift works for me without having to enable/start a systemd unit.

On my sytems, with a functioning redshift, systemctl status redshift returns
Unit redshift.service could not be found.

It should suffice to

  1. Install with
    sudo pacman -S redshift

  2. Start ‘Redshift’ through application menu and

  3. enable Autostart in panel icon.


No such file on my system. How did you (try to) install redshift?

2 Likes

I specifically wanted to do it without gtk app for the following reason:
When I start gtk app it starts a wheel image spinning near the mouse cursor for half a minute. It’s pretty annoying when an app that simply controls color temperature takes 30 seconds to load…

I installed redshift like this:
sudo pacman -S redshift
I did not install redshift-gtk, but somehow it still managed to creep in, I don’t know how.
I created the service file in /etc/systemd/system/redshift.service, according to examples suggested in various tutorials. Tried many versions of service files with different options, none of them worked.

I just tested and can confirm this behavior. There actually is a spinning wheel image, but only if you hover over the panel for those ~13 seconds. I have never actively seen this so I’m just going to ignore this from now on.

But you could try redshift-qt-git from the AUR which is a

redshift-gtk rewrite with C++/Qt. Currently mimicks 1:1 redshift-gtk tray menu and it’s features:

Maybe it doesn’t show that weird spinning icon…

1 Like

I find the following

a worthy alternative to redshift. Maybe you want to give it a look/try.

1 Like

sudo pacman -S geoclue2 - that and enabling on start (and then rebooting) results in no spinning wheel - the spin is working out the location for redshift.

3 Likes

and if you don’t move around time zones with your lappy, the real easy option for location/colour temp etc is just put the parameters in the startup line command, something like this: redshift-gtk -t 6500:4800 -l 9.58:8.40

t being temperature (day/night), and l for latitude and longitude. Deifinately no spinning wheels with this one as no attempt to get a location from elsewhere!

1 Like

Isn’t geoclue a dependency of redshift and will therefore already be installed?

Thanks for this. But …

… there is still the “spinning wheel” when run from the application menu.

So,

  • “Spinning wheel” when run from (XFCE) application menu
  • No “spinning wheel” when run from terminal (thanks @Gavin1)

=> Conclusion (this worked for me):
Edit Redshift’s application launcher and uncheck “Use startup notification” to get rid of the “spinning wheel”.

2 Likes

well, it is and it should be, but it doesn’t. However, i just checked a fresh install of endos, and geoclue is installed by default (for gnome at least), even before redshift is installed (on deb/arch etc, i’ve always had to explicitly add it before (same went for artix the other day). So good on endos if its already there by default! A well oiled machine.

Check who owns this file. It is not the default package provided.

pacman -Qo /etc/systemd/system/redshift.service

I guess nobody… Did you create it?

The original is at /usr/lib/systemd/user/redshift.service with content:

# /usr/lib/systemd/user/redshift.service
[Unit]
Description=Redshift display colour temperature adjustment
Documentation=http://jonls.dk/redshift/
After=display-manager.service

[Service]
ExecStart=/usr/bin/redshift
Restart=always

[Install]
WantedBy=default.target

Whoever wrote this is either an expert or is just experimenting with something unusual.

1 Like

That’s because it’s a user service, not a system service.

systemctl --user enable redshift.service --now

If you think about it, a system service can’t access your display on boot because the display doesn’t exist at that point.

1 Like

This thread brings back my experience with doing the same and similar frustrations - redshift via systemd.

I think I got redshift to work in systemd as a service, but I had to put all the configs as command-line parameters on the ExecStart line after the binary: -l nn.nn:nn.nn -m randr -P -t nnnn:nnnn -v -g 0.8

I think if you pass in your lat/long, then geoclue won’t get called. I think.

At that point, I decided it’d be easier to manage and put redshift in the cool_autostart patch of dwm along with some other apps and killed the redshift service that I had heavily modified during my debugging.

Replace n’s with your lat/long and desired color temperatures.

Good luck.

Hey. The Autostart function in the Context menu Redshift requires the following dependencies: python-gobject and python-xdg (python-pyxdg). One day when I was about to turn on the autostart option in Redshift, it didn’t appear in the Redshift context menu after I finished reinstalling. Turns out after I investigated it needed dependancy: python-pyxdg. Then the autostart option in the Context menu appears in Redshift.