Setting up Thinkfan and friends on Arch
Nov 22, 2014
3 minutes read

Thinkfan is a software fan control developed for Thinkpad branded Lenovo laptops running POSIX operating systems. This post will walk the reader through installation of Thinkfan on Arch systems, but much of the data will be useful on other systems, espescially those which employ systemd.

This post will assume a small degree of familiarity with the Arch User Repository, and the various methods that one can use to pull software from it.

This post will also assume installation is taking place on a semi-modern Thinkpad branded laptop. Thinkfan will work with other manufacturers and models – but that’s outside the scope of this post. Older ThinkPads use many different temperature management schemas, many are not controllable by the user themselves.

There are two ways now to install Thinkfan. One uses hwmon and lm-sensors for the temperature interface, the other method uses temperatures which are exposed by a special Thinkpad kernel module.

At the moment the hwmon method has a larger base of devices which it supports, so this guide shall follow that method.

  1. install lm_sensors from the offical Arch repositories. sudo pacman -S lm_sensors
  2. We want to load the Thinkpad specific ACPI kernel module at boot time while passing it an option that allows for user intervention of fan controls. sudo nano /etc/modprobe.d/thinkpad_acpi.conf to open the nano editor as root, writing to the thinkpad_acpi.conf file. Inside this file, pass the kernel module and option : options thinkpad_acpi fan_control=1. Ctrl-X and Y to save and quit.
  3. detect sensor outputs in system. Default answers to all prompts in Arch. sudo sensors-detect Ubuntu users should make sure to answer yes to installing the kernel module.
  4. insert the appropriate kernel module that sensors-detect found. sudo modprobe -a <modulename> is the command used, but if you’re worried about that just restart. If you told sensors-detect ‘Yes’ when it asked if you wanted it to insert the kernel module, it’ll be loaded upon boot.
  5. test the output of the detected sensors with sensors. If sane temperatures are being shown, everything is A-OK.
  6. install thinkfan from the AUR. yaourt -S thinkfan (if you’re using yaourt or the AUR for this that is.) It’s supposed to automatically deal with the kernel modules that we manually input earlier, but it has been my experience that it does this poorly, if at all – that’s why we did it ahead of time.
  7. copy the example config over to the actual working directory. sudo cp /usr/share/doc/thinkfan/examples/thinkfan.conf.simple /etc/thinkfan.conf
  8. using the find command, let’s find temperature outputs and make note of them. find /sys/devices -type f -name "temp*_input"
  9. place the temperature outputs into the /etc/thinkfan.conf file as directed by the templating. Prefix any hwmon sensors with hwmon. sensor is deprecated.
  10. adjust the temperatures ranges as fit for your specific model.

The thinkfan.conf file for my T420s looks something like this:

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

(0, 0, 55)
(1, 48, 60)
(2, 50, 65)
(3, 58, 68)
(4, 60, 79)
(5, 61, 70)
(7, 65, 32767)

Test thinkfan first without daemonizing it by using thinkfan -n to log to terminal loudly.

If all goes well, start the thinkfan systemd service. sudo systemctl enable thinkfan and sudo systemctl start thinkfan

Ubuntu users will use sudo service thinkfan enable, and may need to check out the /etc/default/thinkfan file for flags which may need enabling.

Back to posts

comments powered by Disqus