GPU Fan speed control in Ubutu Server without "nvidia-setting"

Hi,

I have RTX 2080 TI GPUs on my Server (OS: Ubuntu 20.04 Sever version). I cannot install “Nvidia-settings” because my OS doesn’t suppurt GUI. My goal is to control GPU FAN Speed using “nvidia-smi” command or any app that you recommend. The GPUs are running hot because I cannot raise the fan speed (RPM). I can however limit the power to 170 using “sudo nvidia-smi -pl 170” command, but still the GPU are hot because the fan speed is on 35% and I cannot change that. Is there any command or app that I can use to control the fan speed. Again, installing “nvidia-settings” is not an option for my Ubuntu Server OS.

Short answer: no
Fan speed is set through the NVCTRL X extension, obviously needing an Xserver running (as root).
Since you’re running headless, please make sure nvidia-persistenced is running.

I don’t remember where I found this script, but it prevents my old mining rig with 11x GeForce 1060 6GB + 2x TESLA P40 from melting when finetuning AI models.
./fan-control.sh 100 - Sets all fans to full speed

fan-control.sh

#!/bin/bash

# Desired fan speed (as a percentage, e.g., 60 for 60%)
FAN_SPEED=$1

# Enable manual fan control
sudo nvidia-smi -pm 1 # Enables persistence mode
sudo nvidia-settings -a "[gpu:0]/GPUFanControlState=1"

# Get the number of GPUs
NUM_GPUS=$(nvidia-smi -L | wc -l)

# Set the fan speed for each GPU
for (( GPU_ID=0; GPU_ID<NUM_GPUS; GPU_ID++ ))
do
    sudo nvidia-settings -c gpu -a "[fan:$GPU_ID]/GPUTargetFanSpeed=$FAN_SPEED"
done

echo "Fan speed set to $FAN_SPEED% for all $NUM_GPUS GPUs."