Thinkpad T430 Fancontrol

2017-01-18

linux

Fancontrol is a little tricky on Thinkpads and the configuration can be different from device to device. For a Thinkpad T430 I could not find any starting point in the arch wiki or the official thinkfan documentation. However, I found this article from Ivan Denkov that explains the usage of thinkfan for Thinkpad T430's:

https://ivan.reallusiondesign.com/thinkpad-t430-ubuntu-fan-control/

This article is a reiteration of the one linked, as there have been breaking changes in thinkfan itself.

1. Install lm-sensors and thinkfan

Both lm-sensors and thinkfan need to be installed. lm-sensors is available from the official repositories, but thinkfan is only available from the AUR.

sudo pacman -S lm-sensors
yaourt thinkfan

After installing both, lm-sensors needs to detect the hardware sensors. This can be done using the following command:

sudo sensors-detect

2. Load kernel modules

The kernel modules coretemp and thinkpad_acpi need to be loaded for fancontrol to work. The modprobe command can be used to load them:

sudo modprobe thinkpad_acpi
sudo modprobe coretemp

3. Find sensors

Next, the sys/device files relating to our temperature readings have to be located. The following command will find them:

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

Depending on your system configuration the output will look something like this:

$ sudo find /sys/devices -type f -name "temp*_input"
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp3_input
/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
/sys/devices/virtual/hwmon/hwmon0/temp1_input

4. Write a configuration file

Copy one of the default configurations from /usr/share/doc/thinkfan/examples/ to /etc/thinkfan.conf and add the following lines to the top (replace the paths with the output of the command above):

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

You can test your configuration by executing thinkfan -n manually. If the configuration in /etc/thinkfan.conf is invalid it will fail to start.

For reference, this is my configuration file on my personal laptop (I prefer my devices hotter, but quiet):


# The device that is used to control the fan
tp_fan /proc/acpi/ibm/fan

# The sensors to probe.
# The hottest of these will be used to control temperature
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp3_input
hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input

# Fan configuration. The first number is the fanspeed level (0-7), the second
# number is the temperature which will trigger the next lower speed when temperatures
# are falling and the third number will trigger the next higher speed when
# temperatures are rising

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

# 127 references the highest available RPM: disengaged.
# This line is pretty much saying "just cool the damn thing, I don't care"
(127, 80, 32767)

5. Autostart thinkfan on boot

To autostart thinkfan at boot, the necessary kernel modules have to be loaded and thinkfan itself has to be started.

To load the neccessary kernel modules automatically on system start, ensure that coretemp and thinkpad_acpi are present in /etc/modules.

To start thinkfan automatically use systemd:

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