jonls / redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.
http://jonls.dk/redshift
GNU General Public License v3.0
5.82k stars 425 forks source link

On a wired connection geoclue is unable to determine current location #805

Open JDuchniewicz opened 3 years ago

JDuchniewicz commented 3 years ago

Describe the bug On a wired connection geoclue is unable to determine current location. It prompts an error. The cause for that is upstream and can be viewed here. Because I am not familiar with programming with GNOME applications I am posting this issue, so maybe someone with expertise in it will look and give the folks at freedesktop a hand.

To Reproduce Steps to reproduce the behavior:

  1. Connect Ethernet cable to the device
  2. Launch redshift

Expected behavior Normal behavior and no errors

Error output/logs/screenshots

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.

Software versions (please complete the following information):

CSRaghunandan commented 3 years ago

I'm also having the same issue. Except, geoclue is unable to determine location on any network, wired or wireless.

williamson91 commented 3 years ago

It looks like we all have the same problem. After a recent update, I get this error:

$ env LANGUAGE=en_US.UTF-8 redshift 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.
$ inxi -F System: Host: debian-home Kernel: 4.19.0-14-amd64 x86_64 bits: 64 compiler: gcc v: 8.3.0 Desktop: Gnome 3.30.2 Distro: Debian GNU/Linux 10 (buster) Machine: Type: Desktop Mobo: MSI model: B75MA-E33 (MS-7808) v: 1.0 serial: BIOS: American Megatrends v: 1.0 date: 06/12/2012 CPU: Topology: Dual Core model: Intel Core i3-2120 bits: 64 type: MT MCP arch: Sandy Bridge rev: 7 L2 cache: 3072 KiB flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 26341 Speed: 1596 MHz min/max: 1600/3300 MHz Core speeds (MHz): 1: 1596 2: 1596 3: 1597 4: 1596 Graphics: Device-1: NVIDIA GK106 [GeForce GTX 650 Ti] vendor: ASUSTeK driver: nvidia v: 418.181.07 bus ID: 01:00.0 Display: x11 server: X.Org 1.20.4 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa resolution: 1024x768~60Hz OpenGL: renderer: GeForce GTX 650 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA 418.181.07 direct render: Yes Audio: Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Micro-Star MSI driver: snd_hda_intel v: kernel bus ID: 00:1b.0 Device-2: NVIDIA GK106 HDMI Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 01:00.1 Sound Server: ALSA v: k4.19.0-14-amd64 Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Micro-Star MSI driver: r8169 v: kernel port: d000 bus ID: 03:00.0 IF: enp3s0 state: down mac: Device-2: Ralink MT7601U Wireless Adapter type: USB driver: mt7601u bus ID: 3-1.5:3 IF: wlx00e917022dc1 state: up mac: Drives: Local Storage: total: 1.13 TiB used: 365.54 GiB (31.6%) ID-1: /dev/sda vendor: Kingston model: SA400S37240G size: 223.57 GiB ID-2: /dev/sdb vendor: Western Digital model: WD5000AAKX-60U6AA0 size: 465.76 GiB ID-3: /dev/sdg type: USB vendor: Western Digital model: WD Elements 25A2 size: 465.73 GiB Partition: ID-1: / size: 136.51 GiB used: 19.53 GiB (14.3%) fs: ext4 dev: /dev/sdb2 ID-2: /home size: 316.28 GiB used: 69.19 GiB (21.9%) fs: ext4 dev: /dev/sdb3 ID-3: swap-1 size: 3.72 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sdb1 Sensors: System Temperatures: cpu: 36.0 C mobo: N/A gpu: nvidia temp: 35 C Fan Speeds (RPM): N/A gpu: nvidia fan: 10% Info: Processes: 248 Uptime: 24m Memory: 7.73 GiB used: 2.08 GiB (26.9%) Init: systemd runlevel: 5 Compilers: gcc: 8.3.0 Shell: zsh v: 5.7.1 inxi: 3.0.32
vsedov commented 3 years ago

So there are two workarounds that i saw about this : /usr/lib/geoclue-2.0/demos/agent & If you run tihs beforehand , or have some script that launches this on boot , redshift should work again, the annoying thing was the recommended solution for this issue which was :

[redshift]
allowed=true 
system=false
users=

in your geoclue.conf did not work , though the script method , where you have agent & [and] redshift - that should work

the second one, could just be manual config , where you do redshift -l Location

For me currently i just made a quick script that runs on boot , and it works fine : ) hope that helped out .

williamson91 commented 3 years ago

I decided to manually create the file ~/.config/redshift/redshift.conf Followed instructions on https://wiki.archlinux.org/index.php/Redshift It's strange that this worked without problems for several months without manual intervention. And then suddenly it broke.

JDuchniewicz commented 3 years ago

Using the same solution as @williamson91. The commits that introduced the regression upstream clearly show why it regressed. However, repairing it may be more convolved.

WeibingChen17 commented 3 years ago

I met this issue in a wireless network and decided to switch the manual geolocation. I think the dependency on geoclue2 is good for automation, but we need a safe fallback if the service fails. If possible, we can consider saving the lat and long in the config when the geoclue2 works. Later when the service fails, just use them as a fallback