Giter Site home page Giter Site logo

Comments (9)

AERDU avatar AERDU commented on August 24, 2024 2

My logs are free from any errors related to ~/.Xauthority. I don't use lightdm, so I suspect lightdm may require Xorg to run with ~/.Xauthority.

ps aux | grep -i xorg returns /usr/lib/Xorg :0 vt2 for me.

I use ly , it probably just runs xinit, which in turn runs /usr/lib/Xorg :0 vt2, which is quite different from the way Xorg was started on your machine.

from nfancurve.

AERDU avatar AERDU commented on August 24, 2024 1

move the .service file to /usr/lib/systemd/system/ instead of /usr/lib/systemd/user/, run systemctl daemon-reload for good meassures, and then load/enable the service with systemctl enable --now nfancurve.service. When you specify --user you run a service file from /usr/lib/systemd/user which has insufficient permission, as it runs it as your current user.

from nfancurve.

AERDU avatar AERDU commented on August 24, 2024

I tried figuring this out yesterday, I think there was another issue opened here which could run it if they ran xorg as root, however it's a pretty ugly workaround. What ended up working for me was adding export DISPLAY=":0" at the top of the shell script, a line after the shebang. I ended up scrapping the old .service file and created another one you run at root:

[Unit]
Description=Nfancurve service
After=multi-user.target

[Service]
ExecStart=/usr/bin/nfancurve -c /etc/nfancurve.conf
KillSignal=SIGINT

[Install]
WantedBy=default.target

The biggest issue with this script is that if you enable the script to run at boot, it will fail. Your graphical environment has to be running before the service will work. There are different options to make this work, depending on what setup you have, here are two options: https://unix.stackexchange.com/questions/397853/how-to-set-a-systemd-unit-to-start-after-loading-the-desktop

I'm using i3, but if you're using a DE you might be able to start it with xsession. My solution is really hacky and would be nice if someone else had a cleaner fix.

**also forgot to add, im using the AUR package, thats why it's called nfancurve instead of temp.sh

from nfancurve.

801k avatar 801k commented on August 24, 2024

AERDU, thank you very much for your answer!

I tried your solution and it works just perfect for service autostarting. But I still have in my log:

Oct 20 12:23:02 v01k-desktop systemd[661]: Started Nfancurve service.
Oct 20 12:23:02 v01k-desktop nfancurve[668]: Number of Fans detected:
Oct 20 12:23:02 v01k-desktop nfancurve[668]: 1
Oct 20 12:23:02 v01k-desktop nfancurve[668]: Number of GPUs detected:
Oct 20 12:23:02 v01k-desktop nfancurve[668]: 1
Oct 20 12:23:02 v01k-desktop nfancurve[722]: ERROR: The current user does not have permission for operation
Oct 20 12:23:02 v01k-desktop nfancurve[722]: Attribute 'GPUFanControlState' (v01k-desktop:0[gpu:0]) assigned value 1.
Oct 20 12:23:02 v01k-desktop nfancurve[668]: Started process for 1 GPU and 1 Fan
Oct 20 12:23:02 v01k-desktop nfancurve[724]: ERROR: The current user does not have permission for operation
Oct 20 12:23:02 v01k-desktop nfancurve[724]: Attribute 'GPUTargetFanSpeed' (v01k-desktop:0[fan:0]) assigned value 35.

As I said, the fan speed level changes well even with this error.

I'm sorry, but I don't understand a little bit this moment that you wrote: "...and created another one you run at root". I'm not very experienced with Linux services and don't understand how to run service with --user as root. Please clarify this moment for me. Thank you!

P.S. I'm also using i3 and the package from AUR.

from nfancurve.

801k avatar 801k commented on August 24, 2024

Oh, thank you! I thought about it, but wasn't sure it is the right way :) And what do you think about why this error appeared after the last Arch update? Could it be related to the latest Nvidia driver?

from nfancurve.

AERDU avatar AERDU commented on August 24, 2024

There's another nvidia fan controller at https://github.com/foucault/nvfancontrol that states:
"As of version 465 NVIDIA decided that is a security risk for non-root users to have access to cooler control and overclocking capabilities. So you will have to start X11 as root despite almost no distributions and desktop environment doing so for the past years because it is a massive... security risk. Trading one security risk for another!"

keep in mind that my solution does NOT start X11 as root (at least it shouldn't unless setting $DISPLAY to :0 in a root session somehow elevates xorg). I'm also not sure why you got it after a recent update, v465 was awhile ago unless you use DKMS or something.

from nfancurve.

801k avatar 801k commented on August 24, 2024

AERDU, thank you very much for clarifying this problem for me. Yes, it is very strange that I got this error after a recent update, because I always update my system, maybe weekly or even more often. But now everything works fine, and then we'll see, maybe the developer will make some changes. Thanks again!

from nfancurve.

AERDU avatar AERDU commented on August 24, 2024

Tiny improvement I made recently, instead of setting the service on a timer I just set it to restart if it exits with an error code:

[Unit]
Description=Nfancurve service
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/nfancurve -c /etc/nfancurve.conf
Restart=on-failure
RestartSec=60s

[Install]
WantedBy=default.target

This should fix the issue instantly, and don't forget to systemctl daemon-reload.

from nfancurve.

HanM23 avatar HanM23 commented on August 24, 2024

Tiny improvement I made recently, instead of setting the service on a timer I just set it to restart if it exits with an error code:

[Unit]
Description=Nfancurve service
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/nfancurve -c /etc/nfancurve.conf
Restart=on-failure
RestartSec=60s

[Install]
WantedBy=default.target

This should fix the issue instantly, and don't forget to systemctl daemon-reload.

Hello, thanks for your help here. I had the same issue too.
I followed what you wrote :

  1. move the .service file to /usr/lib/systemd/system/ instead of /usr/lib/systemd/user/
  2. export DISPLAY=":0" in the shell script.

But i still had the following errors in journalctl

dec. 07 18:33:27 smith sh[49114]: Authorization required, but no authorization protocol specified
dec. 07 18:33:20 smith sh[49087]: Authorization required, but no authorization protocol specified
dec. 07 18:33:20 smith sh[49087]: Authorization required, but no authorization protocol specified
dec. 07 18:33:13 smith sh[49085]: Authorization required, but no authorization protocol specified
dec. 07 18:33:13 smith sh[49085]: Authorization required, but no authorization protocol specified

I resolved it by adding another line in the shell script : export XAUTHORITY='/run/lightdm/root/:0'

Indeed
❯ ps aux | grep Xorg (/run/lightdm/root/:0 is after -auth in the first line)

root        1124  4.1  2.7 25744332 218424 tty7  Ssl+ 12:41  15:29 /usr/lib/Xorg :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
<username>     51551  0.0  0.0   6572  2520 pts/4    S+   18:56   0:00 grep Xorg

I do not really like it, because normally (before the export above) XAUTHORITY was equal to /home/<username>/.Xauthority

EDIT : it also works when i add export XAUTHORITY='/home/<username>/.Xauthority' in the shell script (nfancurve.sh, i also get it from AUR), but i do not really understand what is happening with this XAUTHORITY thing.

Have you faced this issue too ?
Thanks

from nfancurve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.