Skip to content

Instantly share code, notes, and snippets.

@ajithrn
Forked from Yatoom/setup.md
Last active March 3, 2022 16:04
Show Gist options
  • Select an option

  • Save ajithrn/05c00ba6f1766ceb04d1589938e921dd to your computer and use it in GitHub Desktop.

Select an option

Save ajithrn/05c00ba6f1766ceb04d1589938e921dd to your computer and use it in GitHub Desktop.

Revisions

  1. ajithrn revised this gist Mar 3, 2022. 2 changed files with 73 additions and 55 deletions.
    71 changes: 16 additions & 55 deletions thinkfan.conf
    Original file line number Diff line number Diff line change
    @@ -1,57 +1,18 @@
    ######################################################################
    # thinkfan 0.7 example config file
    # ================================
    #
    # ATTENTION: There is only very basic sanity checking on the configuration.
    # That means you can set your temperature limits as insane as you like. You
    # can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
    #
    # That's why this program is called THINKfan: You gotta think for yourself.
    #
    ######################################################################
    #
    # IBM/Lenovo Thinkpads (thinkpad_acpi, /proc/acpi/ibm)
    # ====================================================
    #
    # IMPORTANT:
    #
    # To keep your HD from overheating, you have to specify a correction value for
    # the sensor that has the HD's temperature. You need to do this because
    # thinkfan uses only the highest temperature it can find in the system, and
    # that'll most likely never be your HD, as most HDs are already out of spec
    # when they reach 55 °C.
    # Correction values are applied from left to right in the same order as the
    # temperatures are read from the file.
    #
    # For example:
    # tp_thermal /proc/acpi/ibm/thermal (0, 0, 10)
    # will add a fixed value of 10 °C the 3rd value read from that file. Check out
    # http://www.thinkwiki.org/wiki/Thermal_Sensors to find out how much you may
    # want to add to certain temperatures.
    sensors:
    - tpacpi: /proc/acpi/ibm/thermal
    indices: [0, 1, 2]

    # Syntax:
    # (LEVEL, LOW, HIGH)
    # LEVEL is the fan level to use (0-7 with thinkpad_acpi)
    # LOW is the temperature at which to step down to the previous level
    # HIGH is the temperature at which to step up to the next level
    # All numbers are integers.
    #
    fans:
    - tpacpi: /proc/acpi/ibm/fan

    # I use this on my T61p:
    #tp_fan /proc/acpi/ibm/fan
    #hwmon /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
    #hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input

    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input

    (0, 0, 60)
    (1, 60, 65)
    (2, 65, 70)
    (3, 70, 75)
    (4, 75, 80)
    (5, 80, 85)
    (7, 85, 32767)
    levels:
    - [0, 0, 41]
    - [1, 38, 51]
    - [2, 45, 56]
    - [3, 51, 61]
    - [4, 55, 64]
    - [5, 60, 66]
    - [6, 63, 68]
    - [7, 65, 74]
    - [126, 73, 90]
    - [127, 88, 32767]
    57 changes: 57 additions & 0 deletions thinkfan.config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    ######################################################################
    # thinkfan 0.7 example config file
    # ================================
    #
    # ATTENTION: There is only very basic sanity checking on the configuration.
    # That means you can set your temperature limits as insane as you like. You
    # can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
    #
    # That's why this program is called THINKfan: You gotta think for yourself.
    #
    ######################################################################
    #
    # IBM/Lenovo Thinkpads (thinkpad_acpi, /proc/acpi/ibm)
    # ====================================================
    #
    # IMPORTANT:
    #
    # To keep your HD from overheating, you have to specify a correction value for
    # the sensor that has the HD's temperature. You need to do this because
    # thinkfan uses only the highest temperature it can find in the system, and
    # that'll most likely never be your HD, as most HDs are already out of spec
    # when they reach 55 °C.
    # Correction values are applied from left to right in the same order as the
    # temperatures are read from the file.
    #
    # For example:
    # tp_thermal /proc/acpi/ibm/thermal (0, 0, 10)
    # will add a fixed value of 10 °C the 3rd value read from that file. Check out
    # http://www.thinkwiki.org/wiki/Thermal_Sensors to find out how much you may
    # want to add to certain temperatures.

    # Syntax:
    # (LEVEL, LOW, HIGH)
    # LEVEL is the fan level to use (0-7 with thinkpad_acpi)
    # LOW is the temperature at which to step down to the previous level
    # HIGH is the temperature at which to step up to the next level
    # All numbers are integers.
    #

    # I use this on my T61p:
    #tp_fan /proc/acpi/ibm/fan
    #hwmon /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
    #hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input

    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input

    (0, 0, 60)
    (1, 60, 65)
    (2, 65, 70)
    (3, 70, 75)
    (4, 75, 80)
    (5, 80, 85)
    (7, 85, 32767)
  2. ajithrn revised this gist Mar 1, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
    ## 3. Enable fan control

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

  3. @Yatoom Yatoom revised this gist Nov 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup.md
    Original file line number Diff line number Diff line change
    @@ -84,7 +84,7 @@ thinkpad_acpi
    coretemp
    ```

    Note that this may change the `/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp*_input` paths in the config (`hwmon3` can become `hwmon2` or vice versa)
    Note that this may change the `/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp*_input` paths (`hwmon3` can become `hwmon2` or vice versa), probably because of the order in which the modules are loaded or something. So, in the `/etc/thinkfan.conf` config, you might need to update these lines.



  4. @Yatoom Yatoom renamed this gist Nov 12, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. @Yatoom Yatoom revised this gist Nov 12, 2017. 2 changed files with 2 additions and 1 deletion.
    1 change: 1 addition & 0 deletions thinkfan.conf
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,7 @@
    #tp_fan /proc/acpi/ibm/fan
    #hwmon /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
    #hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input

    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
    2 changes: 1 addition & 1 deletion setup.md → thinkfan_setup.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Thinkfan setup

    Note: I configured this thinkfan setup for my old Thinkpad w520 on Ubuntu 17.10.


    ## 1. Install necessary programs
  6. @Yatoom Yatoom revised this gist Nov 12, 2017. 1 changed file with 23 additions and 6 deletions.
    29 changes: 23 additions & 6 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -56,24 +56,41 @@ modprobe thinkpad_acpi

    ## 4. Testing and running

    Set thinkfan to run at startup by editing `/etc/defaults/thinkfan` and change `START=NO` to `START=YES`.
    To test thinkfan, use:

    ```
    sudo systemctl enable thinkfan.service
    thinkfan -n
    ```
    And to run it, use:

    ```
    sudo service thinkfan start
    ```

    And to retrieve the status, use:

    To test thinkfan, use:
    ```
    service thinkfan status
    ```



    ## 5. Running on startup

    To make it run at startup, we need to edit `/etc/modules` and add the lines below, to make the modules `thinkpad_acpi` and `coretemp` load at boot time. The `thinkpad_acpi` has to be loaded before `coretemp`.

    ```
    thinkfan -n
    thinkpad_acpi
    coretemp
    ```

    Note that this may change the `/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp*_input` paths in the config (`hwmon3` can become `hwmon2` or vice versa)

    And to run it, use:


    Furthermore, we need to enable the `thinkfan` service via `systemctl`.

    ```
    sudo service thinkfan start
    sudo systemctl enable thinkfan.service
    ```

  7. @Yatoom Yatoom revised this gist Nov 12, 2017. 1 changed file with 79 additions and 0 deletions.
    79 changes: 79 additions & 0 deletions setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,79 @@
    # Thinkfan setup



    ## 1. Install necessary programs

    Install `lm-sensors` and `thinkfan`.

    ````
    sudo apt-get install lm-sensors thinkfan
    ````



    ## 2. Setup configuration

    Find the temperature control devices with

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



    Add them to `/etc/thinkfan.conf`, including (level, min_temperature, max_temperature):

    ```
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
    (0, 0, 60)
    (1, 60, 65)
    (2, 65, 70)
    (3, 70, 75)
    (4, 75, 80)
    (5, 80, 85)
    (7, 85, 32767)
    ```



    ## 3. Enable fan control

    ```
    echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.conf
    modprobe thinkpad_acpi
    ```

    - You can check with `lsmod` if `thinkfan_acpi` is running
    - To reload a module you need to remove it with `sudo modprobe -r <module>`, but this is not always possible, so we might need a reboot here.



    ## 4. Testing and running

    Set thinkfan to run at startup by editing `/etc/defaults/thinkfan` and change `START=NO` to `START=YES`.

    ```
    sudo systemctl enable thinkfan.service
    ```



    To test thinkfan, use:

    ```
    thinkfan -n
    ```


    And to run it, use:

    ```
    sudo service thinkfan start
    ```

  8. @Yatoom Yatoom created this gist Nov 10, 2017.
    56 changes: 56 additions & 0 deletions thinkfan.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    ######################################################################
    # thinkfan 0.7 example config file
    # ================================
    #
    # ATTENTION: There is only very basic sanity checking on the configuration.
    # That means you can set your temperature limits as insane as you like. You
    # can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
    #
    # That's why this program is called THINKfan: You gotta think for yourself.
    #
    ######################################################################
    #
    # IBM/Lenovo Thinkpads (thinkpad_acpi, /proc/acpi/ibm)
    # ====================================================
    #
    # IMPORTANT:
    #
    # To keep your HD from overheating, you have to specify a correction value for
    # the sensor that has the HD's temperature. You need to do this because
    # thinkfan uses only the highest temperature it can find in the system, and
    # that'll most likely never be your HD, as most HDs are already out of spec
    # when they reach 55 °C.
    # Correction values are applied from left to right in the same order as the
    # temperatures are read from the file.
    #
    # For example:
    # tp_thermal /proc/acpi/ibm/thermal (0, 0, 10)
    # will add a fixed value of 10 °C the 3rd value read from that file. Check out
    # http://www.thinkwiki.org/wiki/Thermal_Sensors to find out how much you may
    # want to add to certain temperatures.

    # Syntax:
    # (LEVEL, LOW, HIGH)
    # LEVEL is the fan level to use (0-7 with thinkpad_acpi)
    # LOW is the temperature at which to step down to the previous level
    # HIGH is the temperature at which to step up to the next level
    # All numbers are integers.
    #

    # I use this on my T61p:
    #tp_fan /proc/acpi/ibm/fan
    #hwmon /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
    #hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
    hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input

    (0, 0, 60)
    (1, 60, 65)
    (2, 65, 70)
    (3, 70, 75)
    (4, 75, 80)
    (5, 80, 85)
    (7, 85, 32767)