19

So im trying ubuntu again after being off it for awhile in win7 i can set gpu fan to 10-30% and its barly reaching 52c , however with ubuntu nvidia set it to 55% wich is really loud on my msi 460gtx.

This is the only thing that keeps me from using ubuntu is there really no program or way to set manually like msi afterburner / evga precision , temperature curve & fan speed?.

Default fan is way to loud and its barly 3 c diffrence from 25% gpu fan speed to 55% but the noise is alot more.

7 Answers 7

25

In the terminal run:

sudo nvidia-xconfig
sudo nvidia-xconfig --cool-bits=4

restart your computer and search for NVIDIA X Server Settings in the Dash. There should be an option to change fan speed under Thermal Settings.

1
  • 6
    To provide some more explanations: This will generate a completely new xorg.conf and also adds Option "Coolbits" "4" to Section "Screen". And the application called NVIDIA X Server Settings is nvidia-settings.
    – scai
    Nov 18, 2015 at 14:43
7

To control Nvidia GPU fan speed via Terminal on Linux Mint 20 with a 1070 Ti:

sudo nvidia-xconfig --cool-bits=4

to tell nvidia-xconfig to allow the fan to be controlled in the command line. You may need to reboot here.

nvidia-smi

Gives information about the GPU(s) and their numbers. Importantly I note that my 1070 Ti is GPU 0.

nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=55"

For a much more detailed overview of this feature including multiple GPU fans, check out this thorough documentation Nvidia Overclocking and Cooling

For a somewhat rambling and wayward thread which lead me to the above link, check out Set Fanspeed in Linux from Terminal

==================END OF ANSWER==================

And as an extra tidbit not asked for in this question, you can also adjust the power output of your Nvidia GPU with:

sudo nvidia-smi -i 0 -pl 90

Where the 0 is my GPU number, and the 90 is the maximum power in watts. If you set this too low, you will get an error. In my limited experience, setting it too high had no effect. I found I can get 95%+ performance for ~75% energy cost by setting the power level to 100 in the above command in my mining rig, but I imagine other power conscious users would appreciate this too.

4

Be careful about the highest voted answer. I have two 2080ti GPUs and running that command made my computer unable to boot.

Finally, I found an answer from here. Following that:

  1. Create a file named /etc/X11/xorg.conf.d/11-nvidia-coolbits.conf and write the following in it:

    Section "OutputClass"
        Identifier "nvidia"
        MatchDriver "nvidia-drm"
        Driver "nvidia"
        Option "Coolbits" "4"
    EndSection
    
  2. Log out and log back in.

  3. Run nvidia-settings. In the windows that opens you can now find the fan speed control options. Only the fan speed of one GPU can be controlled though.

1
  • 1
    Worked for me! Strange that the fan speed slider only appears after that and not always
    – xjcl
    Jun 9, 2021 at 23:45
2

Try sudo apt-get install nvclock

1
  • 7
    it says, Unable to locate this package.
    – Kongsea
    Dec 1, 2017 at 12:20
2

None of the above answers worked for me using the nvidia-settings GUI. Here's the bash commands that enabled me to change my fan speed from the cli, when ssh tunneled into my desktop. (Note: I have SDDM (Simple Desktop Display Manager) rather than GDM (Gnome Desktop Manager) installed).

Get the Xauthority for the current Xserver.

(Note: you may need to plug in the monitor first and turn it on, otherwise, there's a super interesting workaround option to run a new X server (e.g., X :0 && export DISPLAY=:0 avialable on the nvidia forums).

I didn't need that since I can just plug a monitor (powered off) into the HDMI outlet. Here's the simpler version:

ps -ax | grep Xorg

Find the path to the Authorization File string that looks like -auth /var/run/sddm/{31a6ce92-51d1-4cef-b30e-61d63b0221bb} and copy the path (i.e., /var/run/sddm/{Authorization File}). (Don't use the dummy example here, it won't work - you need to find your Auth File path with the command above).

Adjust your Nvidia GPU fanspeed

Now we're ready to put the full command together - to set GPU 0 with a speed of 95% it'll look like this (remember to replace the Auth File with the path you copied above):

sudo DISPLAY=:0 XAUTHORITY=/var/run/sddm/{31a6ce92-22d1-4cef-b29e-91d63b0221bb} nvidia-settings -a [gpu:0]/GPUFanControlState=1 -a [fan:0]/GPUTargetFanSpeed=95

Change the values to what you need. Check it worked by running this

nvidia-smi

Wrapping it all into a python script

If you're lazy like me and just want a python script to do all this - you can paste the following into a file (e.g., a new file you create callsed fanspeed.py), then run python fanspeed.py.

#!/usr/bin/python
import subprocess
import re

# Run 'ps' command and capture the output
ps_process = subprocess.Popen(['ps', '-ax'], stdout=subprocess.PIPE)
ps_output = ps_process.communicate()[0].decode('utf-8')

# Search for the string that looks like '/usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/sddm/{c88c6851-f0c3-48f8-9689-814f25e12450} -background none -noreset -displayfd 17 -seat seat0 vt1'
xauth_line = None
for line in ps_output.split('\n'):
    if '-auth /var/run/sddm/{' in line:
        xauth_line = line
        print("Found Xauth line " + xauth_line)
        break

# Extract the '-auth' value
xauth_value = None
if xauth_line:
    match = re.search(r'-auth\s+(.+?})', xauth_line)
    #match = re.search(r'-auth\s+(.+)\s+', xauth_line)
    if match:
        xauth_value = match.group(1)
        print("Found Xauth value:" + xauth_value)

# Adjust fan speed
if xauth_value:
    fan_speed_command = f'sudo DISPLAY=:0 XAUTHORITY={xauth_value} nvidia-settings -a [gpu:0]/GPUFanControlState=1 -a [fan:0]/GPUTargetFanSpeed=95'
    print("Issuing command to adjust fanspeed"+fan_speed_command)
    subprocess.run(fan_speed_command, shell=True)

# Check if it worked by running 'nvidia-smi' command
nvidia_smi_process = subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE)
nvidia_smi_output = nvidia_smi_process.stdout.decode('utf-8')
print(nvidia_smi_output)
1
  • Thanks a lot, this worked!
    – SomeDude
    May 14, 2023 at 20:01
0
  1. Install nvclock as someone above pointed out
  2. Open terminal
  3. nvclock -f -F 80 (in this case, fan would run @ 80%)
2
  • 1
    I have Sony Vaio with Geforce 310m. The same issue. When I use nvclock I am getting the reply: $ sudo nvclock -f -F 80 Unable to shadow the video bios Error: Your card doesn't support fanspeed adjustments!
    – Oleksa
    Sep 1, 2013 at 8:20
  • Your answer could be improved with an edit , Please organise the answer to make it a little bit of trustful !
    – Error404
    Oct 30, 2021 at 6:24
0

Okay all this stuff is great, but I found a video people miss, because we always look at Q&A's thinking there a better soultion,

Add this line:

In /etc/X11/Xwrapper.config

needs_root_rights=yes

Then reboot, and you're problem will be solved, set fan speed how ever you want, probs best using sudo.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .