Giter Site home page Giter Site logo

redfan's Introduction

Installation instructions

  1. Download zip archive of the main branch
wget -c https://github.com/nmtitov/redfan/archive/main.zip -O redfan-main.zip && sudo apt install unzip -y && unzip redfan-main.zip && cd redfan-main
  1. Copy script to /usr/bin/
cp redfan /usr/bin/
  1. Copy systemd service definition
cp redfan.service /etc/systemd/system/
  1. Run script
sudo systemctl start redfan
  1. Enable autostart of the script
sudo systemctl enable redfan
  1. Check if everything is ok
sudo systemctl status redfan

Description

I'm trying to lock RPM of my AMD Radeon videocard fans at the full speed:

echo 1 > /sys/class/hwmon/hwmon1/pwm1_enable
echo 255 > /sys/class/hwmon/hwmon1/pwm1

What I have tried so far

Obviously, it doesn't work due to missing permissions (even with sudo/root) because it is /sys:

$ sudo su
$ echo 255 > /sys/class/drm/card1/device/hwmon/hwmon1/pwm1
bash: echo: write error: Invalid argument

I have also tried sysfs config to edit these params but it didn't work:

$ cat /etc/sysfs.conf
class/drm/card1/device/hwmon/hwmon1/pwm1 = 255
class/drm/card1/device/hwmon/hwmon1/pwm1_enable = 1

echo 5 | sudo tee ... also doesn't work.

Neither does sudo sh -c:

sudo sh -c 'echo 225 > /sys/class/drm/card1/device/hwmon/hwmon1/pwm1'
sh: 1: echo: echo: I/O error

Archilinux Wiki states it should be possible though https://wiki.archlinux.org/index.php/fan_speed_control#Configuration_of_manual_control They edit values directly with echo and looks like it works for them.

Another guide also recommends configuring fans this way https://linuxconfig.org/overclock-your-radeon-gpu-with-amdgpu

Python amdgpu-fan package also doesn't work for me.

sudo fancontrol doesn't work as well:

$ sudo fancontrol
Loading configuration from /etc/fancontrol ...

Common settings:
  INTERVAL=10

Settings for hwmon1/pwm1:
  Depends on hwmon1/temp1_input
  Controls 
  MINTEMP=10
  MAXTEMP=60
  MINSTART=50
  MINSTOP=0
  MINPWM=0
  MAXPWM=255
  AVERAGE=1

Enabling PWM on fans...
Starting automatic fan control...
/usr/sbin/fancontrol: line 649: echo: write error: Invalid argument
Error writing PWM value to /sys/class/hwmon/hwmon1/pwm1
Aborting, restoring fans...
Verify fans have returned to full speed

Daemon (service) also doesn't work:

fancontrol[1877]:   MAXPWM=255
fancontrol[1877]:   AVERAGE=1
fancontrol[1877]: Enabling PWM on fans...
fancontrol[1877]: Starting automatic fan control...
fancontrol[1877]: /usr/sbin/fancontrol: line 649: echo: write error: Invalid argument
fancontrol[1877]: Error writing PWM value to /sys/class/hwmon/hwmon1/pwm1
fancontrol[1877]: Aborting, restoring fans...
fancontrol[1877]: Verify fans have returned to full speed
systemd[1]: fancontrol.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: fancontrol.service: Failed with result 'exit-code'.

To sum up: seems that I can't edit /sys/ amdgpu-related entries at all

Part 2

It seems that there has to be another way around, like some amdgpu config or something like that. Maybe override kernel-defined values during boot?

In Windows, it's possible to tune fans directly from the AMD Radeon driver GUI app.

I don't want fancy curves, I'm simply trying to force lock static RPM (full-on mode). I'm using amdgpu-pro drivers, Ubuntu 20.04. I'd like to avoid using scripts like fancontrol

The question itself

I wonder if that's possible just to set pwm1_enable to 1 and pwm1 to 255? Looks like the suggested method should be working, but Ubuntu 20.04 security limitations are more restrictive than other distros' ones.

update This thing works! But only for 1-2 seconds, after that, fans go back to system-defined speed https://github.com/DominiLux/amdgpu-pro-fans/blob/master/amdgpu-pro-fans.sh

update 2

Disabling pwm works for about 1-2 seconds. echo 0 > /sys/class/hwmon/hwmon1/pwm1_enable

But after that, some daemon reverts this value back to 2. How could I prevent it from changing by other users except me? E.g. prevent it from changing by the system?

https://unix.stackexchange.com/questions/627182/how-to-lock-fan-speed-for-amd-gpu-in-ubuntu-20-04

redfan's People

Contributors

nmtitov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

redfan's Issues

card0/card1

I couldn't get it to run at first, getting

Mar 10 20:45:44 Tux redfan[5918]: /usr/bin/redfan: line 4: /sys/class/drm/card1/device/hwmon/hwmon1/pwm1_enable: No such file or directory

as the error.

After manually checking my directory structure in the line in redfan, I discovered that my "card1" is actually "card0"

so I changed this in the script after stopping the service, and saved the new location, and restarted the service, and VOILA!
My fan is now running without stopping. :)

Don't work and try on one fan only

Hi,

I just install redfan as write in installation instruction, and I don't any issue : well installed, and well running.

Now, when I do redfan :

  • Even with "CTRL + C" I always receive print log
  • Print log say that it can find folder after /sys/class/drm/card1/device/ (so, can't find hwmon)

How can I fix both ?
And such as I receive log message for only one fan, it doesn't manage all others fans ?

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.