FAN Control Ubuntu 18.04

Hello,

I would like to change the FAN Speed Profile on Ubuntu 18.04. I have not found a working method.

I have GTX 1080 TI Founder Edition and current driver is 390.77.
When I run

nvidia-settings -a '[gpu:0]/GPUFanControlState=1' -a '[fan:0]/GPUTargetFanSpeed=99'

it just returns

ERROR: Error assigning value 99 to attribute 'GPUTargetFanSpeed' (DLBox:1[fan:0]) as specified in assignment
       '[fan:0]/GPUTargetFanSpeed=99' (Unknown Error).

I am doing deep learning and the temperature goes high to 80-85 degrees and it smells also.

Found the solution. I had to run the following first and restart

sudo nvidia-xconfig -a --cool-bits=28

But I have another question. After reboot, The GPU control the FAN automatically. Then If I set the fan speed manually via

nvidia-settings -a '[gpu:0]/GPUFanControlState=1' -a '[fan:0]/GPUTargetFanSpeed=99'

It works as it should. But when I set

nvidia-settings -a '[gpu:0]/GPUFanControlState=0'

afterward, now the Nvidia X Server Settings does not update the FAN Speed although it is possible to see in Nvidia-smi that the fan speed is still changing.

By the way I updated to 396 driver.

This worked for me, no need to add a xorg.conf file.

Find /usr/share/X11/xorg.conf.d/10-nvidia.conf

Add the coolbits option there and now looks like this:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
<b>    Option "Coolbits" "28"</b>
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

@hhacvv Thanks, your solution is the only working one I found for Ubuntu 18.04 as the xorg.conf method resulted in not being able to log in and didn’t work at all due to deprecation. However with your method fan control only works on one of my GPUs, any ideas how I can apply it to others? I have been stuck on this all day trying pretty much everything Google has to offer.

Section 7 on this link might help. There is something about enabling all house, I only have one card so, I cannot try it.

https://wiki.archlinux.org/index.php/NVIDIA/Tips_and_tricks#Displaying_GPU_temperature_in_the_shell