Ubuntu – How to control fan speed

lm-sensorspower-management

How can I control the computer's fan speed?

On Windows there is a wonderful program called SpeedFan.

Best Answer

  • Note before starting:

    This functionality depends on both your hardware and software. If your hardware doesn't support fan speed controls, or doesn't show them to the OS, it is very likely that you could not use this solution. If it does, but the software (aka kernel) doesn't know how to control it, you are without luck.


    1. Install the lm-sensors and fancontrol packages.
    2. Configure lm-sensors
    3. In terminal type sudo sensors-detect and answer YES to all YES/no questions.
      (Potentially, this can damage your system or cause system crash. For a lot of systems, it is safe. There is no guarantee that this process will not damage your system permanently, I just think that chance of such critical failure is really really low. Saving all your work for eventual crashes/freezes/restarts before handling system configuration is always good idea. If you feel unsure, read the comments and try to search a web and get some high-level overview before YES-ing everything, maybe being selective with your YES-es will still be enough)
    4. At the end of sensors-detect, a list of modules that need to be loaded will be displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
    5. Run sudo service module-init-tools restart This will read the changes you made to /etc/modules in step 3, and insert the new modules into the kernel.
    • Note: If you're running Ubuntu 13.04 or higher, this 3rd step command should be replaced by sudo service kmod start
    1. Configure fancontrol

    2. In terminal type sudo pwmconfig . This script will stop each fan for 5 seconds to find out which fans can be controlled by which PWM handle. After script loops through all fans, you can configure which fan corresponds to which temperature.

    3. You will have to specify what sensors to use. This is a bit tricky. If you have just one fan, make sure to use a temperature sensor for your core to base the fancontrol speed on.

    4. Run through the prompts and save the changes to the default location.

    5. Make adjustments to fine-tune /etc/fancontrol and use sudo service fancontrol restart to apply your changes. (In my case I set interval to 2 seconds.)

    6. Set up fancontrol service

    7. Run sudo service fancontrol start. This will also make the fancontrol service run automatically at system startup.

    In my case /etc/fancontrol for CPU I used:

    Settings for hwmon0/device/pwm2:
    (Depends on hwmon0/device/temp2_input) (Controls hwmon0/device/fan2_input)

    INTERVAL=2
    MINTEMP=40  
    MAXTEMP=60  
    MINSTART=150  
    MINSTOP=0  
    MINPWM=0  
    MAXPWM=255 
    

    and on a different system it is:

    INTERVAL=10
    DEVPATH=hwmon1=devices/platform/coretemp.0 hwmon2=devices/platform/nct6775.2608
    DEVNAME=hwmon1=coretemp hwmon2=nct6779
    FCTEMPS=hwmon2/pwm2=hwmon1/temp2_input
    FCFANS=hwmon2/pwm2=hwmon2/fan2_input
    MINTEMP=hwmon2/pwm2=49
    MAXTEMP=hwmon2/pwm2=83
    MINSTART=hwmon2/pwm2=150
    MINSTOP=hwmon2/pwm2=15
    MINPWM=hwmon2/pwm2=14
    MAXPWM=hwmon2/pwm2=255
    

    here is some useful info on the settings and what they really do