How to set fanspeed in Linux from terminal

New here, and I’m sure I have this post in the wrong thread, as I couldn’t find where it would fit.

I’m just trying to find help on how to manually set my fan speed on my Nvidia GPU.
the command:
nvidia-settings -a “[gpu:0]/GPUFanControlState=1” -a “[fan:0]/GPUCurrentFanSpeed=n”
gives a read-only error.

What can I type in terminal?
I’m running Lubuntu 18.10 with Nvidia 418.56 drivers.


Outside my area of expertise, but the various write-up on how to control the fan under Linux one can find on the internet typically state that you need to enable cool bits first before you are able to set fan speed with nvidia-settings. I see different idioms being used. A fairly common one seems to be

nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration

Proceed at your own risk. Why do you want to change the fan speed from the default?

Because I like my GPUs to run cooler.
Under full load they get to the high 70s, but by increasing the fan by 25% they run in the high 60s, which gives better overclocks.

I know in GUI to change fan speed, but I can’t find a headless terminal command for it.

While I believe Cool-bits=4 enables fan speed editing, Cool-bits 28 works as well.
However the gui is needed for that.
I guess I was hoping someone could post a terminal command, to modify fanspeed.
We need a headless (terminal based) variety of nvidia-xsessions at the deep learning and folding community.

I hope NVidia could support us with a terminal command in the next of their driver updates.
Something as simple as:

sudo nvidia-smi -i 0 -f 75

Would suffice!
Just like adjusting the power levels, the above line stating NVidia smi card 0 (main card) set fanspeed at 75% (with values from 0% to 100%.

I’m also annoyed by cards that start thermal throttling before fan speed reaches 100%.

After setting cool-bits to 28 (4 or 31 might work too), you can set fan speed via:
nvidia-settings -a ‘[gpu:0]/GPUFanControlState=1’
nvidia-settings -a ‘[fan:0]/GPUTargetFanSpeed=100’

Edit: I see you used something similar, try “GPUTargetFanSpeed=” instead of “GPUCurrentFanSpeed=”, which is my guess why you got a read-only error!

I’m not sure where you can enter those values, but it doesn’t work in my terminal.
Depending on why you use the GPU, if you have constant high GPU usage (like heavy gaming, or folding or crunching), the best thing you can do, is lower the TDP of the card.
It’ll still throttle the speed, but the card will run much cooler.

For reference, I have an open test bench, with an environment temperature of somewhere between 60-75F, and I can get 90-95% performance out of any RTX card running them at the following settings:

GPU , GPU 2: Running watt +x/-y watts

RTX 2060, 2060 Super: 126W +/-1 Watt
RTX 2070: 129W +4/-2 Watt
RTX 2070 Super, 2080: 144W +/-5 Watt
RTX 2080 Super: 149W +/-7 Watt
RTX 2080 Ti: 166W. +14/-12 Watt

I raise the value by x watts, if the ambient temperature gets closer to 85-90F.
I lower the value by y watts, if the ambient temperature gets closer to 55F.

Lowering the power, reduces heat. When heat goes lower, the driver will increase the boost frequency.
Together with a fine tuned overclock, you can get near to 95% of performance, at 60-75% of the power consumption. I’m not sure why Nvidia tunes for maximum performance, instead of highest efficiency on the RTX line, as these cards run very hot (inside a case), and consume a lot of power.

The performance penalty (~5-10%) is well worth the reduction in heat (20-40C lower temps) and power consumption (25-40% lower per card).

If you have an intermittent performance demand on your card, water cooling is offering a better solution.

I am having similar issue in CentOS7.
[root@XX ~]# nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration

Using X configuration file: “/etc/X11/xorg.conf”.
Option “AllowEmptyInitialConfiguration” “True” added to Screen “Screen0”.
Option “AllowEmptyInitialConfiguration” “True” added to Screen “Screen1”.
Option “AllowEmptyInitialConfiguration” “True” added to Screen “Screen2”.
Option “AllowEmptyInitialConfiguration” “True” added to Screen “Screen3”.
Backed up file ‘/etc/X11/xorg.conf’ as ‘/etc/X11/xorg.conf.backup’
New X configuration file written to ‘/etc/X11/xorg.conf’

[root@XX ~]# nvidia-settings -a ‘[fan:0]/GPUTargetFanSpeed=100’

ERROR: Unable to load info from any available system

Has anyone been successful in pulling the GUI. I cannot get that to work either
[root@XX ~]# nvidia-settings

ERROR: Unable to load info from any available system