raphaelquintao / QRedshiftCinnamon

Linux Cinnamon applet to change screen color temperature
https://cinnamon-spices.linuxmint.com/applets/view/313
Apache License 2.0
93 stars 12 forks source link

apparmor is blocking QRedshift from working #23

Closed jonorthwash closed 3 years ago

jonorthwash commented 3 years ago

After a recent upgrade of cinnamon, QRedshift has stopped being able to adjust the screen. The applet is running and allows me to update settings, etc., but it doesn't change the screen. In dmesg I have a bunch of messages like this:

[ 1094.020161] audit: type=1400 audit(1611622748.822:128): apparmor="DENIED" operation="open" profile="/usr/bin/redshift" name="/home/jonathan/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf" pid=13790 comm="redshift" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

This appears to be a problem with apparmor. Does anyone have any suggestions for how to get around this issue?

raphaelquintao commented 3 years ago

Never got that problem. Which distro you using?

raphaelquintao commented 3 years ago

Take a look at: https://github.com/jonls/redshift/issues/708

jonorthwash commented 3 years ago

Which distro you using?

Debian sid.

Take a look at: jonls/redshift#708

Not sure what the suggestion is there.

dilinger commented 3 years ago

Take a look at: jonls/redshift#708

Not sure what the suggestion is there.

Seems like the workaround is to add the following line after owner @{HOME}/.config/redshift.conf r, in /etc/apparmor.d/usr.bin.redshift:

owner @{HOME}/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf r,

And then run /etc/init.d/apparmor restart (or reload, and/or using systemctl instead of init.d).

Adding that line and then restarting apparmor made it work for me. I changed #27 to be about the silent failure of qredshift when it runs the redshift command and it fails.

dilinger commented 3 years ago

I wonder if the long-term solution here is to do away with base.conf and ensure that all the proper command-line settings are used when redshift is run?

raphaelquintao commented 3 years ago

I wonder if the long-term solution here is to do away with base.conf and ensure that all the proper command-line settings are used when redshift is run?

I will release a new version today, fixing that.

raphaelquintao commented 3 years ago

Can you guys check if works now with the last version(1.5.3)? Thanks.

dilinger commented 3 years ago

Unfortunately, it's still broken. The commands being run (at least from doCommand()) now don't include -f base.conf, but something else is still using base.conf. I still see the following in my system logs:

Feb 20 19:37:23 e7470 kernel: [374707.291886] audit: type=1400 audit(1613867843.206:503): apparmor="DENIED" operation="open" profile="/usr/bin/redshift" name="/home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf" pid=333943 comm="redshift" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

Whichever command is actually failing is still blocking qredshift from functioning.

raphaelquintao commented 3 years ago

Very strange. I did a clean installation of Debian just to test it and everything works fine now. Try delete everything of the applet, all config and files and download again. Very very strange....

dilinger commented 3 years ago

I tried completely deleting and reinstalling the applet - same thing. Let me see if I can track down what's using base.conf..

raphaelquintao commented 3 years ago

If you can track it will help a lot...

dilinger commented 3 years ago

Okay, here's the debug logs when I reload the applet:

Cjs-Message: 20:48:06.420: JS LOG: [LookingGlass/info] Reloading applet: qredshift@quintao/43 Cjs-Message: 20:48:06.421: JS LOG: [LookingGlass/warning] "QRedshift - REMOVED FROM PANEL" Cjs-Message: 20:48:06.485: JS LOG: [LookingGlass/warning] "on_applet_removed_from_panel Util.spawnCommandLine(redshift -x -c /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf)" Cjs-Message: 20:48:06.537: JS LOG: [LookingGlass/warning] "QRedshift" Cjs-Message: 20:48:06.625: JS LOG: [LookingGlass/warning] "redShiftUpdate Util.spawnCommandLine(redshift -x -c /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf)" Cjs-Message: 20:48:06.631: JS LOG: [LookingGlass/warning] "QRedshift - ADDED TO PANEL" Cjs-Message: 20:48:06.631: JS LOG: [LookingGlass/info] Loaded applet qredshift@quintao in 139 ms

raphaelquintao commented 3 years ago

Good. I will take a look here, if something still using it i will fix it. Thanks a lot...

raphaelquintao commented 3 years ago

I think I fixed it now in version 1.5.4. Can someone confirm please?