zocker-160 / thinkfan-ui

A small gui app for Linux to control the fan speed and monitor temps on a ThinkPad
GNU General Public License v3.0
88 stars 8 forks source link

Full crash when attempting to set fan speed (Or really interact with anything) #3

Closed EidolonForgery closed 2 years ago

EidolonForgery commented 2 years ago

Steps to reproduce:

  1. Launch Thinkfan-UI. Because the program demands you run it as root, we use sudo.
    bash-5.1$ sudo thinkfan-ui

    At this point the UI pops up and looks okay. But after trying to set fan speed to auto:

    
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    set speed: auto
    OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/thinkfan-ui/fan.py", line 29, in self.button_auto.clicked.connect(lambda: self.setFanSpeed("auto")) File "/usr/lib/thinkfan-ui/fan.py", line 133, in setFanSpeed with open(PROC_FAN, "w+") as soc: OSError: [Errno 22] Invalid argument /usr/bin/thinkfan-ui: line 3: 20209 Aborted python3 /usr/lib/thinkfan-ui/fan.py "$@"

And after trying to manually set the fan speed: 

bash-5.1$ sudo thinkfan-ui QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' set speed: 3 OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/thinkfan-ui/fan.py", line 28, in self.button_set.clicked.connect(lambda: self.setFanSpeed(self.slider.value())) File "/usr/lib/thinkfan-ui/fan.py", line 133, in setFanSpeed with open(PROC_FAN, "w+") as soc: OSError: [Errno 22] Invalid argument /usr/bin/thinkfan-ui: line 3: 20713 Aborted python3 /usr/lib/thinkfan-ui/fan.py "$@"


Both of these errors are printed in the terminal it was launched from, and the UI window instantly vanishes.
zocker-160 commented 2 years ago

thanks for the bug report, please tell me your OS and python version

EDIT: and where you installed it from ;)

EidolonForgery commented 2 years ago

Hi. I'm running Artix-Linux (which should be, in 99% of cases, indistinguishable from regular Archlinux)

Python 3.10.2 and installed from AUR yesterday.

zocker-160 commented 2 years ago

weird, I sadly cannot reproduce this on Archlinux :(

zocker-160 commented 2 years ago

could you try launching it directly?

sudo python3 /usr/lib/thinkfan-ui/fan.py

EidolonForgery commented 2 years ago

I don't know why. I am not sure I even want to know why. But that fixes it.

zocker-160 commented 2 years ago

I think your bash does not like the "$@" argument of the starter script that gets called when you run thinkfan-ui like you did

can you please try removing that inside /usr/bin/thinkfan-ui and try running it again as you did originally?

zocker-160 commented 2 years ago

@JadeThaum I just pushed an update to AUR which should fix this issue, could you try that out?

EidolonForgery commented 2 years ago

I can confirm that this fixed the issue. Thank you, and well done!

apoorv569 commented 1 year ago

Hi, I just installed this from AUR, I'm on Artix Linux as well. I get the same error,

  sudo thinkfan-ui
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
set speed: full-speed
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/thinkfan-ui/fan.py", line 182, in <lambda>
    self.button_full.clicked.connect(lambda: app.setFanSpeed("full-speed"))
  File "/usr/lib/thinkfan-ui/fan.py", line 158, in setFanSpeed
    with open(PROC_FAN, "w+") as soc:
OSError: [Errno 22] Invalid argument
/usr/bin/thinkfan-ui: line 3: 19977 Aborted                 python3 /usr/lib/thinkfan-ui/fan.py "$@"

I get error even if I do sudo python3 /usr/lib/thinkfan-ui/fan.py

  sudo python3 /usr/lib/thinkfan-ui/fan.py
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
set speed: full-speed
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/thinkfan-ui/fan.py", line 182, in <lambda>
    self.button_full.clicked.connect(lambda: app.setFanSpeed("full-speed"))
  File "/usr/lib/thinkfan-ui/fan.py", line 158, in setFanSpeed
    with open(PROC_FAN, "w+") as soc:
OSError: [Errno 22] Invalid argument
zsh: IOT instruction  sudo python3 /usr/lib/thinkfan-ui/fan.py
zocker-160 commented 1 year ago

The first error is the same as the one that was originally reported here, as that the "$@" causes an issue for whatever reason.

Sadly I did have to put it back in, because I added cli flags and those only work when I pass them from the starter script to the main application.

As for the second one, I sadly have no idea what zsh: IOT instruction is and it is the first time I see it.

Since you also seem to be on Artix Linux, I kinda feel it might be related as, from my testing, everything works on regular Arch Linux.

apoorv569 commented 1 year ago

The first error is the same as the one that was originally reported here, as that the "$@" causes an issue for whatever reason.

Sadly I did have to put it back in, because I added cli flags and those only work when I pass them from the starter script to the main application.

As for the second one, I sadly have no idea what zsh: IOT instruction is and it is the first time I see it.

Since you also seem to be on Artix Linux, I kinda feel it might be related as, from my testing, everything works on regular Arch Linux.

A quick search online suggests, "IOT is an error message that can be encountered in the Z shell (zsh). It stands for Input/Output Trap, which is an error that is thrown when there is a failure to perform some input/output operation in the shell. It typically occurs when there is an issue with the syntax or a problem with the command being executed. To resolve the issue, you may need to correct the syntax or command that is causing the problem."