Redshift doesn't work

The application redshift doesn’t work, it displays error messages constantly as can be seen on the pictures attached, can anyone help me? I am using Lubuntu 24.04, I never had this issue on Lubuntu 18.04, nor on Linux Mint.



In case there is already a file named ‘redshift.conf’ in the local directory ‘.config’ please show us its content.

Oh, well, this is fun.

So as you can see from that error, the default method of getting the location is through geoclue2. The package is installed by default and is hardcoded with a special API key to use Mozilla Location Services by default. This has worked just fine for years.

The unfortunate thing is that Mozilla announced in March that they would be retiring the service, which is slated to be reduced in functionality until it is finally taken completely down in July. Because of this, it is only recently that this is being changed. In fact, the relevant change in geoclue2 isn’t even merged into the codebase, let alone is it released at all. As you can see, their plan is to suggest people use Google, which will require not only trusting them with your location, but also registering your own API key.

It’s that very thing that you will want to do if you want to have a dynamically changing setup. You just need to get an API key from Google and to edit /etc/geoclue/geoclue.conf. The instructions are in the aforementioned merge request for the config file:

# To use the Google geolocation service, 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

After doing that, make sure to sudo service geoclue restart. And then you can start Redshift.

A better way to go, I think, though it will mean a more static setup is to set the location manually in ~/.config/redshift.conf:

[redshift]
location-provider=manual

[manual]
lat=40.6893129
lon=-74.0445531

and then start Redshift.

In case you’re wondering, the choice of latitude and longitude was not random. The geoclue manpage offers this as an example for setting a manual location at the Statue of Liberty. It is technically possible to do this as well, but since you also need to add altitude and accuracy radius, this is a little more complicated.

If you want to get your latitude and longitude easily, you can use the Ubuntu GeoIP service. Unfortunately, you can’t use this with geoclue or redshift. Geoclue requires a JSON input and this is XML and redshift isn’t set to use anything except geoclue or a manual set up.

3 Likes

To be honest, I don’t really know how to edit that conf file… The developer of Redshift should be informed of this imo to release an update. The eyes of Linux users are at stake here.

I cannot find ~/.config/redshift.conf , how can I open it?

1 Like

The .conf file I created back in 2015 for 15.04 & 14.04 LTS still works today on my current Lubuntu oracular system (ie. what will be 24.10 on release), as well as boxes using 24.04 LTS, 23.10 & 22.04.

My .conf contains a little more than what @wxl mentioned (I’ve hard coded gamma-day, gamma-night values etc), but essentially its the same, with the major difference being my location.

I’m still living in the same city I was as in 2015, thus I’ve not needed to change my lat/lon.

The standard Ubuntu wiki page on configuration can be found at Redshift - Community Help Wiki

2 Likes

featherpad ~/.config/redshift.conf would open it in case it already exists.

Addendum:
Otherwise it can be created by
cd ~/.config
touch redshift.conf
featherpad redshift.conf
Now you can insert the code given by wxl in post # 3 with latitude and longitude adapted to your location.

3 Likes

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

In case It’s not obvious from my description, upstream developers are doing the best they can do. There is no longer any solution that doesn’t require registering an API key. Thus, there is no way to have Redshift work out of the box. It’s just not possible.

4 Likes