7

I have noticed that redshift does not work anymore on my machine with Linux Mint 21.3. I am sure that about half a year ago it was still working (that could be under Linux Mint 21.2 though). Trying to debug this, I found out that the problem must be with geoclue:

$ redshift
Trying location provider `geoclue2'...
Using provider `geoclue2'.
Could not connect to wayland display, exiting.
Failed to start adjustment method wayland.
Trying next method...
Using method `randr'.
Waiting for initial location to become available...
^Cpoll: Interrupted system call
Unable to get location from provider.

(I do not know why it talks about wayland, it is not a wayland session.)

Executing /usr/libexec/geoclue-2.0/demos/where-am-i from geoclue-2-demo package just times out after a while without any output or error. (Sometimes it did produce some error message about something missing IIRC, but I could not reproduce it reliably.)

Here is the status of geoclue.service:

$ systemctl status geoclue.service | cat
● geoclue.service - Location Lookup Service
     Loaded: loaded (/lib/systemd/system/geoclue.service; static)
     Active: active (running) since Sat 2024-06-15 13:53:51 CEST; 7min ago
   Main PID: 2434 (geoclue)
      Tasks: 4 (limit: 18810)
     Memory: 19.1M
        CPU: 424ms
     CGroup: /system.slice/geoclue.service
             └─2434 /usr/libexec/geoclue

Jun 15 13:53:51 Alexey-InfinityBook-Mint systemd[1]: Started Location Lookup Service.
Jun 15 13:54:12 Alexey-InfinityBook-Mint geoclue[2434]: Failed to query location: Not Found
Jun 15 13:54:17 Alexey-InfinityBook-Mint geoclue[2434]: Failed to query location: Not Found
[...]

Googling "geoclue.service Failed to query location Not Found" did not return anything relevant on the top of the search results.

I have the same problem (at least it looks the same) under LMDE 6 (Linux Mint Debian Edition).

Any help will be appreciated.

1

1 Answer 1

10

The underlying issue is that Redshift relies on GeoClue to get information about the location of the machine to determine at what time the night mode should be applied. GeoClue gets this information via a web request to a location service. By default, it uses Mozilla Location Services, which has been discontinued in April 2024. The URL it tries to query (https://location.services.mozilla.com/v1/geolocate) returns a status of 404 Not Found at this time, which is the reason for the error you are seeing in your log file. There is a bug report about this on the GeoClue bug tracker, but so far it is unresolved.

Going forward, there are two ways to work around this:

Configuring a different location provider for GeoClue

You can set a custom location provider for GeoClue in the configuration file at /etc/geoclue/geoclue.conf. Currently, Mozilla Location Services and Google Geolocation API seem to be supported. As the first one has been retired, only the Google option seems to be a viable alternative for now.

Looking at the documentation, you need to get a Google API key. It seems to me like this is a paid service and I have not tested it.

Configuring the location manually in the Redshift configuration

Redshift accepts a configuration file which you can use to set a static location. They provide a sample configuration file which has all the possible options. You need to change the lines with lat and lon to your own latitude and longitude.

Note: If you are using AppArmor (which seems to be the default in Linux Mint), there is currently a bug in the AppArmor profile for Redshift. For your configuration file to be readable by Redshift, it must be placed at ~/.config/redshift.conf and not at ~/.config/redshift/redshift.conf as suggested by the Redshift documentation.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.