Fan Speed Control - ArchWiki
Fan Speed Control - ArchWiki
Fan control can bring various benefits to your system, such as quieter working system and power saving by completely stopping fans on low CPU Related articles
load.
lm_sensors
Warning: Configuring or completely stopping fans on high system load might result in permanently damaged hardware, or thermal throttling at best.
Undervolting CPU
CPU frequency scaling
1 Overview
Note: Laptop users should be aware about how cooling system works in their hardware. Some laptops have single fan for both CPU and GPU and cools both at the same time. Some laptops have two fans for CPU and GPU,
but the first fan cools down CPU and GPU at the same time, while the other one cools CPU only. In some cases, you will not be able to use the Fancontrol script due to incompatible cooling architecture (e.g. one fan for
both GPU and CPU). Here (https://github.com/daringer/asus-fan/issues/47#issue-232063547) is some more information about this topic.
There are multiple working solutions for fan control for both desktops and notebooks. Depending on your needs:
▪ Fancontrol (lm-sensors) — Script (written in Bash) to configure fan speeds. Most suitable for desktops and laptops, where fan controls are available via
sysfs(5) (https://man.archlinux.org/man/sysfs.5).
▪ NoteBook Fan Control (NBFC) — Cross-platform solution for laptop fan control, written in C# and works under Mono runtime. Most suitable for latest,
unsupported by Fancontrol laptops.
▪ Dell laptops — Alternative fan control daemon for some Dell laptops.
▪ ThinkPad laptops — Fan configuration for some ThinkPad laptops.
▪ Lenovo Legion Linux (https://github.com/johnfanv2/LenovoLegionLinux) — Fan speed configuration and other settings for some Lenovo Legion
laptops.
▪ ASUS laptops — Configure some ASUS laptops for Fancontrol or manual control.
▪ fan2go-git (https://aur.archlinux.org/packages/fan2go-git/)AUR — An alternative to Fancontrol independent of device-paths.
▪ MControlCenter (https://github.com/dmitry-s93/MControlCenter) — Fan control application for MSI laptops.
▪ fw-ectool-git (https://aur.archlinux.org/packages/fw-ectool-git/)AUR — Fan configuration for Framework Laptops.
▪ CoolerControl (https://aur.archlinux.org/packages/CoolerControl/)AUR — A fan control daemon with GUI for sysfs and liquidctl (https://ar
chlinux.org/packages/?name=liquidctl) devices.
2 Fancontrol (lm-sensors)
fancontrol is a part of lm_sensors (https://archlinux.org/packages/?name=lm_sensors), which can be used to control the speed of CPU/case fans.
Support for newer motherboards may not yet be in the Linux kernel. Check the official lm-sensors devices (https://hwmon.wiki.kernel.org/device_support_status) table to see if experimental
drivers are available for such motherboards.
2.1 lm-sensors
The first thing to do is to run
# sensors-detect
This will detect all of the sensors present and they will be used for fancontrol. After that, run the following to check if it detected the sensors correctly:
$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +29.0°C (high = +76.0°C, crit = +100.0°C)
...
it8718-isa-0290
Adapter: ISA adapter
Vcc: +1.14 V (min = +0.00 V, max = +4.08 V)
VTT: +2.08 V (min = +0.00 V, max = +4.08 V)
+3.3V: +3.33 V (min = +0.00 V, max = +4.08 V)
NB Vcore: +0.03 V (min = +0.00 V, max = +4.08 V)
VDRAM: +2.13 V (min = +0.00 V, max = +4.08 V)
fan1: 690 RPM (min = 10 RPM)
temp1: +37.5°C (low = +129.5°C, high = +129.5°C) sensor = thermistor
temp2: +25.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode
Note: If the output does not display an RPM value for the CPU fan, one may need to #Increase the fan divisor for sensors. If the fan speed is shown and higher than 0, this is fine.
2.2 Configuration
Once the sensors are properly configured, use pwmconfig(8) (https://man.archlinux.org/man/pwmconfig.8) to test and configure fan speed control. Following the guide
should create /etc/fancontrol , a customized configuration file. In the guide, the default answers are in parenthesis if you press enter without typing anything. Enter y for yes, n for no.
# pwmconfig
Note: Some users may experience issues when using /sys/class/hwmon/ paths for their configuration file. hwmon class device symlinks point to the absolute paths, and are used to group all of the hwmon sensors
together into one directory for easier access. Sometimes, the order of the hwmon devices change from a reboot, causing fancontrol to stop working. See #Device paths have changed in /etc/fancontrol for more information
on how to fix this.
2.2.1 Tweaking
Some users may want to manually tweak the configuration file after running pwmconfig with root privileges, usually to fix something. For manually tweaking the /etc/fancontrol
configuration file, see fancontrol(8) (https://man.archlinux.org/man/fancontrol.8) for the variable definitions.
Users will probably encounter the hwmon path issues as noted above in #Fancontrol (lm-sensors). See #Device paths have changed in /etc/fancontrol for more information.
Tip: Use MAXPWM and MINPWM options that limit fan speed range. See fancontrol(8) (https://man.archlinux.org/man/fancontrol.8) for details.
Note: Temperature and fan sensor paths could change as well (usually on a kernel update) (e.g. hwmon0/device/temp1_input becomes hwmon0/temp1_input ). Check the fancontrol.service unit
status to find out which path is the troublemaker and correct your configuration file accordingly.
# fancontrol
A properly configured setup will not output errors and will take control of the system fans. Users should hear system fans starting shortly after executing this command. fancontrol can also be run by
starting/enabling fancontrol.service .
3 NBFC
Note: NBFC has been unmaintained since Mar 29, 2020. New user configs can still be created manually, however predefined configurations have not been added since that time. There are forks that exist to add new configs,
such as nbfc-revive (https://github.com/UraniumDonut/nbfc-revive).
NBFC is a cross-platform fan control solution for notebooks. It comes with a powerful configuration system, which allows to adjust it to many different notebook models, including some of the latest
ones.
3.1 Installation
3.2 Configuration
NBFC comes with pre-made profiles. You can find them in /opt/nbfc/Configs/ directory. When applying them, use the exact profile name without a file extension (e.g.
some profile.xml becomes "some profile" ).
$ nbfc config -r
If there is at least one model, try to apply this profile and see how fan speeds are being handled. For example:
Note: If you are getting File Descriptor does not support writing , delete StagWare.Plugins.ECSysLinux.dll [1] (https://github.com/hirschmann/nbfc/issues/439) and restart
nbfc.service :
# mv /opt/nbfc/Plugins/StagWare.Plugins.ECSysLinux.dll /opt/nbfc/Plugins/StagWare.Plugins.ECSysLinux.dll.old
If above solution did not help, try appending ec_sys.write_support=1 to kernel parameters.
If there are no recommended models, go to NBFC git repository (https://github.com/hirschmann/nbfc/tree/master/Configs) or /opt/nbfc/Configs/ and check if there are any similar
models available from the same manufacturer. For example, on Asus Zenbook UX430UQ, the configuration Asus Zenbook UX430UA did not work well (fans completelly stopped all the time),
but Asus Zenbook UX410UQ worked fantastically.
Run nbfc to see all options. More information about configuration is available at upstream wiki (https://github.com/hirschmann/nbfc/wiki/).
4 NBFC-Linux
NBFC-Linux (https://github.com/nbfc-linux/nbfc-linux) is a lightweight implementation of NBFC, written in C. It does not depend on the Mono framework. It can be installed as nbfc-linux
(https://aur.archlinux.org/packages/nbfc-linux/)AUR or nbfc-linux-git (https://aur.archlinux.org/packages/nbfc-linux-git/)AUR.
5 Dell laptops
i8kutils is a daemon to configure fan speed according to CPU temperatures on some Dell Inspiron and Latitude laptops. It uses the /proc/i8k interface provided by the i8k driver (an alias for
dell_smm_hwmon ). Results will vary depending on the exact model of laptop.
If fancontrol will not work on your system, use the ignore_dmi=1 kernel module parameter to load dell_smm_hwmon .
Warning: i8kutils BIOS system calls stop the kernel for a moment on some systems (confirmed on Dell 9560), this can lead to side effects like audio dropouts, see https://bugzilla.kernel.org/show_bug.cgi?id=201097
5.1 Installation
i8kutils (https://aur.archlinux.org/packages/i8kutils/)AUR is the main package to control fan speed. Additionally, you might want to install these:
5.2 Configuration
The temperature points at which the fan changes speed can be adjusted in the configuration file /etc/i8kutils/i8kmon.conf . Only three fans speeds are supported (high, low, and off).
Look for a section similar to the following:
Tip: If when running i8kmon with the verbose option you notice that the state changes (example of an output: # (57>=55), state=1, low=45, high=75 ) but right and left fans report state 0, you might
consider changing the speed value of the first state in the configuration file from default 1000 to 2000 or higher.
Some newer laptops have BIOS fan control in place which will override the OS level fan control. To test if this the case, run i8kmon with verbose mode in a command line, make sure the CPU is
idle, then see if the fan is turned off or turned down accordingly.
If the BIOS fan control is in place, you can try using dell-bios-fan-control-git (https://aur.archlinux.org/packages/dell-bios-fan-control-git/)AUR:
Warning: Turning off BIOS fan control could result in damage to your hardware. Make sure you have i8kmon properly set up beforehand, or leave the CPU idle while you test this program.
# dell-bios-fan-control 1
# dell-bios-fan-control 0
6 ThinkPad laptops
Some fan control daemons include simpfand-git (https://aur.archlinux.org/packages/simpfand-git/)AUR and thinkfan (https://aur.archlinux.org/pac
kages/thinkfan/)AUR (recommended).
6.1 Installation
Note that the thinkfan package installs /usr/lib/modprobe.d/thinkpad_acpi.conf , which contains the following kernel module parameter:
Note: New Thinkpad models may require an additional experimental=1 kernel module parameter. So, it is important to check fan functionality.
# modprobe thinkpad_acpi
# cat /proc/acpi/ibm/fan
You should see that the fan level is "auto" by default, but you can echo a level command to the same file to control the fan speed manually:
Fan Levels
Level Effect
0 off
2 low speed
4 medium speed
7 maximum speed
auto default - automatic, the fan RPM is controlled by the BIOS
full-speed the maximum fan speed while being monitored
disengaged even faster speed, where the controller does not monitor the fan speed
"7" is not the same as "disengaged". "7" is the maximum regulated speed (corresponds to "full-speed"). disengaged is the maximum unregulated speed. See ThinkWiki (https://www.thinkwiki.org
/wiki/How_to_control_fan_speed#Disengaged_.28full-speed.29_mode) for more details.
To configure the temperature thresholds, you will need to copy the example configuration file ( /usr/share/doc/thinkfan/examples/thinkfan.yaml ) to
/etc/thinkfan.conf , and modify to taste. This file specifies which sensors to read, and which interface to use to control the fan. Some systems have /proc/acpi/ibm/fan and
/proc/acpi/ibm/thermal available; on others, you will need to specify something like:
hwmon: /sys/devices/virtual/thermal/thermal_zone0/temp
# thinkfan -n
and see how it reacts to the load level of whatever other programs you have running.
Then the fan curve can be set via the hwmon interface. This can be done with the provided script or the Python GUI.
8 ASUS laptops
This topic will cover drivers configuration on ASUS laptops for Fancontrol (lm-sensors).
In configuration files, we are going to use full paths to sysfs files (e.g. /sys/devices/platform/asus-nb-wmi/hwmon/hwmon[[:print:]]*/pwm1 ). This is because hwmon1
might change to any other number after reboot. Fancontrol (lm-sensors) is written in Bash, so using these paths in configuration file is completely acceptable. You can find complete
/etc/fancontrol configuration file examples at ASUS N550JV#Fan control.
8.1.1 asus-nb-wmi
asus-nb-wmi is a kernel module, which is included in the Linux kernel and is loaded automatically on ASUS laptops. It will only allow to control a single fan and if there is a second fan you
will not have any controls over it. Note that blacklisting this module will prevent keyboard backlight to work.
Below are the commands to control it. Check if you have any controls over your fan:
If you were able to modify fan speed with above commands, then continue with #Generate configuration file with pwmconfig.
8.1.2 asus_fan
asus_fan is a kernel module, which allows to control both fans on some older ASUS laptops. It does not work with the most recent models.
# modprobe asus_fan
# echo 255 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm1 # Full CPU fan speed (Value: 255)
# echo 0 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm1 # CPU fan is stopped (Value: 0)
# echo 255 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm2 # Full GFX fan speed (Value: 255)
# echo 0 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm2 # GFX fan is stopped (Value: 0)
# echo 2 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm1_enable # Change CPU fan mode to automatic
# echo 1 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm1_enable # Change CPU fan mode to manual
# echo 2 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm2_enable # Change GFX fan mode to automatic
# echo 1 > /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/pwm2_enable # Change GFX fan mode to manual
# cat /sys/devices/platform/asus_fan/hwmon/hwmon[[:print:]]*/temp1_input # Display GFX temperature (will always be 0 when GFX is disabled/unused)
If everything works, you can load the module at boot to automate this step.
If you get an error There are no working fan sensors, all readings are 0 while generating configuration file with pwmconfig , open first console and execute:
If you use asus_fan kernel module and have 2nd fan, in second console:
# pwmconfig
Once you are done and the configuration file is generated, you should stop the first and second consoles. Continue with #Fancontrol (lm-sensors). After the configuration file is generated, you
might need to manually replace PWM values with full sysfs paths as they are used in these steps, because hwmon number values might change after reboot.
In ASUS FX504GD model setting the fan speed to one of the three modes uses these register values:
If these values do not work for you, run the ec-probe tool in monitor mode in Windows and try to identify which register in the EC changes value when switching through fan speed modes.
Instead of manually controlling fan speed using asus-nb-wmi , it is also possible to set the thermal throttling policy (https://patchwork.kernel.org/project/platform-driver-x86/patch/20191
[email protected]/) to have a more or less aggressive fan control policy. Possible values are 0 (default), 1 (overboost), and 2 (silent).
On certain ASUS TUF series laptops, performance and fan control modes can be changed using Fn+F5 . The current mode can be viewed by running the following command:
$ cat /sys/devices/platform/asus-nb-wmi/fan_boost_mode
You can view the value changing as you use press Fn+F5 . 0 is "Normal Mode", 1 is "Performance Mode", 2 is most likely "Silent Mode".[2] (https://lore.kernel.org/lkml/72b3e0aa-d53a-8a82-
[email protected]/) It is also possible to write these values into the fan_boost_mode file as root and have the desired effect.
This was tested on the ASUS TUF FX504GE and ASUS TUF FX504GD models and found to be working.
Set up fan speed to e.g. 50% (100% are 255 PWM cycles, thus calculate desired fan speed percentage by multiplying its value by 2.55):
Warning: Resetting fan speed to auto may not work due to a driver bug and instead a restart of the driver may be required as a workaround.
Note: On RDNA3 GPUs it is not possible to manually adjust the fan speeds due to firmware limitations, however as of August 9th 2023 an interface for adjusting the fan curves was under development[3] (https://gitlab.free
desktop.org/drm/amd/-/issues/2764#note_2031564)
9.2 amdgpu-fan
The amdgpu-fan (https://aur.archlinux.org/packages/amdgpu-fan/)AUR package is an automated fan controller for AMDGPU-enabled video cards written in Python. It
uses a "speed-matrix" to match the frequency of the fans with the temperature of the GPU, for example:
9.3 amdfand-bin
For this tool there are also GUI clients available: amdguid-glow-bin (https://aur.archlinux.org/packages/amdguid-glow-bin/)AUR (Xorg) and amdguid-wayland-
bin (https://aur.archlinux.org/packages/amdguid-wayland-bin/)AUR (Wayland). Before starting the client you need to enable/start amdgui-helper.service .
# cat /sys/class/drm/card0/device/hwmon/hwmon0/temp1_input
This outputs GPU temperature in °C + three zeroes, e.g. 33000 for 33°C.
The bash script amdgpu-fancontrol (https://github.com/grmat/amdgpu-fancontrol) by grmat offers a fully automatic fan control by using the described sysfs hwmon functionality. It also allows
to comfortably adjust the fancurve's temperature/PWM cycles assignments and a hysteresis by offering abstracted configuration fields at the top of the script.
Tip: In order to function correctly, the script needs at least three defined temperature/PWM cycles assignments.
For safety reasons, the script sets fan control again to auto when shutting down. This may cause spinning up of fans, which can be worked around at cost of security by setting set_fanmode 1
in the section function reset_on_fail .
It may also be required to restart the script via a root-resume.service after hibernation in order to make it automatically function properly again:
/etc/systemd/system/root-resume.service
[Unit]
Description=Local system resume actions
After=suspend.target
[Service]
Type=simple
ExecStart=/usr/bin/systemctl restart amdgpu-fancontrol.service
[Install]
WantedBy=suspend.target
10 Troubleshooting
The first line of the sensors output is the chipset used by the motherboard for readings of temperatures and voltages.
/etc/sensors.d/fan-speed-control.conf
chip "coretemp-isa-*"
set fanX_div 4
Replacing coretemp-isa- with name of the chipset and X with the number of the CPU fan to change.
# sensors -s
Run sensors again, and check if there is an RPM readout. If not, increase the divisor to 8, 16, or 32. Your mileage may vary.
The enumerated hwmon symlinks located in /sys/class/hwmon/ might vary in order because the kernel modules do not load in a consistent order per boot. Because of this, it may cause
fancontrol to not function correctly. The error is "Configuration appears to be outdated, please run pwmconfig again". Upstream bug (https://github.com/lm-sensors/lm-sensors/issues/227).
10.2.1 Solution
In /etc/conf.d/lm_sensors , there are 2 arrays that list all of the modules detected when you execute sensors-detect . These get loaded in by fancontrol. If the file does not exist, run
sensors-detect as root, accepting the defaults. Open (or create) /etc/modules-load.d/modules.conf . Get all of the modules listed from the 2 variables in
/etc/conf.d/lm_sensors/ and place them into the /etc/modules-load.d/modules.conf file, one module per line. Specifying them like this should make a defined order for
the modules to load in, which should make the hwmon paths stay where they are and not change orders for every boot. If this does not work, I highly recommend finding another program to control
your fans. If you cannot find any, then you could try using the alternative solution below.
Using absolute file paths in fancontrol does not work by default, as its helper script pwmconfig is programmed to only use the hwmon paths to get the files. The way it does this is that it detects
whether the hwmon path that is provided in its configuration file /etc/fancontrol did not change, and uses the variables DEVNAME and DEVPATH to determine such change. If your
hwmon paths keep changing, this will prevent fancontrol from running no matter what you do. However, one can circumvent this problem. Open /usr/bin/fancontrol , and comment out this
part of the script:
Note:
▪ Doing this may make fancontrol write into files you gave it in the configuration file, no matter what the file is. This can corrupt files if you provide the
wrong path. Be sure that you are using the correct path for your files.
▪ Another thing to note is that while doing this workaround, using pwmconfig to create your script again will overwrite all of your absolute paths that you
have configured. Therefore, it is better to manually change the old paths to the new paths if it is needed instead of using pwmconfig.
Commenting this out should effectively ignore the hwmon validation checks. You can also ignore the variables DEVNAME and DEVPATH in the configuration file as well. After this, replace all of
the hwmon paths in the other variables with its absolute path. To make it easier, rerun pwmconfig with root privileges to refresh the hwmon devices. The hwmon paths in the configuration file
should now point to the correct absolute paths. For each hwmon path, run the following command (where N is the enumeration of the hwmon path):
$ readlink -f /sys/class/hwmon/hwmonN/device
FCTEMPS=hwmon2/pwm1=hwmon3/temp1_input
Executing readlink -f /sys/class/hwmon/hwmon3/device can, for example, output /sys/devices/platform/coretemp.0/ . cd into this directory. If you see a
/hwmon/hwmonN/ directory, you have to do this in your fancontrol configuration file to replace the hwmonN path. From the previous example:
# BEFORE
FCTEMPS=hwmon2/pwm1=hwmon3/temp1_input
# AFTER
FCTEMPS=hwmon2/pwm1=/sys/devices/platform/coretemp.0/hwmon/[[:print:]]*/temp1_input
Essentially, you must replace the hwmon path with the absolute path, concatenated with /hwmon/[[:print:]]*/ so that bash can catch the random enumerated hwmon name.
If you do not see the /hwmon/hwmonN/ directory, then you do not have to worry about this. This means that the temperature files are in the root of the device directory. Just replace hwmonN/
with the absolute file path. For example:
#BEFORE
FCTEMPS=hwmon2/pwm1=hwmon3/temp1_input
#AFTER
FCTEMPS=hwmon2/pwm1=/sys/devices/platform/coretemp.0/temp1_input