My Thinkpad T400s kept shutting down when it was busy doing CPU intensive work. It turns out that the fan did not speed up to a high enough level to cool down the CPU, and I’d find messages in /var/log/messages stating that the CPU was dangerously hot.
The first thing I did was to make it possible to manually control the fan speed. In order for this to work, the thinkpad_acpi kernel module needs to be loaded with a specific parameter. This can be done manually by unloading the module and then loading it with that parameter. Even better, make this happen automatically by adding the file /etc/modprobe.d/thinkfan_acpi.conf like this
# When loading the thinkpad_acpi module, allow controlling the fan # from "the outside" # echo "level full-speed" > /proc/acpi/ibm/fan options thinkpad_acpi fan_control=1
After this, simply try `modprobe -r thinkpad_acpi && modprobe thinkpad_acpi`
Once this is done, you can use the file /proc/acpi/ibm/fan as a text file, eg by doing (as root)
echo "level full-speed" > /proc/acpi/ibm/fan
And listen as the fan speeds up to maximum speed
Go to http://thinkfan.sourceforge.net/ and download a tarball. Go into the directory and run make, and you should have an executable named thinkfan. Copy this file into usr/sbin (ie `/usr/sbin/thinkfan`).
Now you will need to add a config file for thinkfan. My TP has an SSD, so I’m not really worried about the warnings thinkfan emits when running with this config file. The default location for the thinkfan config file is /etc/thinkfan.conf, and mine looks like this
(0, 0, 55) (1, 48, 60) (2, 50, 61) (3, 52, 63) (4, 56, 65) (5, 59, 66) (7, 63, 78) (127, 75, 32767)
This file lists three columns:
- the fan level to be used
- the temperature at which to spin the fan down to the previous level
- the temperature at which to step up to the next level
So once the temperature reaches 78 degrees, my fan will be turned to level 127. This level (127) is equivalent to the full-speed setting, and spins my fan to max speed which prevents my computer from burning. Note: thinkfan doesn’t seem to ship with this in any default settings, but it makes the entire difference for me.
Once this is done, try running thinkfan as root:
sudo /usr/sbin/thinkfan -n
This will start thinkfan in the foreground and emit messages to standard out. Try running some CPU intensive tasks and watch as thinkfan speeds your fan up and down afterwards.
Now that you’ve verified that this works, it’s time to make this happen when you start your computer.
My computer uses systemd for system services, so I created a file `/usr/lib/systemd/system/thinkfan.service` which looks like this:
[Unit] Description=simple and lightweight fan control program [Service] ExecStart=/usr/sbin/thinkfan -q -n [Install] WantedBy=multi-user.target
Note: Systemd can run daemons “in the foreground”, you don’t need to daemonize them yourself. Because of this, I run it with the `-n` setting, which keeps it in the foreground. Furthermore, I add the `-q` parameter, which makes it a little less noisy (messages turn up in `/var/log/messages` on my computer.
After adding this file, enable and start the service:
sudo systemctl enable thinkfan.service sudo systemctl start thinkfan.service
That’s it, you’re done.
If you’re running some ancient Linux distro which uses /etc/init.d for system daemons, you’ll have to write a program that handles the {start,stop} commands, add this to /etc/init.d and do the symlink thing to enable it (`chkconfig` or `update-rc.d`). Good luck with that.
If you’re running a current version of Ubuntu, you’re a bit better off, since Ubuntu uses Upstart. Upstart, like systemd, saves you the {start,stop} dance, and lets you run processes in the foreground.
Adding this file as `/etc/init/thinkfan.conf` should work (although I haven’t tried it myself).
exec /usr/sbin/thinkfan -q -n respawn start on runlevel [3]
After saving this file, enter `sudo initctl status thinkfan` to verify that the service is recognized. Once you’ve done so, enter `sudo initctl start thinkfan` and check the status again. To double-check that it’s working, do a search in running processes to verify that the process is running.
I’ve created a RPM SPEC file which I used to biuld and install thinkfan for my computer.
It assumes you have a working RPM build environment and download the source tarball for thinkfan 0.8.0 inside
$RPM_HOME/SOURCES and this file inside $RPM_HOME/SPECS. Once you have those two files (no need to extract or patch anything), enter rpmbuild -ba $RPM_HOME/SPECS/thinkfan.spec
and find an RPM inside $RPM_HOME/RPMS/x86_64 (change the BuildArch
tag to match your architecture, if necessary). Install it with yum localinstall $RPM_HOME/RPMS/x86_64/thinkfan-0.8.0-2.fc17.x86_64.rpm
and you should be all set.
You're awesome. Thank you.
I had to add this line to mine: