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.86k stars 424 forks source link

Startup crash if no working DNS #150

Open Jesse-V opened 9 years ago

Jesse-V commented 9 years ago

Yesterday I was fiddling with my machine's DNS settings, and ended up pointing the DNS resolve to an IP that didn't work. I have working Internet access through an SSH tunnel, but otherwise it didn't work.

Steps to reproduce (in Linux Mint 17.1, which uses the Ubuntu 14.04 base):

  1. Ensure that Redshift is not running.
  2. In Network Connections, edit the IPv4 settings of the active Internet connection to "Automatic (DHCP) Addresses Only" then set the DNS to something abnormal, like 127.0.0.5.
  3. In Network Manager, disable the active interface (wifi or LAN), then enable it. Connect to the Internet.
  4. Confirm that DNS lookups fail by running "host www.google.com", which should throw an error.
  5. Start redshift-gtk, either by the menu item, or by typing it in the command-line.
  6. No icon will appear in the panel, the temperature will not auto-adjust, and no information will be shown in the console even with verbosity.

However, "redshift-gtk -O 3500" will change the temperature.

I expected Redshift to remember the current geolocation and work properly.

jonls commented 9 years ago

This is probably related to GeoClue. Please report the output from redshift when reporting bugs since redshift-gtk is simply a wrapper that runs redshift as a child process. Running redshift by itself should provide better hints at what is going on. GeoClue is usually set up to gather location data from a service like http://www.hostip.info/ so that would explain the failure when you disable DNS. Did you by any chance see if you get the same failure just from disconnection from the network completely?

I have recently merged a patch that makes redshift-gtk show an error dialog if something goes wrong with starting up the child process, so the next release should have some better feedback. As a workaround I'll suggest experimenting with redshift while you try to figure out which command line options or configuration file options you want to use and then switch to redshift-gtk when you are satisfied.