How To Control Fan Speeds in Ubuntu

August 27, 2008 by
Filed under: HowTo, linux, Ubuntu 

First, you need some cpu temperature monitor software. For Ubuntu you need to install a package called lm-sensors. It's available in Ubuntu's main repository. All the commands listed in this howto should be executed from the terminal.

sudo apt-get install lm-sensors

Then you need to run sensors-detect.

sudo sensors-detect

and just follow the prompts. Add the recommended lines to /etc/modules.

Now, if you don't want to reboot, you'll have to manually activate the modules.

Affiliate Link
sudo modprobe module1 module2

where module1 etc. = the module names provided from sensors-detect.

Next, you need to create your fancontrol file. The easiest way is to run pwmconfig.

sudo pwmconfig

and work your way through the instructions there.

Finally, run sensors -s to make your fan configuration take effect.

sudo sensors -s

Now, you can check your temps.

sensors

Now to run fan control, type:

sudo /usr/sbin/fancontrol &

To have fancontrol run on startup, follow the instructions on the Ubuntu Forums. Note: This step is no longer required in 9.10 Karmic Koala. The fancontrol script is already included in the build. It will start automatically the next time you boot.

To monitor temps and speeds, I like gkrellm. To get it:

sudo apt-get install gkrellm

Here's a screenshot of Gkrellm.

Gkrellm System Monitor

Gkrellm System Monitor

Comments

20 Responses to “How To Control Fan Speeds in Ubuntu”

  1. Treodk says:

    when i try to run the command "modprobe module1 module2"
    it doesn't look like it's doning anithing it just tell me "FATAL: Module Module1 not found".
    i gave up and rebooted but the next command says that there is no pwm-sensors capable sensors modules installed.

    • Linerd says:

      What were the actual modules output by sensors-detect? What is the content of /etc/modules? You can show the content of that file with:

      cat /etc/modules
      • bab0y says:

        I have the same problem. Currently running Linux Mint 16 on MacBook Pro mid 2012. I've made several attempts. 'New to Linux here and need lots of help. Thanks in advance.

        # /etc/modules: kernel modules to load at boot time.
        #
        # This file contains the names of kernel modules that should be loaded
        # at boot time, one per line. Lines beginning with "#" are ignored.
        # Parameters can be specified after the module name.

        lp
        rtc

        # Generated by sensors-detect on Tue Jan 21 22:04:45 2014
        # Chip drivers
        coretemp

        # Generated by sensors-detect on Tue Jan 21 22:09:26 2014
        # Chip drivers
        coretemp

        # Generated by sensors-detect on Tue Jan 21 22:16:05 2014
        # Chip drivers
        coretemp

  2. Pr0ph3T says:

    Will be running through this in a few minutes. My purpose is actually not that the fan is too loud...it's a Dell D630 and the BIOS does not seem to factor the GPU temps into when it spins the fan up. SpeedFan under Win7 works great keeping the chip from roasting again, but I prefer to keep all my systems dual-boot. This should solve it ;-)

  3. shmincky says:

    I just made a $800 computer and the CPU fan will run for about a second during the time that it shows the motherboard logo and then it stops and doesn't run at all, ever. what do I do to change that. if someone can answer this than I will be able to use it.

    :(

    • shmincky says:

      oh and by the way I am using Ubuntu but will be setting up a dual boot with some form of windows

    • Linerd says:

      Many motherboards have fan control built into the BIOS or EFI. It's usually given a name like Smart Fan or something similar. If your BIOS does a good job controlling the temp of your CPU, there's no reason to try to control the fan speeds from the OS. If the built-in fan control is not working well, try disabling it in the BIOS and then try following the instructions here.

  4. gianni says:

    Thank you for your work!
    My DellM90 Precision run Ubuntu 10.10, 2.6.35-22 kernel.
    Fun speed is always at the max value and this is boring...
    the "sensor-detect" return the following:

    To load everything that is needed, add this to /etc/modules:
    #----cut here----
    # Chip drivers
    coretemp
    #----cut here----
    If you have some drivers built into your kernel, the list above will
    contain too many modules. Skip the appropriate ones!

    Do you want to add these lines automatically to /etc/modules? (yes/NO)y
    Successful!

    Monitoring programs won't work until the needed modules are
    loaded. You may want to run '/etc/init.d/module-init-tools start'
    to load them.

    Unloading i2c-dev... OK
    Unloading i2c-i801... OK

    root@connardoia:~# /etc/init.d/module-init-tools start
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service module-init-tools start

    now I don't know what I have to do...
    what are the needed modules that I have to load?

    thank you, Gianni

  5. Soenke says:

    Thank you for this great tutorial!

    I am running into problems though. The module is not part of my kernel. I have to install it - k10temp.c

    I can download the file but what do I do with it? How do I reference it correctly in /etc/modules? Do I have to add the full path or just k10temp?

    I never have worked with kernel mode files yet. Please explain a little bit on what to do. Thank you ever so much!

    Cheers

    • Linerd says:

      I'm pretty sure the file you downloaded is a source file for the module. That means you would have to compile a new kernel that includes this. That's well beyond the scope of what I've done before. Try opening the k10temp.c file in a text editor. If the file is readable in a text editor, then it is indeed a source file and you'll need to compile a new kernel that includes it. This page should be of some help for compiling. https://help.ubuntu.com/community/Kernel/Compile

      OK, I just found something better. You can try adding the kernel team's PPA to your system and they currently have the 2.6.35 kernel available which should contain the module you need. You can add the PPA to your system from the terminal with

      sudo add-apt-repository ppa:kernel-ppa
      sudo apt-get update

      You can then install a new kernel through synaptic, or at the time of this writing:

      sudo apt-get install linux-headers-2.6.35-20 linux-headers-2.6.35-20-generic linux-image-2.6.35-20-generic
      • Soenke says:

        Linerd,

        thank you for your outstanding feedback. I was thinking to wait until the next release of ubuntu, which comes with a kernel version that should include the module. As you correctly assumed, it is indeed a text-readable file. I'd rather prefer getting experience in kernel compiling on a non-essential system ;-)

        Thank you again for pointing towards the PPA kernel - never about its existence (fairly new to this part of reality :-) ). Also I found a correlating discussion going regarding variances in reported temperatures based on kernel version on the ubuntu forums. Cf. http://ubuntuforums.org/showthread.php?t=1569161

        • Soenke says:

          info update: the kernel installed flawlessly. However, the fglrx driver failed to work resulting in sluggish desktop performance. Thus, I wait until 10.10 release and will report on the k10temp module again.

  6. Soenke says:

    Thank you for the tutorial!

    I am having problems. You Say "Add the recommended lines to /etc/modules." My recommended module is k10temp which is not included in my kernel as of yet. Kernel version 2.6.32

    On the http://www.lm-sensors.org/wiki/Devices website to downloading the k10temp module they give me a kernel mode file - k10temp.c

    Here is the problem: What do I do with it? Just place the file into a directory? Which directory? And do I have to include the full path into /etc/modules or merely k10temp? Please explain the process in some detail. Thank you ever so much!

    Soenke
    Soenke

  7. Nollie says:

    Is a noisy fan not caused by a wrong swap setting (swapiness) ?

    • Linerd says:

      Noisy fans are usually caused by a high CPU/system temperature, or a system that doesn't regulate the fan speed based on temperature. It could also be caused by bad bearings in the fan itself.

      I've never hear of swappiness causing fan noise. I guess it could cause some increased CPU load which could lead to increased fan speed on a regulated system. IDK

  8. Fred says:

    Doesn't work for me. I get a 'sorry, no sensors were detected' What shall I do next?

    • Linerd says:

      Not all motherboards have the sensors required for fan control. Your motherboard may also have sensors, but lm_sensors doesn't know how to talk to them. It may be that you're just out of luck on this one. Usually there will be a screen in your BIOS setup that will display the current temperatures if you do have sensors. That's perhaps the best way to know if you even have a chance of getting this to work.

      One of my computers has a cheap Chaintech motherboard with no sensors. I ended up buying a manual fan controller that fits in a 3.5" bay to quiet the fans down.

  9. dee says:

    Might be suave to show how to disable this in case somebody does something that will stop their fan. I ran "sudo gnome-system-monitor" then went to the process tab and ended fancontrol. I think it can be permanently disabled by deleting "/etc/fancontrol" file.

    Also, if you have two cores, is there a way to make the fan run based on whichever core is hotter?

    Thanks.

  10. [...] This is probably not necessary for most people, but if your fans are annoyingly loud, you may be able to set up automatic can control. [...]

  11. shawn says:

    Thanks for your nice little how-to. Everytime i install a new copy of ubuntu i alway stop in her to grab the lines for fancontrol =)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>