How to set up "thinkfan" on a Lenovo Thinkpad T430?
  • vaikus84vaikus84
    PMPosts: 65
    This tutorial is for thinkfan_0.8.1-1! (present int Ubuntu Trusty default repos)
    ========================================================


    That's what I've done so far:

    sudo apt-get -y install tp-smapi-dkms thinkfan lm-sensors read-edid i2c-tools
    sudo modprobe -a tp_smapi


    Fineprint: If you are installing on a recent Thinkpad that has an Ivy Bridge or newer processor [X230, T430(s), T530, etc.],
    tp_smapi will not work. You will be mostly limited to thinkpad-acpi capabilities.
    You can however set battery charge thresholds with tpacpi-bat.
    But you need to have TLP version 0.7.0 and acpi-call for tpacpi-bat to work


    You might want to check out which fan levels your fan controller
    supports by doing something like this:


    sudo su

    for i in 0 1 2 3 4 5 6 7; do
        echo "level $i" > /proc/acpi/ibm/fan
        echo "level $i..."
        sleep 6
        cat /proc/acpi/ibm/fan | egrep "^speed"
        echo
    done

    [ENTER]
    [ENTER]

    echo "level auto" > /proc/acpi/ibm/fan

    [ENTER]



    NOTE! The last echo command is to set your fan back on automatic hardware regulated mode!
               If you don't set it back to "auto"(hardware regulated) mode, your laptop fan stays at full-speed mode!
               I'd recommend to have two terminal windows open. One window is for using the script
               the other window is for setting the level back to "auto" mode.



    My T430's readouts are:

    level 0...
    speed:        2012

    level 1...
    speed:        2529

    level 2...
    speed:        3048

    level 3...
    speed:        4021

    level 4...
    speed:        4132

    level 5...
    speed:        4587

    level 6...
    speed:        5415

    level 7...
    speed:        5347



    Find your sensor locations:

    find /sys/devices -type f -name "temp*_input"

    As you are going to see I have added "sensor" before the actual sensor location "/sys/devices/virtual/hwmon/hwmon0/temp1_input".
    This enables the sensor in /etc/thinkfan.conf.

    My version of /etc/thinkfan.conf so far:

    gksudo mousepad /etc/thinkfan.conf


    sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input
    sensor /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input
    sensor /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
    sensor /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp2_input

    (0,     0,      40)
    (1,     32,     55)
    (2,     54,     66)
    (3,     65,     76)
    (4,     75,     80)
    (5,     78,     85)
    (6,     82,     88)
    (7,     85,     32767)



    Configure thinkpad_acpi / thinkfan function:

    sudo echo "options thinkpad_acpi fan_control=1" | sudo tee /etc/modprobe.d/thinkfan.conf

    sudo modprobe -rv thinkpad_acpi
    sudo modprobe -v thinkpad_acpi


    NOTE! When the first command gives an error like this "modprobe: FATAL: Module thinkpad_acpi is in use",
    just reboot your machine to use your tweaked configuration file.


    If you want to start thinkfan automatically with your system,
    you need to modifie /etc/default/thinkfan as root (sudo is also ok):


    Just replace "no" with "yes"

    sudo nano /etc/default/thinkfan

    START=yes


    NOTE! Should "thinkfan" change the fanspeed too rapidly between the different levels, you can edit /etc/default/thinkfan as follows:

    sudo nano /etc/default/thinkfan

    DAEMON_ARGS="-q -b 1 -s 3"

    Meaning of Options:

        -b – so called "Bias" (Default: 5) is for making reaction speed better when temperatures change rapidly
        -s – max time (in seconds) in between two temperature measurements (Default: 5)

    Details in Manpage. http://manpages.ubuntu.com/manpages/precise/man1/thinkfan.1.html
                                  http://manpages.ubuntu.com/manpages/trusty/man1/thinkfan.1.html

    After changing this file, enable and start the service:

    # Traditional:
    sudo /etc/init.d/thinkfan start

    # Upstart:
    sudo service thinkfan start

    For Stoping the service (only if you need to do so):

    # Traditional:
    sudo /etc/init.d/thinkfan stop

    # Upstart:
    sudo service thinkfan stop

    Getting a list of Services (so you can confirm it is working):

    # Traditional:

    ls /etc/init.d

    # Upstart:

    service --status-all

    Now Reboot the system!

    EXTRA INFO:
    ---------------------------


    NOTE!    You can measure your current Temperature sensors with this "sensors" command in terminal to monitor your temperatures after setting everything up.
                  *** You need lm-sensors to be installed. I did it in the beginning of this tutorial!


    NOTE 2!   Everything here is done the way it's done because I have some tp-smapi starting issues on my T430.
                    Thus I could not use the extended method in  "thinkfan.conf"  like the default example in that file shows.


                    Default Example in "thinkfan.conf" :
                    # I use this on my T61p:
                    #sensor /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)


    Thanked by 2lxle Zaka
  • ZakaZaka
    PMPosts: 202
    Thanks for sharing the details, vaikus84!
    Thanked by 1vaikus84
  • I just hope this gives a starting point for others who are frustrated that no real step by step instructions are on the internet.