THINKFAN(1)

πŸ“¦
version 2.0.0 Β· 4 versions
, in alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– THINKFAN πŸ’–

okay bestie, welcome to the thinkfan(1) manual page β€” yes that's the section 1 of the manual, we're doing this properly. sit down, grab a strawberry πŸ“, and let's talk about the little program that keeps your laptop from melting into a puddle of sad aluminum.


✨ NAME ✨

thinkfan β€” a simple fan control program. that's it, that's the whole vibe. simple. fan. control. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

thinkfan [-hnqDd] [-b BIAS] [-c CONFIG] [-s SECONDS] [-p [DELAY]]

look at all those little flags. we're gonna go through every single one of them, don't you worry. πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea: thinkfan reads temperatures from a configured set of sensors, and then it sets fan speeds according to the temperature limits you set in the config file. that's the whole job. temperature in, fan speed out, laptop lives. 🫢

WARNING: Thinkfan does only very basic sanity checking on the configuration. This means that a bad configuration can increase thermal wear on the hardware or even cause destruction from overheating!

not me being dramatic β€” that's a real warning, fr fr. if you write a cursed config, thinkfan will trust you, and your hardware will pay the price. 😭


🌑️ Supported sensors

  • /proc/acpi/ibm/thermal this one is provided by the thinkpad_acpi kernel module on older Thinkpads. vintage behavior. antique elegance. ✨
  • temp*_input files in sysfs (hwmon interface) may be provided by any hwmon drivers, including thinkpad_acpi on modern Thinkpads. glow up.
  • Hard disks with S.M.A.R.T. support (libatasmart) available if thinkfan was compiled with -DUSE_ATASMART=ON. Note that modern Linux kernels can also expose S.M.A.R.T. hard disk temperatures via the hwmon interface in sysfs (and therefore also via lm_sensors), which is generally preferrable because it is more efficient. so like, you can use libatasmart, but the newer route is giving efficient. πŸ’€
  • From the proprietary nVidia driver when the proprietary nVidia driver is used, no hwmon for the card will be available. In this situation, thinkfan can use the proprietary NVML API to get temperatures. teamwork makes the dream work.
  • Via lm_sensors (libsensors interface) this is a modern and more reliable alternative to the sysfs hwmon interface mentioned above. It's basically a standardized abstraction for sysfs hwmon where sensors can always be identified uniquely, even when the load order of kernel modules changes. iconic. no more sensor identity crises.

πŸŒ€ Supported fans

Thinkfan can control any number of fans, which can be specified in two ways:

  • /proc/acpi/ibm/fan provided by the thinkpad_acpi kernel module. Note that the kernel module needs to be loaded with the option "fan_control=1" to enable userspace fan control. On some models, "experimental=1" may also be required. See the SEE ALSO section at the bottom of this manpage for a link to the official thinkpad_acpi documentation. (yes, we will get there. patience. 🧚)
  • pwm*_enable and pwm? files in sysfs provided by all modern hardware monitoring drivers, including thinkpad_acpi. modern queen behavior. πŸ‘‘

🌈 Mapping temperatures to fan speeds

There are two general modes of operation:

  • Detailed mode in detailed mode, temperature limits are defined for each sensor thinkfan knows about. Setting suitable limits for each sensor in your system will probably require a bit of experimentation and good knowledge about your hardware, but it's the safest way of keeping each component within its specified temperature range. See the example configs to learn about the syntax. highkey the responsible choice.
  • Simple mode in simple mode, thinkfan uses only the highest temperature found in the system. That may be dangerous, e.g. for hard disks. That's why you should provide a correction value (i.e. add 10-15 Β°C) for the sensor that has the temperature of your hard disk (or battery...). See the example config files for details about that. lowkey unhinged but it works if you do the math. πŸ™ˆ

πŸŽ€ CONFIGURATION πŸŽ€

All of the features described above are configured in the thinkfan config file. Its default location is /etc/thinkfan.conf or /etc/thinkfan.yaml (see also the -c option below).

An example configuration is provided with the source package. It is intended purely for illustration of various scenarios and is not suitable as a basis for actually functional config. do not just copy it, bestie, I am begging you. For a complete reference see the config man page thinkfan.conf(5).


πŸ’… OPTIONS πŸ’…

  • -h β€” Show a short help message. the "hello, what is this" flag.
  • -s SECONDS β€” Maximum seconds between temperature updates (default: 5). how often we do the vibe check on your temps.
  • -b BIAS β€” Floating point number (-10 to 30) to smooth out or amplify quick temperature changes. If a sensor's temperature increases by more than 2 Β°C during one cycle, we calculate an offset value as follows:
offset = delta_t * BIAS / 10

This offset is then added to the actual temperature:

biased_t = current_t + offset

If delta_t stays below 2 Β°C in subsequent loops, offset will be reduced back to 0 in increments of sgn(BIAS) * (1 + abs(BIAS/5)).

This means that a negative BIAS will even out short and sudden temperature spikes like those seen on some on-DIE sensors, while positive values will exaggerate increasing temperatures to compensate e.g. for sensors that respond slowly because they are attached to heavy heatsinks. (yes, it's literally therapy for your temperature readings. ✨)

Use DANGEROUS mode to remove the -10 to +30 limit. Note that you can't have a space between -b and a negative argument, because otherwise getopt will interpret things like -10 as an option and fail (i.e. write -b-10 instead of -b -10). classic getopt shenanigans, we've all been there. πŸ’€

The default is 0.

  • -c FILE β€” Load a different configuration file. By default, thinkfan first tries to load /etc/thinkfan.yaml, and /etc/thinkfan.conf after that. The former must be in YAML format, while the latter can be either YAML or the old legacy syntax.

If this option is specified, thinkfan attempts to load the config only from FILE. If its name ends in ".yaml", it must be in YAML format. Otherwise, it can be either YAML or legacy syntax. See thinkfan.conf(5) and thinkfan.conf.legacy(5) for details.

  • -n β€” Do not become a daemon and log to terminal instead of syslog. for the girlies who want to watch the logs happen in real time. πŸ‘€
  • -q β€” Be quiet, i.e. reduce logging level from the default. Can be specified multiple times until only errors are displayed/logged. stack it like skincare. 🧴
  • -v β€” Be more verbose. Can be specified multiple times until every message is displayed/logged. the opposite. also stackable. also valid.
  • -p [SECONDS] β€” Use the pulsing-fan workaround (for older Thinkpads). Takes an optional floating-point argument (0-10s) as depulsing duration. Default 0.5s. your fan was doing a little dance, this stops the dance.
  • -d β€” Do not read temperature from sleeping disks. Instead, 0 Β°C is used as that disk's temperature. This is needed if reading the temperature causes your disk to wake up unnecessarily. NOTE: This option is only available if thinkfan was built with -D USE_ATASMART. let sleeping disks lie. 😴
  • -D β€” DANGEROUS mode: Disable all sanity checks. May damage your hardware!! this is the main character flag and it is the villain arc flag. do not.

⭐ SIGNALS ⭐

  • SIGINT and SIGTERM simply interrupt operation and should cause thinkfan to terminate cleanly. polite exits only. 🫢
  • SIGHUP makes thinkfan reload its config. If there's any problem with the new config, we keep the old one. no notes, that's just good design.
  • SIGUSR1 causes thinkfan to dump all currently known temperatures either to syslog, or to the console (if running with the -n option). temperature receipts. 🧾
  • SIGPWR tells thinkfan that the system is about to go to sleep. Thinkfan will then allow sensor read errors for the next 4 loops because many sensors will take a few seconds before they are available again after waking up from a sleep state (suspend or hibernate). If the shipped systemd service file thinkfan-sleep.service is installed, it should take care of sending this singal when going to sleep. On non-systemd distributions, other mechanisms may have to be used. (yes, the original really does say "singal" and I am keeping it, character for character, because that's the rule and also it's cute.) 😭
  • SIGUSR2 tells thinkfan to re-initialize fan control. This is required by most fan drivers after waking up from suspend because they tend to reset fan control to automatic mode on wakeup. Similar to SIGPWR, the systemd service file thinkfan-wakeup.service should take care of sending this signal on wakeup on systemd systems. On non-systemd distributions, other mechanisms may have to be used. wake up bestie, we're controlling fans again. πŸŒ…

🌟 RETURN VALUE 🌟

  • 0 β€” Normal exit βœ…
  • 1 β€” Runtime error
  • 2 β€” Unexpected runtime error
  • 3 β€” Invalid commandline option

πŸ”₯ SEE ALSO πŸ”₯

The thinkfan config manpage: thinkfan.conf(5)

Example configs shipped with the source distribution, also available at: https://github.com/vmatare/thinkfan/tree/master/examples

The Linux hwmon user interface documentation: https://www.kernel.org/doc/html/latest/hwmon/sysfs-interface.html

The thinkpad_acpi interface documentation: https://www.kernel.org/doc/html/latest/admin-guide/laptops/thinkpad-acpi.html


πŸ’€ BUGS πŸ’€

If thinkfan tells you to, or if you feel like it, report issues at the Github issue tracker:

https://github.com/vmatare/thinkfan/issues


and that's the whole page bestie, you're officially a thinkfan scholar πŸŽ“πŸ’–

this has been thinkfan 2.0.0, April 2022 β€” go forth, configure responsibly, and please don't use -D. mwah 🫢✨