Linux CPU Temperature and Fan Control#

Control speed of fans based on temperature readings.

sudo apt-get install -y lm-sensors fancontrol

Temperature Readings with sensors#

sensors

For us, CPU temperature is present, but bridge is missing. Looks like we need additional kernel modules.

Show modules to load:

sensors-detect

Configure them for systemd

cat <<'EOF' > /etc/modules-load.d/lm-sensors.conf
# from running `sensors-detect`
coretemp
nct6775
EOF

systemctl status systemd-modules-load.service
systemctl restart systemd-modules-load.service
systemctl status systemd-modules-load.service

Both CPU and bridge temperatures are present.

sensors

Her is our output of sensors -u.

fancontrol#

  1. open case to check fans visually

  2. run pwmconfig to generate /etc/fancontrol

  3. start fancontrol daemon

  4. close case

Stop fancontrol and run pwmconfig

systemctl stop fancontrol.service
pwmconfig

Check the fans found:

Found the following fan sensors:
   hwmon1/fan1_input     current speed: 0 ... skipping!
   hwmon1/fan2_input     current speed: 2054 RPM
   hwmon1/fan3_input     current speed: 0 ... skipping!
   hwmon1/fan4_input     current speed: 1238 RPM
   hwmon1/fan5_input     current speed: 1247 RPM

Walk through the rest of the wizard and write /etc/fancontrol.

Enable fancontrol

systemctl enable --now fancontrol

Note to Self#

140mm (side):

It appears that fan hwmon1/fan5_input
is controlled by pwm hwmon1/pwm3

120mm (back):

It appears that fan hwmon1/fan2_input
is controlled by pwm hwmon1/pwm2

Stress and Tune#

apt install stress-ng
stress-ng --cpu 8
watch sensors

Further Reading#