Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 119

Thread: HOWTO: Fancontrol

  1. #1
    Join Date
    Jan 2005
    Beans
    65

    HOWTO: Fancontrol

    Controlling the speed (and sound!) of your CPU fan is easy!
    Disclaimer: this can ruin your hardware. A CPU fan is needed to cool your CPU and in this howto it will be turned off for a couple of seconds. If you are not comfortable with doing this, don't!

    Update Nov 7, 2007: this still works in Gutsy Gibbon! Hurray!

    Setup lm-sensors
    First, you need to set up lm-sensors. This is explained here. That's for Warty, but still works under Hoary.

    Once you have lm-sensors installed, you should have a readout with 'sensors'
    Code:
    $ sensors
    w83627thf-isa-0290
    Adapter: ISA adapter
    VCore:     +1.54 V  (min =  +1.69 V, max =  +1.86 V)              
    +12V:     +11.67 V  (min = +10.82 V, max = +13.19 V)              
    +3.3V:     +3.42 V  (min =  +3.14 V, max =  +3.47 V)              
    +5V:       +5.15 V  (min =  +4.75 V, max =  +5.25 V)              
    -12V:     -14.91 V  (min = -10.80 V, max = -13.18 V)              
    V5SB:      +5.05 V  (min =  +4.76 V, max =  +5.24 V)              
    VBat:      +0.06 V  (min =  +2.40 V, max =  +3.60 V)              
    fan1:        0 RPM  (min = 18750 RPM, div = 8)                     
    CPU Fan:  1188 RPM  (min = 18750 RPM, div = 8)                     
    fan3:        0 RPM  (min = 19285 RPM, div = 1)                     
    M/B Temp:    +31°C  (high =   -73°C, hyst =   +21°C)   sensor = thermistor           
    CPU Temp:  +50.0°C  (high =   +80°C, hyst =   +75°C)   sensor = thermistor           
    temp3:     +15.0°C  (high =   +80°C, hyst =   +75°C)   sensor = thermistor           
    vid:      +1.775 V  (VRM Version 9.0)
    alarms:   
    beep_enable:
              Sound alarm enabled
    
    eeprom-i2c-0-51
    Adapter: SMBus Via Pro adapter at 0400
    Memory type:            DDR SDRAM DIMM
    Memory size (MB):       256
    
    eeprom-i2c-0-50
    Adapter: SMBus Via Pro adapter at 0400
    Memory type:            DDR SDRAM DIMM
    Memory size (MB):       256
    Notice that my CPU fan is running really slowly, only 1100 RPM. The CPU temp is a little high, so I need to do some tweaking of the config there. The fan can run so slowly and quietly, because it's a large 12 cm fan made by Zalman (it's the 7000B AlCu). If your output does not display an RPM for your CPU fan, and you are positive it is running, you need to increase the fan divisor. If your fan speed is shown and higher than 0, skip the next step.

    Increasing fan_div
    The first line of the sensors output is the chipset your motherboard uses to read the speeds/temps/voltages. Make a backup first:
    Code:
    $ sudo cp /etc/sensors.conf /etc/sensors.conf_original
    Edit the /etc/sensors.conf file as root
    Code:
    $ sudo gedit /etc/sensors.conf
    and look up your exact chipset. The names all look alike, so make sure the one you are editing is yours. Add the line fanX_div 4 near the start of your chipset config. Replace the X with the number of your CPU fan's, for me that was 2. You have to figure out for yourself which one it is, but it's probably 1, 2 or 3.

    Save, and run
    Code:
    $ sudo sensors -s
    which will reload the sensors.conf's set variables.
    Run sensors again and check if there is an RPM readout. If not, increase the divisor to 8, 16 or 32. YMMV!

    Here is a sample from my sensors.conf
    Code:
    chip "w83627thf-*" "w83637hf-*"
    
        label in0 "VCore"
        label in1 "+12V"
        label in2 "+3.3V"
        label in3 "+5V"
        label in4 "-12V"
        label in7 "V5SB"
        label in8 "VBat"
    
        compute in1 ((28/10)+1)*@, @/((28/10)+1)
        compute in3 ((34/51)+1)*@, @/((34/51)+1)
        compute in4 (5.14*@)-14.91, (@+14.91)/5.14
        compute in7 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
    
        set fan2_div 8
    
        <snip>
    You can safely ignore anything that's not fanX_div. I would advise you to leave the other default settings as they are.


    Patching pwmconfig This is no longer needed if you run Dapper! Go to the next step unless you're running Hoary.
    There is a bug in pwmconfig that you need to fix.
    This is true for the version currently in Hoary, version 2.8.8-7ubuntu2.

    First, try running pwmconfig:
    Code:
    $ pwmconfig
    if that gives you the following error:
    /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed
    than you need to apply this fix. If not, proceed to the next step.

    Backup:
    Code:
    $ sudo cp /usr/sbin/pwmconfig /usr/sbin/pwmconfig_original
    Open pwmconfig:
    Code:
    $ sudo gedit /usr/sbin/pwmconfig
    and go to line 68. Delete these three lines:
    Code:
            MATCH='*/fan[1-9]_pwm'
    else
            MATCH='*/pwm[1-9]'
    and replace with:
    Code:
            MATCH='*/pwm[1-9]'
    else
            MATCH='*/fan[1-9]_pwm'
    You just turned the if/else around! Now pwmconfig should work.

    Run pwmconfig
    Code:
    $ sudo pwmconfig
    One by one, all fans will be tested for 'speedcontrol' (Pulse Width Modulation, actually). Follow the onscreen help. Pwmconfig will write a config file in /etc. I set the interval to 5 seconds, just to be safe, but 10 should be fine too. Let the script run until you see "Select fan output to configure, or other action:" (all default options are fine, you can basically enter you way through the script).

    Now press 5 to look at the configuration file. Press 1 to edit settings. Select a temperature that matches your CPU temp (usually the same number as the fan number, but check and double check!). Go with the defaults until you see: "Enter the minimum PWM value (0-255)
    at which the fan STARTS spinning (press t to test) (150):"
    Here, press t.
    Keep pressing enter until you hear (or better: see) the fan spinning up. Then, press y and enter.
    Same for the next step, but the other way around. If you see the fan stops spinning, press y and enter.

    Press 5 again to display the config file one more time, then press 4 to save and quit. Almost there!

    My /etc/fancontrol config looks like this:
    Code:
    INTERVAL=5
    FCTEMPS= 1-0290/pwm2=1-0290/temp2_input
    FCFANS= 1-0290/pwm2=1-0290/fan2_input
    MINTEMP= 1-0290/pwm2=43
    MAXTEMP= 1-0290/pwm2=53
    MINSTART= 1-0290/pwm2=120
    MINSTOP= 1-0290/pwm2=105
    this is an example!

    Starting fancontrol
    The last step is to start up fancontrol. Enter this:
    Code:
    $ sudo fancontrol &
    Now you can see and hear that your CPU fan is running slower, unless your CPU heats up. Good stuff!

    [B}Starting fancontrol automatically on boot[/B]
    Create a file called "fancontrol" in /etc/init.d:
    Code:
    sudo gedit /etc/init.d/fancontrol
    And paste this in there:
    Code:
    #!/bin/sh
    #
    # Fancontrol start script.
    #
    
    set -e
    
    # Defaults
    DAEMON=/usr/sbin/fancontrol
    PIDFILE=/var/run/fancontrol.pid
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    
    test -f $DAEMON || exit 0
    
    . /lib/lsb/init-functions
    
    
    case "$1" in
            start)
                    log_begin_msg "Starting fancontrol daemon..."
                    start-stop-daemon --start -o -q -m -b -p $PIDFILE -x $DAEMON
                    log_end_msg $?
                    ;;
            stop)
                    log_begin_msg "Stopping fancontrol daemon..."
                    start-stop-daemon --stop -o -q -p $PIDFILE
                    log_end_msg $?
                    ;;
            force-reload|restart)
                    sh $0 stop
                    sh $0 start
                    ;;
            *)
                    log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload}"
                    log_success_msg "  start - starts system-wide fancontrol service"
                    log_success_msg "  stop  - stops system-wide fancontrol service"
                    log_success_msg "  restart, force-reload - starts a new system-wide fancontrol service"
                    exit 1
                    ;;
    esac
    
    exit 0
    Save and close, then run
    Code:
    sudo update-rc.d fancontrol defaults 99 01
    and you should be set.

    (Thanks, Mr Wonka and jotape99!)


    I would advise you to have some sort of fan/temp monitoring software installed. There is a nice one in gkrellm, or you can use xsensors.

    Most of this howto is from here:
    http://www.fedoraforum.org/forum/sho...10&postcount=5
    Check if your hardware is supported here:
    http://www.almico.com/forumindex.php
    Last edited by remmelt; November 7th, 2007 at 01:29 PM. Reason: Added automatic startup on boot

  2. #2
    Join Date
    Apr 2005
    Beans
    11
    Distro
    Ubuntu 6.06

    Talking Re: HOWTO: Fancontrol

    And if you want to have it startup on boot.

    Code:
    #!/bin/sh
    #
    # Fancontrol start script.
    #
    
    set -e
    
    # Defaults
    DAEMON=/usr/sbin/fancontrol
    PIDFILE=/var/run/fancontrol/.fancontrol-pid
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    
    test -f $DAEMON || exit 0
    
    . /lib/lsb/init-functions
    
    
    case "$1" in
    	start)
    		log_begin_msg "Starting fancontrol daemon..."
    		start-stop-daemon --start -o -q -m -b -p $PIDFILE -x $DAEMON
    		log_end_msg $?
    		;;
    	stop)
    		log_begin_msg "Stopping fancontrol daemon..."
    		start-stop-daemon --stop -o -q -p $PIDFILE
    		log_end_msg $?
    		;;
    	force-reload|restart)
    		sh $0 stop
    		sh $0 start
    		;;
    	*)
    		log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload}"
    		log_success_msg "  start - starts system-wide fancontrol service"
    		log_success_msg "  stop  - stops system-wide fancontrol service"
    		log_success_msg "  restart, force-reload - starts a new system-wide fancontrol service"
    		exit 1
    		;;
    esac
    
    exit 0
    Stick this in a file called 'fancontrol' in your init.d startup scripts. eg.

    Code:
    /etc/init.d/fancontrol
    Add this to your startup scripts in the usual way.

  3. #3
    Join Date
    Jan 2005
    Beans
    65

    Re: HOWTO: Fancontrol

    Don't forget to

    Code:
    $ sudo chmod 0755 /etc/init.d/fancontrol
    and create a symlink to that script in rc3.d, for example.

    Code:
    $ sudo ln -s /etc/init.d/fancontrol /etc/rc3.d/S99fancontrol
    (thanks for that, by the way!)

  4. #4
    Join Date
    May 2005
    Location
    Cydonia
    Beans
    Hidden!
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: HOWTO: Fancontrol

    I fixed the code in pwmconfig, and it still doesn't work...any ideas?

    *edit* Nevermind...I fixed it
    Last edited by picpak; June 29th, 2005 at 04:47 PM.

  5. #5
    Join Date
    Jul 2005
    Location
    England
    Beans
    13
    Distro
    Gutsy Gibbon Testing

    Re: HOWTO: Fancontrol

    Hi all, thanks for this great guide, worked perfectly for me so far (yet to reboot ).
    One thing of note that occured for me using the script kindly provided above:

    Code:
     sudo /etc/init.d/fancontrol start
     * Starting fancontrol daemon...
    start-stop-daemon: Unable to open pidfile `/var/run/fancontrol/.fancontrol-pid' for writing: No such file or directory
    Code:
    # Defaults
    DAEMON=/usr/sbin/fancontrol
    PIDFILE=/var/run/fancontrol/.fancontrol-pid
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    I had to change the PIDFILE path to:

    Code:
    # Defaults
    DAEMON=/usr/sbin/fancontrol
    PIDFILE=/var/run/fancontrol-pid
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    I don't know if this was something specific to me....... But incase it helps others.

  6. #6
    Join Date
    Feb 2005
    Beans
    Hidden!

    Re: HOWTO: Fancontrol

    I would seriously have a heart-attack just by trying this (I don't even need for it to _not_ work O.o). Just reading the red disclaimer sends shivers down my spine.
    Sylvia: Look at what you've done to him!
    Christof: I have given Truman the chance to lead a normal life. The world, the place you live in, is the sick place.

  7. #7
    Join Date
    Apr 2005
    Location
    Not-So-Sunny Hawaii
    Beans
    Hidden!

    Re: HOWTO: Fancontrol

    Quote Originally Posted by bored2k
    I would seriously have a heart-attack just by trying this (I don't even need for it to _not_ work O.o). Just reading the red disclaimer sends shivers down my spine.
    aye... what's the point of it, i'm wondering?

  8. #8
    Join Date
    Jul 2005
    Location
    Remote Desert, USA
    Beans
    683

    Re: HOWTO: Fancontrol

    Geesh. What if a virus installed one of these things? My paranoid brain can see whole multimillion dollar server rooms catching on fire now.
    SuperMike
    When in doubt, follow the penguins.
    Evil Kitty is watching you

  9. #9
    Join Date
    Apr 2005
    Location
    Not-So-Sunny Hawaii
    Beans
    Hidden!

    Re: HOWTO: Fancontrol

    Quote Originally Posted by SuperMike
    Geesh. What if a virus installed one of these things? My paranoid brain can see whole multimillion dollar server rooms catching on fire now.
    don't give them ideas

  10. #10
    Join Date
    Jan 2005
    Beans
    65

    Re: HOWTO: Fancontrol

    I guess the point is that it makes my life (even more) liveable because it makes the noise from my computer less. The cpu fan doesn't need to run 100% all the time, and I have described a way to make it less noisy.

    That said, you shouldn't be running stuff like this on a server. Servers need all the cooling they can get, plus they are usually stored in places where no-one can hear the noise they make. Moreover, Ubuntu is a desktop-linux, right?

Page 1 of 12 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •