On my laptop Thinkpad T580, I would like to better control the fan speed; it’s too noisy!
Reading Time: 3 minutes
In Belgium, the weather is hot and I observe that my fan is really noisy. Normal, isn’t it? the temperature is really high (around 30° and 55° for the CPU)
However, I would like to better control the fan based on the different temperatures like we can do with the Windows application available for the laptop lenovo :https://support.lenovo.com/be/en/solutions/HT077046 but nothing available for Linux.
There is a solution for Ubuntu, a little complex but logic. You need two packages:
- lm-sensors: is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans.
- thinkfan: Thinkfan is a simple, lightweight fan control program. Originally designeds pecifically for IBM/Lenovo Thinkpads, it now supports any kind of system via the sysfs hwmon interface (/sys/class/hwmon).
A few steps are required to control your fan based on the temperatures of the different zones.
Step 1: Install the required packages (Note: Distribution Lubuntu 18.04)
apt-get install lm-sensors apt-get install thinkfan apt-get install cpufrequtils
Step 2: check the sensors available on the laptop T580 by executing sensors-detect
In Green, the sensors type detected (Intel) with the related module (coretemp) which will be loaded at the start. You can check if the module is correctly added by opening the /etc/modules file.
Step 3: Configure the manual control of the Fan to enable Thinkfan to change its speed
Thinkfan is a program for controlling fans speed on IBM/Lenovo ThinkPads. It is written for Linux only. To enable Thinkfan to control the fan of the PC, you need that the Linux kernel has ‘thinkpad-acpi’ activated. For Linux 2.6.22 and above, you must add ‘fan_control=1’ as a module parameter to ‘thinkpad-acpi’. For example, in Debian Lenny (and Ubuntu 8.04), you must add the following line into “/etc/modprobe.d/thinkfan.conf”:
echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkpad_acpi.conf
Step 4: Configure Thinkfan
The heart of the configuration of the Thinkfan is the file /etc/thinkfan.conf. For its configuration, you need three elements:
- The location of the sensors to have their information
- The location of the fan to control its speed
- The description of the 7 steps of the fan
Here is the extract of the Thinkfan.conf file with the three important elements:
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp2_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp4_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp5_input tp_fan /proc/acpi/ibm/fan (0,0,54) (1,52,56) (2,54,58) (3,56,60) (4,58,63) (5,60,70) (6,66,79) (7,74,92) (127,85,32767)
There are three sections in this file :
- First section indicates where the input of the temperature can be found. You can see that this is the module coretemp which provides the program with the information. This is the INPUT
- Second section gives you the control of the fan. The fan has 7 speeds (0 = disabled – 2 = Low – 4= Medium – 7= Maximum – 127 = disengaged – auto = auto). This is the OUTPUT
- Third section defines the speed of the fan for each interval [min_CPU, max_CPU] based on according to the following configuration (Fan_speed,min_CPU,max_CPU):
- Fan_speed : fan level to be used.
- Min_CPU : the temperature at which to spin the fan down to the previous level.
- Max_CPU: the temperature at which to step up to the next level.
Attention point: The Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz is able to work until 100°C according to http://www.cpu-world.com/CPUs/Core_i7/Intel-Core%20i7%20i7-8550U.html. so, I decided to activate my Fan with a temperature of minimum 54°C by gradually incrementing it based on the temperature of the CPU
Step 5: Manually start Thinkfan to check if it works!
You need to firstly stop the service thinkfan and start thinkfan on the console (not daemon). This enables you to see, based on the actions you made, the impact on the CPU and the fan speed. This enables you to adapt the configuration file if required.
systemctl stop thinkfan thinkfan -n
and here is the result based on the actions I made, opening a xterm,a browser, add a tab,…
To stop Thinkfan in console mode a simple CTRL+C
Step 6: Start Thinkfan
systemctl start thinkfan
Here is the result:
Conclusion:
Now, I have the control of the speed of my laptop’s fan based on the real temperature of the 10 zones. It’s of course possible to better tweak the configuration file by for example determining the thermal zones of the processor and activate the fan based on this information. Feel free to give comments or ask questions and I will try to answer you.
If you find this post valuable, Rate it ! This helps me to improve it. For comments, you need to register with your LinkedIn account.
References:
When I write an article, I always give the references I used because I believe in intellectual property and I know how many times you need to write a valuable article.
You have made some really good points there. I looked
on the web to learn more about the issue and found most
people will go along with your views on this web site.
Appreciate this post. Let me try it out.
Hello DisruptIT,
thank you for your post and manual. I have Lenovo ThinkPad T440s.
All configs and outputs from terminal i am same as you, but my fan still run with “speed” 65535 rpm.
sensors | grep fan
fan1: 65535 RPM
Please, do you have any experience with this kind of problem? I struggle with it around one year :/
My AskUbuntu topic: https://askubuntu.com/questions/1110774/fan-problem-on-thinkpad-t440s-works-acpi
Thank you.
Lukas
Hello Lukas,
Thanks to reading my blogs.
Could you check that this command is in : sudo echo “options thinkpad_acpi fan_control=1” | sudo tee /etc/modprobe.d/thinkfan.conf
I would like to know if the thinkfan service is running … Thinkfan uses the sensors on your card to adapt the speed of the fan if the temperature increases.
If this service is up, stop it and execute the command thinkfan on a prompt: thinkfan -n … Normally, thinkfan displays the statistics every 5 seconds…
Start a browser for example and observe if the fan changes its speed. if this is not the case, you have a problem with the sensors, you don’t point to the right ones…
if it works, this is a problem at the level of the service (maybe you don’t use the right configuration file)
Come back to me with your answers, and we will progress in the troubleshooting.
DisruptIT
Very good post. I will be going through many of these issues as well..