风扇

TOC

转速控制

默认是最高转速的,需要自己调整。

使用命令 pwmconfigsensors

pwmconfig 生成 /etc/fancontrol 文件,执行 systemctl start fancontrol 生效。

# 查看是否检测到风扇
$ sensors

nct6779-isa-0a20
Adapter: ISA adapter
Vcore:                 296.00 mV (min =  +0.00 V, max =  +1.74 V)
in1:                     0.00 V  (min =  +0.00 V, max =  +0.00 V)
AVCC:                    3.36 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
+3.3V:                   3.36 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in4:                     0.00 V  (min =  +0.00 V, max =  +0.00 V)
in5:                     0.00 V  (min =  +0.00 V, max =  +0.00 V)
in6:                     2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
3VSB:                    3.36 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
Vbat:                    3.28 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in9:                     1.06 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in10:                  152.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in11:                  128.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
in12:                    2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in13:                    1.24 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in14:                  160.00 mV (min =  +0.00 V, max =  +0.00 V)  ALARM
fan1:                     0 RPM  (min =    0 RPM)
fan2:                   690 RPM  (min =    0 RPM)
fan3:                     0 RPM  (min =    0 RPM)
fan4:                     0 RPM  (min =    0 RPM)
fan5:                     0 RPM  (min =    0 RPM)
SYSTIN:                 +44.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = thermal diode
CPUTIN:                -128.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = CPU diode
AUXTIN0:                -61.5°C    sensor = thermistor
AUXTIN1:               +102.0°C    sensor = thermistor
AUXTIN2:               +108.0°C    sensor = thermistor
AUXTIN3:                +22.0°C    sensor = thermal diode
PECI Agent 1:            +0.0°C
PECI Agent 0:           +57.0°C
PCH_CHIP_CPU_MAX_TEMP:   +0.0°C
PCH_CHIP_TEMP:           +0.0°C
intrusion0:            OK
intrusion1:            ALARM
beep_enable:           disabled

# 如果没有检测到风扇,执行这个命令来检查,根据检查结果做处理
sensors-detect

# 查看 CPU 的温度,可知 CPU 的高温临界值
$ sensors

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +36.0°C  (high = +60.0°C, crit = +70.0°C)
Core 0:        +27.0°C  (high = +60.0°C, crit = +70.0°C)
Core 1:        +30.0°C  (high = +60.0°C, crit = +70.0°C)
Core 2:        +26.0°C  (high = +60.0°C, crit = +70.0°C)
Core 3:        +30.0°C  (high = +60.0°C, crit = +70.0°C)
Core 4:        +26.0°C  (high = +60.0°C, crit = +70.0°C)
Core 5:        +28.0°C  (high = +60.0°C, crit = +70.0°C)
Core 6:        +30.0°C  (high = +60.0°C, crit = +70.0°C)
Core 7:        +31.0°C  (high = +60.0°C, crit = +70.0°C)

# temp 数能对应上 sensors 的数量
$ ls /sys/class/hwmon/hwmon1
device            temp1_label       temp3_crit        temp4_input       temp5_max         temp7_crit_alarm  temp8_label       uevent
name              temp1_max         temp3_crit_alarm  temp4_label       temp6_crit        temp7_input       temp8_max
power             temp2_crit        temp3_input       temp4_max         temp6_crit_alarm  temp7_label       temp9_crit
subsystem         temp2_crit_alarm  temp3_label       temp5_crit        temp6_input       temp7_max         temp9_crit_alarm
temp1_crit        temp2_input       temp3_max         temp5_crit_alarm  temp6_label       temp8_crit        temp9_input
temp1_crit_alarm  temp2_label       temp4_crit        temp5_input       temp6_max         temp8_crit_alarm  temp9_label
temp1_input       temp2_max         temp4_crit_alarm  temp5_label       temp7_crit        temp8_input       temp9_max

# 查看 Package id 0 的温度,即 36.0°C
$ cat /sys/class/hwmon/hwmon1/temp1_input
36000

# 查看 Package id 0 Core 0 的温度,即 26.0°C
cat /sys/class/hwmon/hwmon1/temp2_input
26000

/etc/fancontrol

# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon1=devices/platform/nct6775.2592 hwmon2=devices/platform/coretemp.0
DEVNAME=hwmon1=nct6779 hwmon2=coretemp
FCTEMPS=hwmon1/pwm2=hwmon2/temp1_input
FCFANS=hwmon1/pwm2=hwmon1/fan2_input
# The temperature (°C) at which to SHUT OFF the CPU fan. Efficient CPUs often will not need a fan while idling. Be sure to set this to a temperature that you know is safe. Setting this to 0 is not recommended and may ruin your hardware!
MINTEMP=hwmon1/pwm2=30
# The temperature (°C) at which to spin the fan at its MAXIMUM speed. This should be probably be set to perhaps 10 or 20 degrees (°C) below your CPU's critical/shutdown temperature. Setting it closer to MINTEMP will result in higher fan speeds overall.
MAXTEMP=hwmon1/pwm2=60
# The PWM value at which your fan starts to spin again. This is often a higher value than MINSTOP as more voltage is required to overcome inertia.
MINSTART=hwmon1/pwm2=120
# The PWM value at which your fan stops spinning. Each fan is a little different. Power tweakers can echo different values (between 0 and 255) to /sys/class/hwmon/hwmon0/device/pwm1 and then watch the CPU fan. When the CPU fan stops, use this value.
MINSTOP=hwmon1/pwm2=0
# The PWM value to use when the temperature is over MAXTEMP.  If this value isn't defined, it defaults to 255 (full speed).
MAXPWM=hwmon1/pwm2=255

其中 DEVPATH 可以在 /sys/ 目录下找到,比如 /sys/devices/platform/nct6775.2592 和 /sys/devices/platform/coretemp.0。DEVPATH 的填值不要包含 /sys/

系统重启后,配置过期

系统重启后 hwmon 的加载顺序可能会变,导致 fancontrol 的启动检查报下面的错。

Configuration appears to be outdated, please run pwmconfig again

具体可以查看 /usr/sbin/fancontrol 里的ValidateDevices 函数内容。

  • https://github.com/lm-sensors/lm-sensors/issues/227
  • https://wiki.archlinux.org/title/Fan_speed_control#Device_paths_have_changed_in_/etc/fancontrol

参考