Posted: . At: 11:51 AM. This was 3 years ago. Post ID: 14811
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

How to enable Nvidia fan control on Ubuntu 20.04. This is very easy.

Setting the GPU fan speed on Linux is very important if a user wants to participate in gaming and not have a burning smell come from their GPU. I have found a way to get this working and it is very simple.

Run this command to create a basic Xorg configuration to enable the setting we require.

┌──[jason@192.168.1.2][~]
└──╼  ╼ $ sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration

This creates a new /etc/X11/xorg.conf file that contains the required settings.

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    Option         "Coolbits" "28"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Then log out of the desktop session to GDM and then back in. Then the fan speed option should be available in Nvidia settings.

The above section of the xorg.conf has the Option "Coolbits" "28" option that will enable the Nvidia settings GUI to unlock the fan speed selection. Then set an appropriate fan speed for the GPU. 50% should be fine.

This is very simple and causes no issues. On Windows, you use MSI Afterburner to set the fan properties and monitor the temperature, but on Linux, you have Nvidia settings utility. So the ability to set the fan speed is necessary and it is very strange that this is not available unless you have configured a Xorg.conf file that is not even required anymore. But at least this setting works and allows a user to control something as simple as the speed of the GPU fan. The good thing about Linux is that there is always a good fix for a problem you encounter.

The fan speed of your Nvidia card may also be controlled with the command line. This is quick and easy to do.

┌──[jason@192.168.1.2][~/Documents]
└──╼  ╼ $ nvidia-settings -a [fan:0]/GPUTargetFanSpeed=32
 
  Attribute 'GPUTargetFanSpeed' (jason-desktop:1[fan:0]) assigned value 32.

This command will return information about the GPU temperature. This is very useful to keep track of the temperature of the card whilst running intensive tasks using the GPU.

┌──[jason@192.168.1.2][~/Documents]
└──╼  ╼ $ nvidia-smi -q -d temperature
 
==============NVSMI LOG==============
 
Timestamp                           : Tue Dec  8 08:55:20 2020
Driver Version                      : 440.100
CUDA Version                        : 10.2
 
Attached GPUs                       : 1
GPU 00000000:04:00.0
    Temperature
        GPU Current Temp            : 31 C
        GPU Shutdown Temp           : 102 C
        GPU Slowdown Temp           : 99 C
        GPU Max Operating Temp      : N/A
        Memory Current Temp         : N/A
        Memory Max Operating Temp   : N/A

This also shows the thermal throttling temperature and the critical shutdown temperature.

Another way to set the fan control is via the /usr/share/X11/xorg.conf.d/10-nvidia.conf file.

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

This might avoid the black screen error with Nvidia drivers as they are troublesome. Add the Option "Coolbits" "28" option here and see if this helps. On Ubuntu 20.04 with Nvidia Driver 470.63.01, you might use this instead.

Option         "Coolbits" "4"

Also, edit the /etc/X11/Xwrapper.config to look like this.

# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# 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=console
 
allowed_users = anybody
needs_root_rights = yes

Then run this command to set the appropriate permissions.

sudo chmod 2644 /etc/X11/Xwrapper.config

Then reboot your Linux PC.

Another useful post. This contains a script that you may run with Startup Applications in the MATE desktop to get the fan running when you log in to your desktop.

Give this a go as well.

Here is the script.

#!/bin/bash
nvidia-settings -a '[gpu:0]/GPUFanControlState=1'
nvidia-settings -a '[fan]/GPUTargetFanSpeed=56'

Add this to Startup Applications to use this script.

6 thoughts on “How to enable Nvidia fan control on Ubuntu 20.04. This is very easy.”

  1. I also have trouble getting it to work. Following are the output from my system

    # 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".
    Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup'
    New X configuration file written to '/etc/X11/xorg.conf'
     
    # nvidia-settings -a [fan:0]/GPUTargetFanSpeed=32
    ERROR: Unable to load info from any available system
    ERROR: Unable to load info from any available system
    Reply
  2. Do you know that instead of insulting you could write at least something related to the error, thereby helping yourself and others?

    Reply
    • It ain’t OP that’s the prob. OP is just the last straw for this dude. He goin postal lol. Bless his heart, we all been there

      Reply
  3. Thank You for the information.
    The only problem is that if I let xconfig to create an xorg.config file no matter if it is blank or created as you suggest it, the next I see after restart or logging out and in is a black screen. It can only be reverted by deleting any freshly created xorg.config and backup files.

    I have tried a lot of different fan control method for both CPU and GPU fan since I have two separate fan for them, but I had no luck with any of them, but thank you for your tip anyway.

    My specs :
    Asus ROG STRIX G531GT
    Intel Core I7 9750H
    Nvidia Geforce GTX 1650

    Reply
    • Did you ever get this sorted out? I am having the exact same issues with Ubuntu in a VM. I follow these steps and I can not get the fan controls to work at all. After setting up the xorg.conf and rebooting I don’t have any access to the display anymore.

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.