Redshift unable to retrieve location from gnome location value

Bug #706353 reported by Dave Walker
62
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Redshift
Fix Released
Undecided
Unassigned
redshift (Fedora)
Fix Released
Low
redshift (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

dave@voodoo:~$ redshift
No clock applet was found.
Initialization of gnome-clock failed.
Trying next provider...
Latitude and longitude must be set.

(However, it is set - worked well in Maverick, but seems to be broken in Natty now)

Tags: patch

Related branches

Revision history for this message
In , Alexander (alexander-redhat-bugs) wrote :

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).
3.

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!

Revision history for this message
In , Miloš (milo-redhat-bugs) wrote :

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?

Revision history for this message
In , Alexander (alexander-redhat-bugs) wrote :

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.

http://jonls.dk/redshift/
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.

http://jonls.dk/2010/10/redshift-1-6-released/
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!

Revision history for this message
In , Miloš (milo-redhat-bugs) wrote :

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.

Revision history for this message
In , Alexander (alexander-redhat-bugs) wrote :

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..
Alex

Revision history for this message
In , Alexander (alexander-redhat-bugs) wrote :

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!

Revision history for this message
In , Miloš (milo-redhat-bugs) wrote :

Ok, can go one step further after looking at the code:

Default clock applet in F14 and gnome-panel-2.32.0.2-2 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.

Revision history for this message
In , Alexander (alexander-redhat-bugs) wrote :

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.

Revision history for this message
In , Miloš (milo-redhat-bugs) wrote :

Created attachment 474756
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.

Revision history for this message
In , Miloš (milo-redhat-bugs) wrote :

Also, just noticed Ubuntu users started seeing the same problem, so hopefully the bug will get some attention from the developer finally:

https://bugs.launchpad.net/redshift/+bug/706353

Revision history for this message
Anakin Starkiller (sunrider) wrote :

Same thing has happened today for me...
I'm running Arch Linux. Last thing I did was to remove and add again the clock applet....

Revision history for this message
Anakin Starkiller (sunrider) wrote :

In the %gconf.xml file of the applet (in .gconf), there is :

 <entry name="applet_iid" mtime="1296225749" schema="/schemas/apps/panel/objects/applet_iid" type="string">
                <stringvalue>ClockAppletFactory::ClockApplet</stringvalue>
        </entry>
        <entry name="locked" mtime="1296243383" schema="/schemas/apps/panel/objects/locked" type="bool" value="false"/>
        <entry name="custom_icon" mtime="1296225749" schema="/schemas/apps/panel/objects/custom_icon"/>
        <entry name="bonobo_iid" mtime="1296225749" schema="/schemas/apps/panel/objects/bonobo_iid"/>

And in the C code :

 if (current_city == NULL) {
                        char *key = g_strdup_printf("/apps/panel/applets/%s"
                                                    "/bonobo_iid", id);
                        char *bonobo_iid = gconf_client_get_string(client, key,
                                                                   &error);

                        if (!error && bonobo_iid != NULL &&
                            !strcmp(bonobo_iid, "OAFIID:GNOME_ClockApplet")) {
                                clock_applet_count += 1;
                                current_city = find_current_city(client, id);
                        }

                        g_free(bonobo_iid);
                        g_free(key);
                }

bonobo_iid is used, but there is no <stringvalue>
Older %gconf.xml file (from an old backup of my home directory) does contain <stringvalue> for bonobo_iid....

Any idea ?

Revision history for this message
Anakin Starkiller (sunrider) wrote :

Here is what i've read in gconf-editor (for the bonobo_iid key) :
This key is deprecated, following the migration to a new library for applets. The Bonobo implementation ID of the applet - e.g. "OAFIID:GNOME_ClockApplet". This key is only relevant if the object_type key is "bonobo-applet".
Shouldn't redshift use applet_iid instead ?

Revision history for this message
Anakin Starkiller (sunrider) wrote :

Workaround is to set bonobo_iid key to "OAFIID:GNOME_ClockApplet"

Revision history for this message
Jon Lund Steffensen (jonls) wrote :

Miloš Komarčević from Fedore fixed this a while ago. I only had time to look at his patch today.

Changed in redshift:
status: New → Confirmed
Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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:
https://admin.fedoraproject.org/updates/redshift-1.6-3.fc15
then log in and leave karma (feedback).

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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:
https://admin.fedoraproject.org/updates/redshift-1.6-3.fc14
then log in and leave karma (feedback).

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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:
https://admin.fedoraproject.org/updates/redshift-1.6-3.fc13
then log in and leave karma (feedback).

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
Dave Walker (davewalker) wrote :

Hi Jon,

Is there any progress in getting this patch in upstream? Would really like to get this fix into Natty as soon as possible. :)

Thanks!

Revision history for this message
Dave Walker (davewalker) wrote :

Just a comment, that the patch seems to resolve the issue for me here. If the patch lands in trunk, I am happy to upload it soon after to Natty.

Thanks!

Revision history for this message
Jon Lund Steffensen (jonls) wrote : Re: [Bug 706353] Re: Redshift unable to retrieve location from gnome location value

2011/3/14 Dave Walker <email address hidden>:
> Hi Jon,
>
> Is there any progress in getting this patch in upstream?  Would really
> like to get this fix into Natty as soon as possible. :)

I've been busy lately, but it is definitely in my queue.

Dave Walker (davewalker)
Changed in redshift (Ubuntu):
status: New → Confirmed
tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package redshift - 1.6-1ubuntu1

---------------
redshift (1.6-1ubuntu1) natty; urgency=low

  * debian/patches/bonoboiidfix.patch: Support the newer schema of gconf, to
    correctly retrieve the gnome clock applet information. Patch courtesy of
    Miloš Komarčević, via Fedora. (LP: #706353)
 -- Dave Walker (Daviey) <email address hidden> Tue, 21 Mar 2011 22:36:23 +0000

Changed in redshift (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
fain182 (fain182) wrote :

I'm still having this problem in fresh installed natty:

fain182@xt:~$ redshift
No clock applet was found.
Inizializzazione di gnome-clock non riuscita.
Provando il prossimo provider...
Latitude and longitude must be set.

Revision history for this message
Jan Schürmann (visionfactory.net) wrote :

i have this problem in Natty final with redshift 1.6-1ubuntu1

jan:~$ gtk-redshift -t 6500:4200
No clock applet was found.
Starten von gnome-clock fehlgeschlagen.
Nächster Dienst wird getestet …
Latitude and longitude must be set.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Jan, fain182,

This is (at least AFAICT) an unrelated issue in Natty due to the fact that in *Unity* there is no gnome-clock running. For now you'll need to specify a latitude/longitude via the command line; or build redshift from source with the geoclue code builtin.

Revision history for this message
Jeffrey Finkelstein (jfinkels) wrote :

Mathieu:

Should we create a new bug report then?

Changed in redshift:
status: Confirmed → Fix Committed
Changed in redshift:
status: Fix Committed → Fix Released
Changed in redshift (Fedora):
importance: Unknown → Low
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.