12.04 - Manually turn on CPU fan

24
2014-04
  • ricksebak

    My BIOS controls my fan speeds, and I want to keep it that way. I have a machine in my basement where it's normally pretty cool, and as long as the machine isn't under high load the fans don't need to run at all. The BIOS already handles this just fine.

    But if my fans aren't running, I have no way to test them to make sure they aren't broken. So I'd like to make a script which will turn on the fans full blast for a few seconds, then use lm-sensors to monitor fan speed, and then I will know that the fans aren't broken.

    How can I manually turn on the fans to full speed? I don't want to use fancontrol, because I'm not looking for something that keeps running and keeps controlling fan speed. I just want something "low tech" that will turn them on regardless of temperature.

    Another thread said:

    If you really want to do it yourself, you can probably find special device files named pwm1, pwm2, etc. in /sys/class/hwmon/*/device/. You can cat them to get the current value or write a number between 0 and 255 to change the fan speed.

    That would be perfect, but it doesn't seem to work. Fancontrol says that my CPU fan is /sys/devices/platform/it87.656/pwm3, but when I set that to 255, it doesn't affect fan speed at all.

    Does anyone know how I can manually turn on the fan from a script, regardless of temperature?

  • Answers
  • user5950

    You can do this with the tool

    pwmconfig
    

    This tool is normally used to save a configuration file for fancontrol. But you don't have to do so. You can just start the tool, than it will put all fans on full speed, sowing there current speed like this:

    Giving the fans some time to reach full speed...
    Found the following fan sensors:
      hwmon0/device/fan1_input     current speed: 2129 RPM
      hwmon0/device/fan2_input     current speed: 1679 RPM
      hwmon0/device/fan3_input     current speed: 0 ... skipping!
      hwmon0/device/fan4_input     current speed: 0 ... skipping!
    

    After that you just skip (Ctr+C) the tool without saving anything.

    To install the tool, you can use the following command:

    sudo apt-get install fancontrol
    

  • Related Question

    overheating - How do I get fan control working?
  • RobinJ

    I know there something called fancontrol, that enables you to control the speed of your system's ventilation. I'd like to let my fans spin a bit faster as my laptop is heating up very easilly. All tutorials and stuff I've found are for old versions of Ubuntu and don't seem to be working anymore.

    Can anyone explain to me or give me a good link on how I can get it working on Ubuntu? Something different with the same effect is also fine.


  • Related Answers
  • user1902715

    i8kutils works for controlling the fan of my Dell Vostro 3350 laptop.

    # For Dell laptop only:
    $ sudo apt-get install i8kutils 
    $ i8kfan 1 2 # Set the left-fan at low speed(1); the right one at high speed(2).
    
  • filescraps

    The package lm-sensors might be what you are looking for.

    And as you suggested fancontrol.

    Be sure that all the fans that you are trying to control via software have the 4 pin connector.

    "A PWM capable fan is usally connected to a 4-pin connector (pinout: Ground, +12V, sense, control)."source

    When I run pwmconfig which is a part of fancontrol I get

    /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed It will guide you if you have compatible hardware.

    Here are some scripts to use in conjunction with that generated config file. I assume that you could set a higher value here.

    label fan1 "Side Fan"
    set fan1_min 1000
    label fan2 "PSU Fan"
    set fan2_min 1000
    label fan5 "CPU Fan"
    set fan5_min 1000
    

    But as I said, I can't test this myself, since my hardware don't support it, I can control my fans from the bios, but it's a grade of 3. I use it for keeping my fan's slow and silent.

  • Ewald

    Ok, this might not be the answer you are looking for, but my overheating problems were solved, when removed the dust by putting a vacuum cleaner on the ventilation inlets. If you experience overheating at low cpu-frequencies, this might be worth a try. Be aware that maybe small parts may get sucked in. If you are lucky this method might solve you overheating problems.

  • vitorafsr

    Have a look at i8kutils, it should work on the Dell Latitude D620.

  • Carl

    You'll most likely be able to solve your problem with something else overriding your i8kctl fan commands by the method given in this answer. For completeness, I'll include some general notes on fan control on Dell laptops, and full instructions for i8kutils.

    What probably won't work

    Two common and straight-forward means of controlling the fan on laptops are through ACPI and through PWM pins, however, unfortunately:

    • Dell laptops lacks ACPI fan control capability (*1)

      • as a consequence, trying with ACPI boot parameters and the like will fail
    • Dell Latitude laptops, as far as I know, lack pwm controllable fans (*2)

      • as a consequence, the fancontrol/pwmconfig program won't work

    Use i8kutils

    However, there's a package called i8kutils that is written to control the fan on Dell Inspiron laptops through SMM BIOS. Several users report success on their Dell Laitude laptops as well (I'm one of them, on a Dell Latitude E7440) - however, a trick is often needed to get rid of interfering BIOS fan control. You suffer from that as well according to a previous comment.

    Install i8kutils:

    $ sudo apt-get install i8kutils
    

    Try it:

    $ i8kfan 2 2     # set to max speed
    $ i8kfan 0 0     # set to 0 speed
    

    ...and listen to see if it works.

    Disable BIOS fan control

    If it works, but somewthing else is fighting back on the setted speed (reported by many users on Dell Latitude laptops), this is due to scheduled SMM sessions setting the fan speed back. Luckily there is a way to disable BIOS fan control by writing to SMM registers.

    Warning: see the warning in top of smm.c. This method will write to SMM registers. However, I've seen no user reports on this causing trouble. Also, all reports on trying this have indicated success in disabling the BIOS fan control.

    i8kutils includes the source of a program smm but the i8kutils package does not include the compiled binary. What we'll do is to download the source code of i8kutils, compile the program smm, and run it with an apropriate argument to disable BIOS fan control by writing to SMM registers.

    Download packages needed for building:

    $ sudo apt-get build-dep i8kutils
    

    Download i8kutils source code, extract and enter directory (exact names depending on i8k version):

    $ apt-get source i8kutils
    $ tar xvf i8kutils_1.33.tar.gz
    $ cd i8kutils-1.33/
    

    Compile smm:

    • If on a 32-bit system:

      $ make
      

      (Above will execute gcc -g -O2 -Wall -I. -o smm smm.c.)

    • If on a 64-bit system:

      $ gcc -g -O2 -Wall -I. -o smm -m32 smm.c
      

    Run smm with argument 30a3 to disable SMM fan control:

    $ sudo ./smm 30a3
    

    Now, BIOS fan control should be disabled. Try by setting speeds with i8kctl, listen for the fan and make sure the speed persists.

    Note: This is a setting that will persist reboots and power-off's. BIOS fan control can be enabled again with $ sudo ./smm 31a3.


    *1: I've seen an official source on this, can't find it right now. If you want to verify that your hardware lacks it, follow instructions here: https://wiki.ubuntu.com/DebuggingACPI

    *2: for verifying this, run pwmconfig: sudo apt-get install fancontrol, sudo pwm-config will tell if a pwm-capable fan is present or not

  • user245946

    I have a Dell Latitude e4200 and the following worked for me because the BIOS was overriding i8kfan setting. My computer's initial temperature was 105F degrees and about 10 mins after using these steps (fan setting = 2) the CPU/Core temps dropped to 96F degrees. This procedure had already been posted by someone:

    Step 1. Download and install i8ktutils:

    # sudo apt-get install i8kutils
    

    Step 2. Override the BIOS to keep it from interrupting custom fan settings. Download the source code and compile a program (SMM) to do this:

    # sudo apt-get build-dep i8kutils
    

    then:

    # apt-get source i8kutils
    

    Step 3. Extract the source code and cd into the directory:

    # tar xvf i8kutils_1.33.tar.gz
    

    then:

    # cd i8kutils-1.33/
    

    Step 4. Compile SMM

    For 32-bit systems:
    
    # make SMM
    
    (Output: # gcc -g -O2 -Wall -I. -o smm smm.c.)
    
    For 64-bit systems
    
    # make SMM:
    
    (Output: # gcc -g -O2 -Wall -I. -o smm -m32 smm.c)
    

    Step 5. Execute SMM with parameters:

    # sudo ./smm 30a3
    

    Step 6. Set the fan speeds:

    # i8kfan 2 2 (Listen as this will set fans to maximum speed)
    
    # i8kfan 1 1 (This will set fans to slow speed)
    

    Now BIOS fan control should not override fan settings. This setting will remain even if the system is rebooted. To give control back to BIOS for some reason do the following procedure:

    # sudo ./smm 31a3.
    

    There is also a way to check the temp by using lm_sensors:

    http://www.cyberciti.biz/faq/howto-linux-get-sensors-information/