NOTE: This is how I configured
thinkfan
for my Thinkpad Z16 Gen 1 on Fedora 38. I don’t guarantee that this’ll work for any other machine.
Setup
Enable fan control. As root:
$ echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.conf $ modprobe thinkpad_acpi
And reboot.
Build
thinkfan
from source by following the instructions in the README. At the time of writing:- Install dependencies:
$ sudo dnf install -y cmake g++ pkgconfig yaml-cpp-devel lm_sensors-devel
- Create a build folder:
$ mkdir build && cd build
- Configure the build directory (make sure
USE_LM_SENSORS
andUSE_YAML
are set toON
):$ ccmake ..
- Compile
$ make
- And Install
$ sudo make install
- Install dependencies:
Create the config:
- Run
sensors-detect
andsensors
to find the correct name for the sensors. In my case, runningsensors
produced an output of:thinkpad-isa-0000 Adapter: ISA adapter fan1: 2364 RPM fan2: 2219 RPM CPU: +44.0°C GPU: N/A temp3: +44.0°C temp4: +44.0°C ...
- Note the names of all sensors shown, as well as the ids.
In this case, that would be
thinkpad-isa-0000
and[ CPU, temp3, temp4, etc. ]
. - Create
/etc/thinkfan.conf
and enter that info undersensors:
(I’ll show my full configuration further down). - Add a section
fans:
and addtpacpi: /proc/acpi/ibm/fan
. - Add a section
levels:
and put in fan levels in the format[ <fan_level>, <lower_limit_temp>, <upper_limit_temp> ]
. For example, if I wanted to set fanlevel 4
from 55°C to 64°C, you would write[ 4, 55, 64 ]
.
My full config looks like this:
sensors: - chip: thinkpad-isa-0000 ids: [ CPU, temp3, temp5, temp6, temp7 ] - chip: amdgpu-pci-6400 ids: [ edge ] - chip: nvme-pci-0300 ids: [ Composite ] fans: - tpacpi: /proc/acpi/ibm/fan # levels from https://wiki.gentoo.org/wiki/Fan_speed_control/thinkfan 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 ] - [ "level full-speed", 70, 32767 ]
- Run
Run
thinkfan
to test your configuration.Enable the
systemd
service:$ sudo systemctl enable thinkfan
Why Did I Build From Source?
The version of thinkfan
in the fedora repos seems to be built without lm_sensors
support.
So, if you installed it from dnf
and tried running my configuration, you’d get a rather cryptic error message:
ERROR: /etc/thinkfan.yaml:2:
- chip: thinkpad-isa-0000
^
Invalid sensor entry.
(See this issue, which is still applicable despite being about the AUR package).
Fan Speeds
Thinkpads’ have eight fan speed levels:
level 0
: fans offlevel 1
level 2
: low speedlevel 3
level 4
: medium speedlevel 5
level 6
level 7
: high speed
level auto
: the default level where fan RPM is controlled by the BIOSlevel full-speed
: the maximum monitored speedlevel disengaged
: the true maximum speed where the embedded controller stops monitoring the fan speed
Manual Fan Speed Control
To control fan speed manually, just echo
the intended level to /proc/acpi/ibm/fan
.
For example, to change the fan speed to level 4
, run:
echo "level 4" > /proc/acpi/ibm/fan