How to start the processor fan early to avoid high temperatures..

How to start the processor fan early to avoid high temperatures.

Miguel Menéndez

For some strange reason, in recent days my laptop’s processor is getting too hot and the fan takes a long time to start to lower the temperature.

I don’t have time to investigate why. The laptop is a Lenovo X240 with Arch, I have done the following:

~$ sudo -i
~# sensors

It returns this:

Adapter: ISA adapter
Package id 0:  +69.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +64.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +69.0°C  (high = +100.0°C, crit = +100.0°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +62.0°C  (crit = +200.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:           0 RPM
temp1:        +62.0°C
temp2:         +0.0°C
temp3:         +0.0°C
temp4:         +0.0°C
temp5:         +0.0°C
temp6:         +0.0°C
temp7:         +0.0°C
temp8:         +0.0°C

High temperature equal to critical temperature? 100°C… To boil water!

I install the package thinkfan (from AUR). I would also install the lm_sensors package but it already was:

~# pacman -Ql thinkfan

I check that the configuration file for the thinkpad_acpi module has been created:

~# cat /usr/lib/modprobe.d/thinkpad_acpi.conf

And returns:

options thinkpad_acpi fan_control=1

If not:

~# echo "options thinkpad_acpi fan_control=1" > /usr/lib/modprobe.d/thinkpad_acpi.conf

In both cases, restart the computer.

After the restart I load the thinkpad_acpi module:

~# modprobe thinkpad_acpi

And I check the fan status:

~# cat /proc/acpi/ibm/fan

It returns:

status:         enabled
speed:          0
level:          auto

The fan is available but off (goes at 0 revolutions per minute)… And the processor at 80°C and rising.

To set the temperature thresholds I have to create the file /etc/thinkfan.conf (there are examples in /usr/share/doc/thinkfan/examples/). Before creating this file, I must know where the temperature sensors are:

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

It returns this:

/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp6_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp3_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp7_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp4_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp8_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp1_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp5_input
/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp2_input
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp3_input
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input
/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input

Now, with this data I create the configuration file /etc/thinkfan.conf:

~# nano /etc/thinkfan.conf

With the following content:

tp_fan /proc/acpi/ibm/fan

hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp6_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp3_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp7_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp4_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp8_input
#hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp1_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp5_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/temp2_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input

#  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

(0,     0,      55)
(1,     48,     60)
(2,     50,     61)
(3,     52,     63)
(4,     56,     65)
(5,     59,     66)
(7,     63,     32767)

I test the configuration:

~# thinkfan -n

If any sensor fails (cannot find it), comment its line in the file /etc/thinkfan.conf. When everything is correct, the previous command will return something similar to:

Temperatures(bias): 0(0), 52(0), 52(0), 49(0), 50(0) -> level 0
Temperatures(bias): 0(0), 50(0), 52(0), 51(4), 50(0) -> level 1
Temperatures(bias): 0(0), 46(0), 46(0), 44(0), 47(0) -> level 0
Temperatures(bias): 0(0), 57(15), 61(19), 61(22), 50(2) -> level 7
Temperatures(bias): 0(0), 48(0), 50(0), 50(0), 51(0) -> level 2
Temperatures(bias): 0(0), 45(0), 46(0), 45(0), 47(0) -> level 0

And you will hear how the fan starts from level 1!

It only remains to activate the thinkfan service:

~# systemctl enable thinkfan

Sources: Arch Wiki , Thinkwiki and Amirul Abu at Medium .

Comments

Found a bug? Do you think something could be improved? Feel free to let me know and I will be happy to take a look.