Start out by man fancontrol
to get a feel for what variables can be used in /etc/fancontrol
. You will need the following when building the config: INTERVAL, FCTEMPS, FCFANS, MINTEMP, MAXTEMP, MINSTART, MINSTOP.
# Checks the temperature every 10 seconds.
INTERVAL=10
# Maps a fan to a temp sensor, each separated by a space
FCTEMPS=fanpath=temppath fanpath2=temppath2
# Maps a fan to the fan speed sensor
FCFANS=fanpath=fanspeedpath fanpath2=fanspeedpath2
# The temperature below which the fan gets switched to minimum speed.
MINTEMP=fanpath=degreesC fanpath2=degreesC2
# The temperature over which the fan gets switched to maximum speed.
MAXTEMP=fanpath=degreesC fanpath2=degreesC2
# Sets the minimum speed at which the fan begins spinning.
MINSTART=fanpath=minspeed fanpath2=minspeed2
#The minimum speed at which the fan still spins.
MINSTOP=fanpath=minspeed fanpath2=minspeed2
Actual Sample:
INTERVAL=10
FCTEMPS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input
FCFANS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan5_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan4_input /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=
MINTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=55 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=50 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=55
MAXTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=60 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=60 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=60
MINSTART=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=70 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=70 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=70
MINSTOP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=90 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=90 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=90
The [[:print:]] represent the hwmon number. You can use the actual number or the [[:print:]], sometimes the number changes between boots and the [[:print:]] allows it to find the correct hwmon number.
The issue will be FCFANS, whether fan1_input has valid data, and if not, whether fancontrol will continue to work without that.
Alternatively, you could attempt to write your own script that would set the value of hwmon2/pwm1, it ranges between 0 and 255.
I found a solution for my Vostro 5481. It might work for you (and others) as well.
Required
git clone https://github.com/TomFreudenberg/dell-bios-fan-control.git
cd dell-bios-fan-control
make
sudo ./dell-bios-fan-control 0
If you get an error like this
ioperm:: Operation not permitted
ioperm:: Operation not permitted [1]
4701 segmentation fault
you need to go to your BIOS/UEFI and disable SECURE BOOT. Then run the command again. Output should now be BIOS CONTROL DISABLED
.
Quick testing
You can now go and check solutions for controlling the fan that suite your needs. If you want to quickly test, you can use i8kutils:
git clone https://github.com/vitorafsr/i8kutils
cd i8kutils
make
sudo ./i8kctl fan 2 2
Your fan should now run at the highest possible settings without the BIOS/UEFI interfering.
Controlling the fan in day to day business
Now that your BIOS/UEFI is no longer controlling the fan, you have to take care of it on your own. I'd suggest https://linux.die.net/man/8/fancontrol for this. It can easily be configured using pwmonfig
(which ships with it) and adds itself as a system service.
Big THANKS
Shoutout to Tom Freudenberg for creating dell-bios-fan-control
and for pointing me to disabling SECURE_BOOT
when I got the Operation not permitted
error.
https://github.com/TomFreudenberg
https://askubuntu.com/users/293845/tom-freudenberg.
Best Answer
Note before starting:
This functionality depends on both your hardware and software. If your hardware doesn't support fan speed controls, or doesn't show them to the OS, it is very likely that you could not use this solution. If it does, but the software (aka kernel) doesn't know how to control it, you are without luck.
Install the lm-sensors and fancontrol packages.
Configure lm-sensors as follows:
In terminal type
sudo sensors-detect
and answer YES to all YES/no questions.(Potentially, this can damage your system or cause system crash. For a lot of systems, it is safe. There is no guarantee that this process will not damage your system permanently, I just think that chance of such critical failure is really really low. Saving all your work for eventual crashes/freezes/restarts before handling system configuration is always good idea. If you feel unsure, read the comments and try to search a web and get some high-level overview before YES-ing everything, maybe being selective with your YES-es will still be enough)
At the end of sensors-detect, a list of modules that need to be loaded will be displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
Run
sudo service kmod start
This will read the changes you made to/etc/modules
in step 3, and insert the new modules into the kernel.sudo service module-init-tools restart
Configure fancontrol
sudo pwmconfig
. This script will stop each fan for 5 seconds to find out which fans can be controlled by which PWM handle. After script loops through all fans, you can configure which fan corresponds to which temperature./etc/fancontrol
and usesudo service fancontrol restart
to apply your changes. (In my case I set interval to 2 seconds.)Set up fancontrol service
sudo service fancontrol start
. This will also make the fancontrol service run automatically at system startup.In my case
/etc/fancontrol
for CPU I used:Settings for hwmon0/device/pwm2:
(Depends on hwmon0/device/temp2_input) (Controls hwmon0/device/fan2_input)
and on a different system it is:
here is some useful info on the settings and what they really do