Bug 661145 - redshift has to be started with sudo (elevated privileges)
Summary: redshift has to be started with sudo (elevated privileges)
Alias: None
Product: Fedora
Classification: Fedora
Component: redshift
Version: 14
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Miloš Komarčević
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-12-07 21:46 UTC by Alexander Hunt
Modified: 2011-03-10 20:52 UTC (History)
2 users (show)

Fixed In Version: redshift-1.6-3.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-12-09 13:18:55 UTC

Attachments (Terms of Use)
Patch to look for the new style applet_iid key as well (1.10 KB, application/octet-stream)
2011-01-22 20:46 UTC, Miloš Komarčević
no flags Details

Description Alexander Hunt 2010-12-07 21:46:05 UTC
Description of problem: 
Using the GTK icon Applications/Accessories/Redshift, will not start the program unless sudo is placed in front of the command. Ie: sudo gtk-redshift
This is the same when starting from the command line (needs sudo redshift).

Version-Release number of selected component (if applicable):
redshift 1.5-1.fc14

How reproducible:
Install redshift, and try to use it under regular user-account.

Steps to Reproduce:
1. Try to run redshift from GTK icon in Accessories , or at command line.
2. GTK icon just disappears, opening redshift in terminal reports error (see below). 
Actual results:
redshift does not start without elevated privileges.

Expected results:
redshift would start without elevated privileges, put its icon in the tray, and redden screen according to time of day/night in locale.

Additional info:

copy/paste of terminal error:

No clock applet was found.
Initialization of gnome-clock failed.
Trying next provider...
Latitude and longitude must be set.

This does not occur when using redshift with elevated privileges. 
After going through information in Bug 604331; there does not seem to have been any discussion of using pam or polkit for redshift to get access to the information required from the clock applet; just a thought..
Happy Holidays to All!

Comment 1 Miloš Komarčević 2010-12-07 22:58:08 UTC
Cannot reproduce here, F14 on i386, freshly created user on default Gnome desktop:

$ redshift
Using provider `gnome-clock'.
Using method `randr'.

Have you removed the Gnome clock applet from the panel, or are running a different desktop?

Does it work without elevated privileges if you set lat:lon manually?

Comment 2 Alexander Hunt 2010-12-08 00:24:38 UTC
Hi Miloš,
I am using Gnome 2.32.0-2.fc14 and metacity, with no other desktops installed. I do have compiz installed, but I don't use it.

As per your request: I tried removing the clock applet and re-added it and reconfigured the locale, with no change in redshifts' behavior.

provided an example to run at command line:
redshift -l 55.7:12.6 -t 5700:3600 -g 0.8 -m vidmode -v
This example works without using sudo.

says there should be a config file. I could not find one anywhere on my installation, even with system and manual searches of the file system. 
Supposedly redshift looks for “~/.config/redshift.conf” at startup, but adding this file (adjusted from the example at above URL) to my system (in my home folder and the root home folder) does not make the program work without sudo. I also tried creating redshift folders in .config and pasting the conf file in those, but no difference 

Is there a config file somewhere else that I didn't find? 
Just a thought: It would be best for travellers if the program always got it's info from the gnome clock, for ease of adjusting between locales. 
Let me know if I can do anything more to help figure this out.
Happy Holidays!

Comment 3 Miloš Komarčević 2010-12-08 00:45:13 UTC
Config file is only present in redhsift 1.6 and later, Fedora is still on 1.5 (I will update Fedora packages after 1.6.1 is released soon).

I think I have found the cause: removing the default clock applet and adding a new clock applet manually does indeed reproduce the problem for me. It seems new clock applets are added as ~/.gconf/apps/panel/applets/applet_X whereas the original, default Gnome one redshift looks for was ~/.gconf/apps/panel/applets/clock.

Please create a new user with fresh (untouched) Gnome settings and confirm that redshift then works.

If so, then you have to restore/rename your current user gconf settings to the default ones somehow. This is unfortunately beyond my immediate knowledge, maybe GConf editor will do?

Also, I don't know how you got into this situation with the non-default clock applet, but if you feel the program's behavior is incorrect, please feel free to submit an upstream bug directly to the author for the quickest response.

Comment 4 Alexander Hunt 2010-12-08 02:29:02 UTC
Ok, Thanks for the info about the config file.
I ran your test (new user acct) and redshift worked normally (no elevated perms required). 
I was just working through some things with gconf to try to resolve the issue, mainly change some of the settings through Config Editor (no change in behaviour) and then to take the clock folder from the new user account and paste it into my regular account, change the permissions and try redshift, but that didn't enable redshift to see the clock applet either. Anyway, I'll keep working on that part (and report back if I figure out how to fix it), in the meantime, for myself it's not really any big problem to have redshift using elevated perms. 
I'm not sure how the original clock applet got changed either, I have mine moved from the top-panel to the bottom one, and I remember having some problem with the panels when I reverted back to Gnome 2 after doing some testing with Gnome 3. I guess at least we know now, it's best to leave the clock as it's installed! lol..
Thanks for your working on this, and Happy Holidays to you..

Comment 5 Alexander Hunt 2010-12-08 04:18:14 UTC
I figured out how to get the originally installed clock back in the tray, so wrote a brief user-guide for anyone else that has this problem.

1.) Remove clock from the tray, this will remove ~/.gconf/apps/panel/applets/applet(#) and its related entry in Gconf.

2.) copy/paste clock folder from /.gconf/apps/panel/applets/ in the root account (or newly created user account) to ~/.gconf/apps/panel/applets/

3.) Change owner of clock folder to current user (in terminal): sudo chown -R username:username /home/username/.gconf/apps/panel/applets/clock

4.) In Gconf: apps/panel/clock/   change "position" to 1446 and check-mark "panel_right_stick". Btw, if you want the clock in the top panel, config option "toplevel_id" should be: "top_panel", if you want it in the bottom tray change toplevel_id to: "panel_0"

5.) Don't worry about other settings, they can be changed from the clock applet once it's back in the tray.

6.) In Gconf: apps/panel/general  change "applet_id_list" by double-clicking on that line, this will open a config box, click add, and type "clock" in the box, then click OK.
(I moved my "clock" listing up to just under systray, but this may not be necessary.) Click "OK"
Close Gconf, etc.., you're done!

The clock should now be back in the tray, and redshift will now work without elevated permissions and be easily locale customizable by changing location through the gnome clock applet.

Many Thanks to Miloš Komarčević for figuring out what the problem was.
Happy Holidays!

Comment 6 Miloš Komarčević 2010-12-09 13:18:55 UTC
Ok, can go one step further after looking at the code:

Default clock applet in F14 and gnome-panel- is created in Gnome 2.30 or older style with bonobo_iid of OAFIID:GNOME_ClockApplet (which redshift checks for only), whereas newly added clock applets since Gnome 2.32 have instead applet_iid of ClockAppletFactory::ClockApplet and a null bonobo_iid.

Reported upstream, redshift should check both keys if necessary.

If someone hits this again, the quickest workaround is to add the correct bonobo_iid to the clock applet using e.g. gconf-editor.

Comment 7 Alexander Hunt 2010-12-09 21:25:58 UTC
Hi Miloš, I tried what you indicate in comment 6 (before figuring out the fix in comment 5) and it didn't work for me, but I did determine why; 
In ~/.gconf/apps/panel/clock/ there should be a prefs folder with a %gconf.xml file in it. This file has the latitude, longitude, and other clock settings info in it.
That folder and file were missing in my user account so that's why I did the copy/paste of the clock folder (ref:comment 5) into my own account. I imagine it would depend how the original clock got deleted as to whether the prefs folder gets deleted from the clock folder (I still don't know how that happened..lol). Anyway, I just thought I'd let you know that and as you said, for anyone else that hits this issue. Best Regards, and Thanks again.

Comment 8 Miloš Komarčević 2011-01-22 20:46:03 UTC
Created attachment 474756 [details]
Patch to look for the new style applet_iid key as well

This is a patch proposed to the author that should fix this particular issue bz
looking for both bonobo_iid (Gnome 2.30.x on F13 and before) and applet_iid
keys (Gnome 2.32.x on F14 and later).

Works for me, but YMMV.

Comment 9 Miloš Komarčević 2011-01-22 20:49:20 UTC
Also, just noticed Ubuntu users started seeing the same problem, so hopefully the bug will get some attention from the developer finally:


Comment 10 Fedora Update System 2011-03-02 17:41:08 UTC
Package redshift-1.6-3.fc15:
* should fix your issue,
* was pushed to the Fedora 15 updates-testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing redshift-1.6-3.fc15'
as soon as you are able to, then reboot.
Please go to the following url:
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2011-03-02 17:41:20 UTC
Package redshift-1.6-3.fc14:
* should fix your issue,
* was pushed to the Fedora 14 updates-testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing redshift-1.6-3.fc14'
as soon as you are able to, then reboot.
Please go to the following url:
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2011-03-02 17:41:32 UTC
Package redshift-1.6-3.fc13:
* should fix your issue,
* was pushed to the Fedora 13 updates-testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing redshift-1.6-3.fc13'
as soon as you are able to, then reboot.
Please go to the following url:
then log in and leave karma (feedback).

Comment 13 Fedora Update System 2011-03-09 03:11:00 UTC
redshift-1.6-3.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2011-03-10 20:48:05 UTC
redshift-1.6-3.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2011-03-10 20:52:00 UTC
redshift-1.6-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.