1. Introduction

Controlling fan speed allows us to extend the lifespan of system hardware and improve the performance of both hardware and software. At the least, it can improve power efficiency while minimizing heat-driven hardware deterioration and ensuring programs run as they should.

In this tutorial, we’ll discuss ways of controlling fan speed in Linux.

2. Using fancontrol

lm-sensors is a tool used to monitor the hardware sensors present in a system, including temperature, fan speed, and voltage sensors.

fancontrol is an lm-sensors utility that regulates fan speed according to system temperature. Of course, we get to configure what the speed would be at different temperatures.

2.1. Installing lm-sensors

To use fancontrol on our Debian-based system, we’ll install lm-sensors using apt:

$ sudo apt update && sudo apt install lm-sensors

However, if we are using an RHEL-based distro like CentOS, we’ll install lm-sensors using dnf:

$ sudo dnf -y install lm_sensors

Then, after installing lm-sensors, we’ll verify the installation:

$ sensors -v
sensors version 3.6.0 with libsensors version 3.6.0

2.2. Detecting Sensors and Determining Modules to Load

Before configuring fancontrol to manage fan speed, we’ll check for the available sensors and the kernel modules to load on the system:

$ sudo sensors-detect

When we run sensors-detect, we’ll get at least four prompts.

The first prompt typically checks for CPU-embedded sensors, south bridges, and memory controllers. Then, at the least, the other prompts would check for ISA I/O ports, I2C/SMBus adapters, and sensors embedded in super I/O chips.

sensors-detect will let us know if it detected any sensor. Then, it may also return a list of kernel modules we need to load for lm-sensors to work correctly.

Running sensors helps us confirm whether the sensors are working fine or not:

$ sensors
Adapter: ISA adapter
Package id 0:  +35.0°C  (high = +80.0°C, crit = +100.0°C)
Core 0:        +33.0°C  (high = +80.0°C, crit = +100.0°C)
Core 1:        +31.5°C  (high = +80.0°C, crit = +100.0°C)


Adapter: ACPI interface
Vcore Voltage:     1.08 V  (min =  +0.80 V, max =  +1.60 V)
+3.3 Voltage:      3.32 V  (min =  +2.97 V, max =  +3.63 V)
+5 Voltage:        5.03 V  (min =  +4.50 V, max =  +5.50 V)
+12 Voltage:      12.10 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:    1200 RPM  (min =  600 RPM, max = 2000 RPM)
Chassis FAN Speed:1200 RPM  (min =  600 RPM, max = 2000 RPM)

In some cases, the fan speed may not be displayed or be zero. To change that, we could increase the divisor for fan sensors while configuring fancontrol.

2.3. Configuring fancontrol

After running sensors-detect, we’ll run pwmconfig to configure fancontrol:

$ sudo pwmconfig

Ordinarily, pwmconfig and fancontrol should be available after installing lm-sensors. But in some cases, we may have to install fancontrol separately to use pwmconfig and fancontrol.

pwmconfig searches for sensors that support pulse-width modulation control. While running, it will return various prompts for the configuration of the detected sensors. However, the prompts may differ according to hardware and system config.

Once pwmconfig is done running, the system will create a configuration file, /etc/fancontrol:

$ cat /etc/fancontrol

As shown above, /etc/fancontrol contains our inputs to the prompts from pwmconfig. We can edit it if we need to update or change fancontrol configurations.

After creating the fancontrol configuration file, we’ll start the fancontrol daemon:

$ sudo systemctl start fancontrol

Once that is done, fancontrol can now control fan speed according to the configurations defined in /etc/fancontrol.

3. Using nbfc-linux

nbfc-linux is short for “Notebook Fan Control – Linux”. It’s a Linux implementation of the original nbfc, and it controls fan speed according to set temperature thresholds.

3.1. Installing nbfc-linux

To install nbfc-linux, we’ll clone the GitHub repo first:

$ git clone https://github.com/nbfc-linux/nbfc-linux.git

Then, we’ll cd into the local copy of the repo and install the package with make and make install:

$ cd nbfc-linux/ && make && sudo make install

3.2. Using nbfc-linux

After installing nbfc-linux, we’ll have it suggest a fitting configuration for our system:

$ nbfc config -r

Alternatively, we could get a list of pre-made configurations:

$ nbfc config -l
Acer Aspire 1410
Asus Zenbook UX530U
Dell Inspiron 7348
HP Laptop 14-cm0xxx
Xiaomi Mi Book (TM1613, TM1703)

Then, we can apply one of those configurations to our system:

$ sudo nbfc config -a "HP Laptop 14-cm0xxx"

After applying the configuration, we can start the nbfc service:

$ sudo nbfc start

4. Hardware-Specific Fan Control Tools

nbfc-linux and fancontrol offer non-hardware-specific fan control. But there are hardware-specific fan control tools that may come in handy where the non-specific options fail.

  • i8kutils is a tool for controlling fan speed and monitoring temperature on some Dell laptops. While it comes with its default configurations, users can change the configuration as needed.
  • thinkfan is a fan control tool that controls fan speed on Thinkpad laptops according to temperature thresholds defined in a config file.
  • macfanctld gets CPU temperature data from fan sensors on Macbooks. Then it controls the fan speed based on the collected data.

5. Conclusion

In this article, we discussed two tools for controlling fan speed on various laptop models, focusing on their installation and some of their key functions. Then, we highlighted some common hardware-specific tools for controlling fan speed.
Comments are closed on this article!