This page provides several scripts for controlling the ThinkPad's system fan according the its thermal sensors (overriding the embedded controller), in order to reduce fan noise and decrease power consumption.
ATTENTION! These scripts rely on undocumented hardware features and override nominal hardware behavior. They may thus cause arbitrary damage to your laptop or data. Watch your temperatures! NOTE! Closed-loop fan control requires a thermal sensor sweep, which is an expensive operation. The firmware doesn't update the sensors more than once every 2s, so care should be taken not to waste resources by reading them too often. Variable speed control scriptsThe following scripts sets the fan speed according to the system's thermal sensors. In addition, they include a hack for preventing the annoying fan pulsing that occurs on some systems. Note that the fan levels, thresholds and anti-pulsing hacks are system-specific, so you may need to adjust them.
Comprehensive bash script with fine control over fan speedThis script works with any recent Linux kernel (2.6.14 and higher). It requires the ibm-acpi module to be loaded with the experimental=1 module parameter (e.g., # modprobe ibm_acpi experimental=1
).
In Linux 2.6.22 and higher you need to additionally pass fan_control=1 to the module thinkpad_acpi (e.g., # modprobe thinkpad-acpi experimental=1 fan_control=1
)
The code lets you define a temperature range for each thermal sensor. The script computes the fan level needed by each sensor based on the configured range, and then sets the the actual fan level to the slowest that will satisfy all sensors (plus some hysteresis to avoid fluctiations). It also includes a workaround for the pulsing noise problem. The script provides an (optional) daemon mode and logging to syslog. The method of controlling fan speed is documented here.
The system hard disk temperature is monitored as well, using the hard disk's internal sensor. This works only on certain Hitachi disks and requires kernel >= 2.6.19-rc1 or the ide driver, since it uses a non-standard method for reading the temperature without causing a head unload or spinup.
The code:
Current options:
Usage: ./tp-fancontrol [OPTION]...This is optional. It assumes that the above tp-fancontrol script is saved at /usr/bin/tp-fancontrol.
The following is a simpler patch (without extra features like daemon mode and logging). It requires the patch for controlling fan speed or a recent kernel (>=2.6.19).
tp-fancontrol-basic (download)
tp-fan: Automatic daemon with GTK+ GUIProvides easy setup and monitoring through graphical GTK+ interface. Temperature thresholds can be set separately for each sensor since version 0.90.
At the moment packages are available for Ubuntu 7.10 and 8.04. However, porting to other distributions or manual setup should be easy.
Written in C to use as little CPU power as possible. It simply averages the two highest temperatures found in /proc/acpi/ibm/thermal. Configuration is done via a simple text file, by providing (FAN_LEVEL, LOWER_LIMIT, UPPER_LIMIT) tuples. Inspired by i8kfan. Requires thinkpad_acpi with fan_control=1. Version 0.3 now reloads its config on SIGHUP, exits cleanly and adds Syslog support. For Gentoo users there's an ebuild and an initscript.
(sorry about the dyndns crap)
Fan enable/disable scriptsThe following scripts were written before it was known how to control the fan speed, so they only toggle between fan disabled and default (noisy) fan behavior. In some models, they also do not monitor all available thermal sensors.
sh script examplefan-enable-basic (download)
sh script with more featuresfan-enable-extended (download)
sh script with extra safety functionalityibm_acpi usually works well. But to rely on it completely, this script provides some extra safety functionality:
fan-enable-safe (download)
Init scripts Init script examplefan-enable.init (download)
Init script example for gentooAssume one of the above control scripts is /usr/sbin/ibm-fancontrold, for gentoo use the following init script in /etc/init.d/ibm-fancontrol. Copy the script to /etc/init.d/ibm-fancontrol, then do
# rc-update add ibm-fancontrol defaultThis will add the init script to the default runlevel.
ibm-fancontrol.init (download)
Init script example for rh/fedoraAssume one of the above control scripts is /sbin/tp-fancontrold, copy the script to /etc/init.d/tp-fancontrol, then do
# chkconfig --add tp-fancontrolThis will add the init script to the default runlevel.
tp-fancontrol-fc.init (download)
You'd have to install also "kernel-module-ibm-acpi" package.
Other fanctrldfanctrld is a daemon (written in C) that controls the Thinkpad's fan. The basic approach is to monitor both temperature and fan speed. The fan is enabled when a certain temperature is exceeded, and disabled when the BIOS slows down the fan below a certain speed.
ThinkPad Fan Control GTK GUI toolA GTK GUI program (packaged for Ubuntu Gutsy Gibbon 7.10) may also help.
Ideas for improvement