Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redshift.conf is not read if it is a symlink #858

Closed
1 task done
andornaut opened this issue Dec 28, 2021 · 3 comments
Closed
1 task done

redshift.conf is not read if it is a symlink #858

andornaut opened this issue Dec 28, 2021 · 3 comments

Comments

@andornaut
Copy link

andornaut commented Dec 28, 2021

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. ln -s $PATH_TO_REDSHIFT_CONFIG ~/.config/redshift.conf
  2. Start redshift redshift -v

Expected
The settings in the configuration ~/.config/redshift.conf are used.
Actual
The configuration file is ignored.

Context
I use a dotfile manager named "gog" to save redshift.conf to ~/.local/share/gog/.../redshift.conf, which is then symlinked to ~/.config/redshift.conf. This used to work, but upon upgrading redshift recently this no longer works as expected. I was using the version of redshift distributed with Ubuntu 20.04, and am now using the version distributed with 21.10: 1.12-4.2ubuntu1.

Example where the configuration file is ignored.

$ ls -l ~/.config/redshift.conf
lrwxrwxrwx 1 andornaut andornaut 70 Dec 28 10:00 redshift.conf -> '/home/andornaut/.local/share/gog/andornaut/$HOME/.config/redshift.conf'
...

$ redshift -v
Trying location provider `geoclue2'...

I use the manual location provider, not geoclue2. This symlink scenario does not work.

On the otherhand, the configuration file is used when the configuration file is not a symlink:

$ ls -l ~/.config/redshift.conf
-rw-rw-r-- 1 andornaut andornaut 294 Dec 28 09:55 /home/andornaut/.config/redshift.conf

$ redshift -v
Solar elevations: day above 3.0, night below -6.0

The no-symlink scenario above works as expected.

Additionally, using the -c flag doesn't appear to work at all:

$ chmod 644 redshift.conf
$ ls -l redshift.conf
-rw-r--r-- 1 andornaut andornaut 312 Dec 28 10:15 redshift.conf

$ redshift -c redshift.conf
fopen: Permission denied
Unable to load config file.

Software versions (please complete the following information):

  • OS: Linux
  • Redshift version: redshift 1.12
  • Distribution: Ubuntu 21.10
  • Redshift installed from: "using apt-get"
@mkapalka
Copy link

I had the same issue but in the end the problem was not with Redshift but with an Apparmor profile for Redshift that was blocking access to files outside of the default Redshift config directory. The solution is to create a local override of the profile:

sudo vi /etc/apparmor.d/local/usr.bin.redshift

add this line:

owner @{HOME}/.../redshift.conf r,

(you need to put the correct path above) Then reload Apparmor configuration:

sudo systemctl reload apparmor

I tested this on Debian but it should work also for Ubuntu.

@andornaut
Copy link
Author

Thanks @mkapalka!

@ghost
Copy link

ghost commented Aug 25, 2022

I had the same issue but in the end the problem was not with Redshift but with an Apparmor profile for Redshift that was blocking access to files outside of the default Redshift config directory. The solution is to create a local override of the profile:

sudo vi /etc/apparmor.d/local/usr.bin.redshift

add this line:

owner @{HOME}/.../redshift.conf r,

(you need to put the correct path above) Then reload Apparmor configuration:

sudo systemctl reload apparmor

I tested this on Debian but it should work also for Ubuntu.

For some reason
Reloading apparmor didn't work
I had to reboot my system to make the changes take effect
Any explanations why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants