New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to GeoClue. Unable to get location from provider. #318

Open
DimitriPapadopoulos opened this Issue Feb 17, 2016 · 47 comments

Comments

Projects
None yet
@DimitriPapadopoulos

DimitriPapadopoulos commented Feb 17, 2016

Unable to start redshift 1.11 on Fedora 23 since yesterday:

$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Geolocation disabled for UID 1000.
Unable to connect to GeoClue.
Unable to get location from provider.
$ 

This is similar to #158 but the proper fix - having both redshift.desktop and redshift-gtk.desktop files - doesn't help any more. Indeed both files are available in Fedora since #1309177 was closed:

$ rpm -qf /usr/share/applications/redshift.desktop
redshift-1.11-1.fc23.x86_64
$ rpm -qf /usr/share/applications/redshift-gtk.desktop
redshift-gtk-1.11-1.fc23.x86_64
$ 

Both alternative solutions work although they are supposed to be bad solutions:

  1. Run as sudo redshift-gtk
  2. Add to /etc/geoclue/geoclue.conf:
[redshift]
allowed=true
system=false
users=
@DimitriPapadopoulos

This comment has been minimized.

DimitriPapadopoulos commented Feb 21, 2016

I've found location services had been turned off. After turning on location services redshift runs smoothly.

It makes sense that redshift needs a location. However instead of exiting with a cryptic error message, redshift could display a dialog to manually set a location or turn on location services.

For example gnome-maps doesn't crash when location services are not running:

  • either you enter a location manually from the search bar,
  • or gnome-maps offers to turn on location services in settings.

See attached screen capture of gnome-maps:
gnome-maps

@mikeatlas

This comment has been minimized.

mikeatlas commented Feb 24, 2016

@DimitriPapadopoulos where can I "turn on location services" setting you are describing... gnome-maps doesn't work on 14.04. I presume there's an underlying package and not something inherently required about gnome-maps being installed to fix redshift's geoclue2 problems.

@DimitriPapadopoulos

This comment has been minimized.

DimitriPapadopoulos commented Feb 25, 2016

Gnome maps is just an example of an alternative way to handle missing location services. Other than that it is totally unrelated to redshift.
I don't know about Ubuntu 14.04, I have Fedora 23 here and location services can be enabled/disabled from Settings.

@DimitriPapadopoulos

This comment has been minimized.

DimitriPapadopoulos commented Feb 25, 2016

As far as I can tell it is quite difficult to disable intrusive services like geoclue (location service) in Ubuntu:
http://askubuntu.com/questions/106916/how-do-i-stop-geoip-from-connecting-to-the-internet-every-time-i-boot

My guess is that location services are not disabled on your Ubuntu computer. Also I have just tried an Ubuntu 14.04 workstation and gnome-maps works pretty well once installed. Something might be broken on your computer.

@mikeatlas

This comment has been minimized.

mikeatlas commented Feb 25, 2016

I decided to just install the latest build 1.11 from source and specify my lat:lon manually in the config. Personally I don't travel with my workstation across time zones .... Like ever. So dynamic geoclue calls every time redshift starts aren't really worth the struggle to resolve. Thanks for the reply @DimitriPapadopoulos

@clayzermk1

This comment has been minimized.

clayzermk1 commented Nov 21, 2016

Was encountering this and have a clean fix.
Currently using redshift 1.10-5ubuntu on Linux Mint 18 Sarah (straight from repo).

Installed redshift and redshift-gtk packages.
Attempted to run redshift-gtk and encountered this issue.
Ran redshift from command line and got:

$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Unable to connect to GeoClue.
Unable to get location from provider.

Installed geoclue-2.0 sudo apt-get install geoclue-2.0.
Ran another time from the terminal.
Started no problems.
Exited the terminal process and started redshift-gtk, no problems.

Hope this helps someone else 🍻

@eadebayo

This comment has been minimized.

eadebayo commented Dec 12, 2016

@clayzermk1
Thanks for the post. Worked for me. Mint 18, MATE.

@clayzermk1

This comment has been minimized.

clayzermk1 commented Dec 13, 2016

At least in the .deb, it seems like geoclue-2.0 should be a requirement of the package if it's required. It seems like the .rpm could also use a dependency based on @DimitriPapadopoulos's original post. Can anyone on a .rpm distro comment as to the minimum set of packages they had to install to get redshift to work?

@mrschaal

This comment has been minimized.

mrschaal commented Jan 8, 2017

@clayzermk1 thank you very much, helped me a lot. Worked perfectly for me, using Linux Mint 18 KDE

@vbsteja

This comment has been minimized.

vbsteja commented Apr 19, 2017

@clayzermk1 it solved for me. thanks so much.

@artforlife

This comment has been minimized.

artforlife commented Oct 28, 2017

I am still having this issue on Ubuntu 16.04. I have tried every solution advised in this thread to no avail. Any idea how I can troubleshoot this?

@vinaykumar2491

This comment has been minimized.

vinaykumar2491 commented Nov 1, 2017

Based on the original post, the geo2 location provider is already installed.
So there are two solutions to this:

  1. Run Redshift from command line as root sudo redshift
  2. Turn on Location services: Goto Settings --> Privacy --> Location Services (ON/OFF)
@sodomak

This comment has been minimized.

sodomak commented Feb 23, 2018

Ok, so it is not possible to run Redshift without location services? It would be nice to be able to set the location manualy (I think I know where I am:) ). I see it as the privacy issue.

@helo9

This comment has been minimized.

helo9 commented Feb 24, 2018

No you don't need any location service, simply pass
-l LAT:LON
as option on command line.

@saifjsl

This comment has been minimized.

saifjsl commented Jun 18, 2018

On Fedora 28 KDE, only thing that worked was redshift-gtk -l 0:0

@jiawanyovan

This comment has been minimized.

jiawanyovan commented Jun 18, 2018

On Fedora 28 Cinammon, the command redshift-gtk -l 0:0 also works
Seems like recent update breaks the app.

@ElijahLynn

This comment has been minimized.

ElijahLynn commented Jun 21, 2018

I had this issue as well, my environment is Fish > Tmux > Guake. I had to exit Tmux within Guake and run redshift outside of Tmux. I had tried creating a new window (shell session) inside Tmux but that didn't work.

@rmlrml

This comment has been minimized.

rmlrml commented Jul 2, 2018

Getting almost the same error message in Debian too. geoclue-2.0 is installed.
Error popup on startup:

Failed to run Redshift
Trying location provider `geoclue2'...
Unable to start GeoClue client:
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:
'redshift' disallowed, no agent for UID 1000.
Unable to connect to GeoClue.
Unable to get location from provider.

In the terminal, no gtk:

ryan@pocketwee:~$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000.
Unable to connect to GeoClue.
Unable to get location from provider.

sudo same:

ryan@pocketwee:~$ sudo redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 0.
Unable to connect to GeoClue.
Unable to get location from provider.

Was suggested to start service, no go:

ryan@pocketwee:~$ systemctl --user start redshift.service
ryan@pocketwee:~$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000.
Unable to connect to GeoClue.
Unable to get location from provider.
@akostadinov

This comment has been minimized.

akostadinov commented Jul 16, 2018

What version was merge request 6 merged into? Perhaps it will resolve the issue.

FYI for Fedora 28 issue is 1585970.

@DrDoctor13

This comment has been minimized.

DrDoctor13 commented Jul 17, 2018

I'm getting this issue on KDE 5.13.3. When I log in, I get prompted to allow location access (not something I knew KDE did) but it doesn't seem to do anything.

Trying location provider `geoclue2'...
Using provider `geoclue2'.
Using method `randr'.
Waiting for initial location to become available...
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000.
Access to the current location was denied by GeoClue!
Make sure that location services are enabled and that Redshift is permitted
to use location services. See https://github.com/jonls/redshift#faq for more
information.
Unable to get location from provider.

@ElijahLynn

This comment has been minimized.

ElijahLynn commented Jul 17, 2018

This seems like an issue with connectivity with the external server. The error handling needs to be better around refused connections.

@sbrl

This comment has been minimized.

sbrl commented Jul 23, 2018

I'm using an Arch-based distro (Artix Linux actually - it uses OpenRC instead of SystemD) with XFCE4, and I get a prompt every time I sign in asking me whether I want redshift to be allowed to access my location. I found a notify_location preference under xfce4-notifyd in the Xfconf settings editor - and its set to 2, but I'm currently unsure if this is the right setting I'm after - and, indeed, what to set it to to auto-approve location access for redshift if it is.

@Skatox

This comment has been minimized.

Skatox commented Jul 23, 2018

I have the same problem on Arch inside KDE, I don't know how to enable location from KDE, since it seems like it's a GNOME thing.

@akostadinov

This comment has been minimized.

akostadinov commented Jul 23, 2018

You need patched geoclue, and make sure geoclue demo agent is running. Agent will start geoclue on demand.

@Jeremytho2050

This comment has been minimized.

Jeremytho2050 commented Jul 23, 2018

I'm new to GitHub and I do not know how to post the error

I have a problem starting Redshitf in Konsole: redshift -o.
And I get this:

Waiting for the current location to be available ...
Unable to start GeoClue client: GDBus.Error: org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000.
Access to the current location was denied by GeoClue!
Make sure that location services are enabled and that Redshift is permitted
to use location services. See https://github.com/jonls/redshift#faq for more
information.
The location of the provider could not be obtained.

Help me please :'v

@sbrl

This comment has been minimized.

sbrl commented Jul 24, 2018

@akostadinov:

You need patched geoclue, and make sure geoclue demo agent is running. Agent will start geoclue on demand.

Where can I find this patched geoclue?

Also, I'm unsure as to what you mean by geoclue demo agent.

@akostadinov

This comment has been minimized.

akostadinov commented Jul 24, 2018

@sbrl , read my last comment about bug fix. You need a version with the merge request applied. On Fedora 28 I'm using Fedora 29 latest Koji builds, see the bugzilla issue.

The demo agent that is part of the GeoClue distribution needs to be started unless you are running Gnome. On Fedora 28 XFCE starts it automatically. No idea about other distros and/or DEs.

@LongLVNH

This comment has been minimized.

LongLVNH commented Jul 25, 2018

Hello. In my case I think it has been solved for me by making a symbolic link of the file:
/etc/xdg/autostart/geoclue-demo-agent.desktop,
into the directory:
~/.config/autostart.
Hope it works for other people.
Also, I use Plasma as my Desktop Environment and Arch Linux as my Linux distribution.

@Portergos

This comment has been minimized.

Portergos commented Jul 29, 2018

/etc/xdg/autostart/geoclue-demo-agent.desktop

Nice! So i added (/usr/lib/geoclue-2.0/demos/agent| redshift-gtk) & to my i3-wm startup and geoclue2 is working fine. Thanks!

@akostadinov

This comment has been minimized.

akostadinov commented Jul 30, 2018

@Portergos , I assume you'd better change | to && or something. The | is sending agent stdout to redshift which doesn't do any good and is a potential source of trouble.

@Portergos

This comment has been minimized.

Portergos commented Aug 2, 2018

@akostadinov
Ok, i just saw that previous version didn't come with /usr/lib/geoclue-2.0/demos/agent there was only /usr/lib/geoclue-2.0/demos/where-am-i so i don't think it's a geoclue bug but redshift need to invoke the library (with a new update i hope)

@sbrl

This comment has been minimized.

sbrl commented Aug 7, 2018

I ended up writing a one-liner that I've added to my startup applications:

redshift -l $(curl ipinfo.io | jq -j .loc | tr ',' ':')

This downloaded my approximate location, based on my IP address, from ipinfo.io and passes it as a 'manual' location to redshift. When I move around enough for it to become an issue, I usually have to shut my laptop down to get off a train, go through airport security, etc - and I don't have an inbuilt GPS sensor (as far as I know, anyway :P), so I don't think it really matters.

Furthermore, I don't turn my device on and off enough for the rate limit of ipinfo.io to take effect either :P

Note that it requires that both curl and jq be installed.

@lf-

This comment has been minimized.

lf- commented Aug 8, 2018

I fixed my issue by adding a quick systemd user service to enable the geoclue agent service.

Put something like the following at ~/.config/systemd/user/geoclue-agent.service, then enable/start it with systemctl --user enable --now geoclue-agent

[Unit]
Description=redshift needs to get a (geo)clue

[Service]
ExecStart=/usr/lib/geoclue-2.0/demos/agent

[Install]
WantedBy=default.target
@stpeters00

This comment has been minimized.

stpeters00 commented Aug 8, 2018

For Fedora and perhaps other distros, the path to the agent is
/usr/libexec/geoclue-2.0/demos/agent (/usr/lib -> /usr/libexec)

@fictionic

This comment has been minimized.

fictionic commented Aug 16, 2018

@lf- That works for me! Except I can't start redshift or redshift-gtk as a systemd service. Any ideas on why? I've followed the instructions on the Arch Wiki here without success

@AnonGuy

This comment has been minimized.

AnonGuy commented Aug 16, 2018

Quick note for people using Arch:
If you get an ImportError from running redshift-gtk:

Traceback (most recent call last):
  File "/usr/bin/redshift-gtk", line 26, in <module>
    from redshift_gtk.statusicon import run
  File "/usr/lib/python3.7/site-packages/redshift_gtk/statusicon.py", line 30, in <module>
    import gi
  File "/usr/lib/python3.7/site-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'

you might have to run it with python2: python2 /usr/bin/redshift-gtk

@jonls

This comment has been minimized.

Owner

jonls commented Aug 17, 2018

@AnonGuy Please don't run it with python 2, it will break. Please ask you distribution to fix the packaging if there's an issue. You may need to fix your install of python gobject.

@AnonGuy

This comment has been minimized.

AnonGuy commented Aug 17, 2018

@jonls Ah, my bad. A reinstall of python-gobject: sudo pacman -S python-gobject fixes the issue.

It seems that I had the global Python interpreter switched to a different version with pyenv during the original installation, so I had to switch to the system version with pyenv global system before reinstalling.

@PowerOlive

This comment has been minimized.

PowerOlive commented Aug 20, 2018

resolution for archlinux systemctl --user enable redshift.service

@lukehinds

This comment has been minimized.

lukehinds commented Sep 5, 2018

@PowerOlive That's not really a resolution, the problem is geoclue2 denying redshift access, not enabling the systemd wrapper service for redshift.

The fix for Arch is to upgrade to geoclue-2.4.11 or >

See here #636 (comment)

@Raptime

This comment has been minimized.

Raptime commented Sep 16, 2018

Using debian even with latest geoclue and redshift the issue is still here, unless I manually star the demo agent prior to starting redshift

  • geoclue 2.4.12-2
  • redshift 1.12-1

EDIT: it looks like I get a notification asking me to allow redshift to access location (I'm using XFCE), it works when I accept. I must have missed the notification earlier.

@jonls jonls self-assigned this Sep 16, 2018

@qazip

This comment has been minimized.

qazip commented Oct 20, 2018

@lukehinds, you mean downgrade right? Because I have geoclue-2.4.12-1 and I am still having this problem.

@alxnorden

This comment has been minimized.

alxnorden commented Oct 25, 2018

not using geolocation here, Debian buster/sid.
as suggested in the archwiki, https://wiki.archlinux.org/index.php/Redshift#Manual_setup
I solved by launching
redshift -l 59.33258:18
For your location, you can use http://www.geonames.org/ or an online map serive.
May i suggest that after the GEO permission error message the user is prompted/given the option to enter location manually.

@razor-x

This comment has been minimized.

razor-x commented Oct 25, 2018

I have it working now on systemd using:

@fictionic

This comment has been minimized.

fictionic commented Oct 28, 2018

@razor-x I also needed to add this to redshift-gtk.service

Environment=DISPLAY=:0

Also, what is xresources.service? I don't think I have that.

Once we get this all sorted out, can we make sure some version of these instructions are put in the installation section of the readme, or in the man page, or both?

@razor-x

This comment has been minimized.

razor-x commented Oct 28, 2018

@fictionic It loads my custom Xresources. I put that so all the x11 based stuff that I start with systemd runs after the xresources are loaded. If you don't load your own xresources, then that's not needed.

That Environment option is not needed for me, but it might be depending on how you are using systemd to start X11 apps. Note I am using (systemctl--user).

Anyway, the key is that the /usr/lib/geoclue-2.0/demos/agent starts before redshift-gtk.service.

@dacresni

This comment has been minimized.

dacresni commented Nov 27, 2018

considering that the plasmid for KDE communicates with Geoclue via DBus, I doubt redshift-gtk is necessary for the fix to work. I think you just need to add redshift to geoclue's config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment