The problem when adjusting my dual RTX 4090 in Ubuntu Server 23.10 is, when running nvidia-settings
its trigger error
ERROR: The control display is undefined; please run `nvidia-settings --help`
for usage information.
I’ve been search on internet and not found a better solution, then I decided try to install X and attached, while running nvidia-setting
. The result its works. Here are the step by step on how to enable GPU fan speed in Ubuntu Server 23.10
- Install XServer
sudo apt install -y xorg xinit
2. Give permission to run X for user
Edit the file and change console
into anybody
to give permission to running X and add permission. This also needed for Ubuntu 23.10 Desktop as well
sudo vim /etc/X11/Xwrapper.config
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
# dpkg-reconfigure xserver-xorg-legacy
allowed_users=anybody
needs_root_rights=yes
Reboot!
If you don’t change this, it will trigger error.
/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server
3. Run X and export display (excute each line)
No root access required.
X :1 &
export DISPLAY=:1
4. Now you can execute adjusting fan speed using nvidia-settings
without problem on Ubuntu without X.
No root access required.
Adjust for 50% speed. This is for dual GPU
#!/bin/bash
nvidia-settings -a "[gpu:0]/GPUFanControlState=1"
nvidia-settings -a "[fan:0]/GPUTargetFanSpeed=30"
nvidia-settings -a "[fan:1]/GPUTargetFanSpeed=30"
nvidia-settings -a "[gpu:1]/GPUFanControlState=1"
nvidia-settings -a "[fan:2]/GPUTargetFanSpeed=30"
nvidia-settings -a "[fan:3]/GPUTargetFanSpeed=30"
#!/bin/bash
# Check if an argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <fan_speed>"
echo "Please provide a fan speed percentage (0-100)."
exit 1
fi
# Validate input (must be a number between 0 and 100)
if ! [[ "$1" =~ ^[0-9]+$ ]] || [ "$1" -lt 0 ] || [ "$1" -gt 100 ]; then
echo "Error: Fan speed must be an integer between 0 and 100."
exit 1
fi
FAN_SPEED=$1
FAN_SPEED_TWO=$2
# Set fan control state and speed for all fans on gpu:0
echo "Setting fan speed to $FAN_SPEED% for GPU 0..."
nvidia-settings -a "[gpu:0]/GPUFanControlState=1"
nvidia-settings -a "[fan:0]/GPUTargetFanSpeed=$FAN_SPEED"
nvidia-settings -a "[fan:1]/GPUTargetFanSpeed=$FAN_SPEED"
echo "Setting fan speed to $FAN_SPEED_TWO% for GPU 1..."
nvidia-settings -a "[gpu:1]/GPUFanControlState=1"
nvidia-settings -a "[fan:2]/GPUTargetFanSpeed=$FAN_SPEED_TWO"
nvidia-settings -a "[fan:3]/GPUTargetFanSpeed=$FAN_SPEED_TWO"
echo "Fan speed set to $FAN_SPEED% and $FAN_SPEED_TWO% for both GPUs."
Too HOT? reduce the power consumption by
sudo nvidia-smi -i 0 -pl 250
sudo nvidia-smi -i 1 -pl 250
Hope its help you and have a great day!
If you logout and need to re-connect, you just export the display. First check whether X is running

$ ps aux | grep X
root 2681 0.1 0.0 25362060 66584 tty2 Ssl+ 08:56 0:03 /usr/lib/xorg/Xorg :1
user 5163 0.0 0.0 7048 1920 pts/1 S+ 09:56 0:00 grep --color=auto X
Then you can export it
export DISPLAY=:1