Bug 1174024

Summary: Redshift systemd service script fails to start service
Product: [Fedora] Fedora Reporter: Matt Spaulding <mspaulding06>
Component: redshiftAssignee: Miloš Komarčević <kmilos>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 21CC: kmilos, oholy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-07 20:16:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matt Spaulding 2014-12-14 22:14:40 UTC
Description of problem:
The redshift daemon is not able to start from the user systemd service script. Startup fails because redshift is not able to query RANDR. Note that when running the redshift daemon without the service script it is able to start. I think maybe systemd is not able to access the X session.

Version-Release number of selected component (if applicable):
redshift-1.9.1-4.fc21

How reproducible:
Always

Steps to Reproduce:
1. Run the service script with 'systemctl --user start redshift.service'

Actual results:
Redshift daemon fails to start.

Expected results:
Redshift daemon starts.

Additional info:

-- Unit UNIT has begun starting up.
Dec 14 14:07:43 pixel systemd[2116]: Started Redshift display colour temperature adjustment.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit UNIT has finished starting up.
-- 
-- The start-up result is done.
Dec 14 14:07:43 pixel redshift[6691]: `RANDR Query Version' returned error -1
Dec 14 14:07:43 pixel redshift[6691]: Initialization of randr failed.
Dec 14 14:07:43 pixel systemd[2116]: redshift.service: main process exited, code=exited, status=1/FAILURE
Dec 14 14:07:43 pixel systemd[2116]: Unit redshift.service entered failed state.
Dec 14 14:07:43 pixel systemd[2116]: redshift.service failed.
Dec 14 14:07:43 pixel systemd[2116]: redshift.service holdoff time over, scheduling restart.
Dec 14 14:07:43 pixel systemd[2116]: Stopping Redshift display colour temperature adjustment...
-- Subject: Unit UNIT has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit UNIT has begun shutting down.
Dec 14 14:07:43 pixel systemd[2116]: Starting Redshift display colour temperature adjustment...
-- Subject: Unit UNIT has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit UNIT has begun starting up.
Dec 14 14:07:43 pixel systemd[2116]: start request repeated too quickly for redshift.service
Dec 14 14:07:43 pixel systemd[2116]: Failed to start Redshift display colour temperature adjustment.
-- Subject: Unit UNIT has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit UNIT has failed.
-- 
-- The result is failed.

Comment 1 Ondrej Holy 2015-02-05 22:04:13 UTC
It can be fixed by adding following line in service section:
Environment=DISPLAY=:0

See:
https://bbs.archlinux.org/viewtopic.php?id=177473

Comment 2 Miloš Komarčević 2015-02-07 20:16:48 UTC
(In reply to Ondrej Holy from comment #1)
> It can be fixed by adding following line in service section:
> Environment=DISPLAY=:0
> 
> See:
> https://bbs.archlinux.org/viewtopic.php?id=177473

See https://github.com/jonls/redshift/issues/91

Hardcoding the display is not a preffered way, this is atm best handled by the user as sugested in the forum thread.