Nightthemeswitcher not connecting to Geoclue

For some reason the nightthemeswitcher GNOME extension is not able to connect to the Geoclue service to get location information.

Night Light is able to get the location just fine, and correctly get the appropriate sunset/sunrise times, nightthemeswitcher can’t.

When I look at the logs for the geoclue service, I see these errors:

    May 27 12:57:39 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
    May 27 13:00:06 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
    May 27 13:00:40 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
    May 27 13:01:01 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
    May 27 13:03:13 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
    May 27 13:06:41 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate

What’s the output of:

systemctl status geoclue
systemctl status avahi-daemon.socket
systemctl status avahi-daemon.service

When pasting terminal output, highlight it and use the Preformatted text </> button.

Alternatively, add three backticks ` above and below the text:

```
text
```

Weird, I thought I formatted it right… Sorry about that.

systemctl status geoclue.service
● geoclue.service - Location Lookup Service
     Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static)
     Active: active (running) since Thu 2021-05-27 12:57:13 EDT; 53min ago
   Main PID: 2106 (geoclue)
      Tasks: 3 (limit: 38421)
     Memory: 8.5M
        CPU: 120ms
     CGroup: /system.slice/geoclue.service
             └─2106 /usr/lib/geoclue

May 27 12:57:13 monochrome systemd[1]: Starting Location Lookup Service...
May 27 12:57:13 monochrome systemd[1]: Started Location Lookup Service.
May 27 12:57:39 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
May 27 13:00:06 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
May 27 13:00:40 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
May 27 13:01:01 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
May 27 13:03:13 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
May 27 13:06:41 monochrome geoclue[2106]: Failed to query location: Unacceptable TLS certificate
systemctl status avahi-daemon.socket
● avahi-daemon.socket - Avahi mDNS/DNS-SD Stack Activation Socket
     Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.socket; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-05-27 12:56:57 EDT; 54min ago
   Triggers: ● avahi-daemon.service
     Listen: /run/avahi-daemon/socket (Stream)
     CGroup: /system.slice/avahi-daemon.socket

May 27 12:56:57 monochrome systemd[1]: Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
systemctl status avahi-daemon.service
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-05-27 12:56:57 EDT; 54min ago
TriggeredBy: ● avahi-daemon.socket
   Main PID: 790 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 38421)
     Memory: 1.6M
        CPU: 102ms
     CGroup: /system.slice/avahi-daemon.service
             ├─790 avahi-daemon: running [monochrome.local]
             └─811 avahi-daemon: chroot helper

May 27 12:57:00 monochrome avahi-daemon[790]: Registering new address record for fe80::8647:6029:46b5:5dfc on enp10s0.*.
May 27 12:57:00 monochrome avahi-daemon[790]: Joining mDNS multicast group on interface enp10s0.IPv4 with address 192.168.1.131.
May 27 12:57:00 monochrome avahi-daemon[790]: New relevant interface enp10s0.IPv4 for mDNS.
May 27 12:57:00 monochrome avahi-daemon[790]: Registering new address record for 192.168.1.131 on enp10s0.IPv4.
May 27 12:57:04 monochrome avahi-daemon[790]: Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1.
May 27 12:57:04 monochrome avahi-daemon[790]: New relevant interface docker0.IPv4 for mDNS.
May 27 12:57:04 monochrome avahi-daemon[790]: Registering new address record for 172.17.0.1 on docker0.IPv4.
May 27 12:57:10 monochrome avahi-daemon[790]: Joining mDNS multicast group on interface enp13s0.IPv4 with address 10.0.0.2.
May 27 12:57:10 monochrome avahi-daemon[790]: New relevant interface enp13s0.IPv4 for mDNS.
May 27 12:57:10 monochrome avahi-daemon[790]: Registering new address record for 10.0.0.2 on enp13s0.IPv4.

Related upstream issue:

Yeah, I know haha. I made that issue. The extension developer suggested I ask the Manjaro team.

Ah, figures. I can’t reproduce the issue, it just automatically switched to a light theme since it’s daytime from a manually set dark theme.

What’s the output of:

pacman -Qi gnome-shell gnome-shell-extension-nightthemeswitcher | grep Version
pacman -Qi gnome-shell gnome-shell-extension-nightthemeswitcher | grep Version
Version         : 1:40.1-2
Version         : 50-1

Have you tried setting a manual time source in the extension options?

Of course, setting a manual time in the extension settings works, but I want to debug this issue.

No, a manual time source; i.e., Night Light or Location Services.

Oh, okay. Yeah, as mentioned in the extension issue, using Night Light as a source works, since Night Light does correctly get my location and properly sets the sunset/sunrise time. However, I hate the coloring of the screen that Night Light does, which is why I use Location Services.

However, manually setting Location Services in the extension settings, doesn’t work, it results in the same issue. As the extension developer suggests, based on the extension logs I provided, the extension can’t connect to Geoclue for some reason. Otherwise, I would see the appropriate lines in the log for the extension connecting to Geoclue and getting my location etc.

Apparently geoclue uses a default hardcoded Mozilla key. It probably gets rate limited quickly.

See /etc/geoclue/geoclue.conf:

# URL to the WiFi geolocation service. If not set, defaults to Mozilla's
# Location Service with a hardcoded key. To use a custom key, uncomment this URL
# while changing YOUR_KEY to your MLS API key.
#url=https://location.services.mozilla.com/v1/geolocate?key=YOUR_KEY

# To use the Google geolocation service instead of Mozilla's, uncomment this URL
# while changing YOUR_KEY to your Google API key.
#
# WARNING: Please make sure that you are complying with the Google's ToS and
#          policies if you uncomment this:
#
# https://developers.google.com/maps/documentation/geolocation/policies
#
#url=https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_KEY

Try using the following:

url=https://location.services.mozilla.com/v1/geolocate?key=geoclue

See: Redshift - ArchWiki

After adding the URL, you’ll need to restart the geoclue service:

systemctl restart geoclue

Give it a few minutes then check the status again:

systemctl status geoclue
1 Like