安装
apt install pwmconfig fancontrol
pwmconfig
直接启动pwmconfig
root@pve:~# pwmconfig
# pwmconfig version 3.6.0
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.
We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.
Found the following devices:
hwmon0 is acpitz
hwmon1 is nvme
hwmon2 is coretemp
hwmon3 is nct6798
Found the following PWM controls:
hwmon3/pwm1 current value: 255
hwmon3/pwm2 current value: 255
hwmon3/pwm3 current value: 255
hwmon3/pwm4 current value: 153
hwmon3/pwm5 current value: 153
hwmon3/pwm6 current value: 255
hwmon3/pwm7 current value: 255
Giving the fans some time to reach full speed...
Found the following fan sensors:
hwmon3/fan1_input current speed: 0 ... skipping!
hwmon3/fan2_input current speed: 2732 RPM
hwmon3/fan3_input current speed: 0 ... skipping!
hwmon3/fan4_input current speed: 0 ... skipping!
hwmon3/fan5_input current speed: 0 ... skipping!
hwmon3/fan6_input current speed: 2119 RPM
hwmon3/fan7_input current speed: 2596 RPM
Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue:
启动后pwmconfig会让所有风扇都运转在最高转速
此处按下回车之后开始对每个风扇进行识别,会调整风扇转速到最低,需要注意观察机箱中哪个风扇正在被控制
此处测试了第一个风扇控制器,在上一步Found the following fan sensors:
观察到,只有2,6,7号控制器有连接风扇,此处1、3、4、5没有安装风扇,无需测试可以直接输入n
跳过
Testing pwm control hwmon3/pwm1 ...
hwmon3/fan2_input ... speed was 2732 now 2732
no correlation
hwmon3/fan6_input ... speed was 2119 now 2188
no correlation
hwmon3/fan7_input ... speed was 2596 now 2428
no correlation
No correlations were detected.
There is either no fan connected to the output of hwmon3/pwm1,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)
Did you see/hear a fan stopping during the above test (n)? n
输入y
执行对于风扇2的测试
此处尝试逐步降低风扇转速,知道风扇停转
Testing pwm control hwmon3/pwm2 ...
hwmon3/fan2_input ... speed was 2732 now 504
It appears that fan hwmon3/fan2_input
is controlled by pwm hwmon3/pwm2
Would you like to generate a detailed correlation (y)?
PWM 255 FAN 2732
PWM 240 FAN 2561
PWM 225 FAN 2450
PWM 210 FAN 2389
PWM 195 FAN 2220
PWM 180 FAN 2146
PWM 165 FAN 1979
PWM 150 FAN 1909
PWM 135 FAN 1721
PWM 120 FAN 1632
PWM 105 FAN 1451
PWM 90 FAN 1359
PWM 75 FAN 1196
PWM 60 FAN 1080
PWM 45 FAN 943
PWM 30 FAN 805
PWM 28 FAN 772
PWM 26 FAN 740
PWM 24 FAN 739
PWM 22 FAN 711
PWM 20 FAN 682
PWM 18 FAN 677
PWM 16 FAN 655
PWM 14 FAN 626
PWM 12 FAN 607
PWM 10 FAN 594
PWM 8 FAN 567
PWM 6 FAN 544
PWM 4 FAN 547
PWM 2 FAN 511
PWM 0 FAN 510
此处选择居于哪个温度传感器控制PWM调速
此处的选项来自/sys/class/hwmon/
下文件,通过观察/sys/class/hwmon<数字>/name
可以知道此处对应系统哪个硬件的温度,之后通过sensors
找到此温度对应的文件,选择后会通过此文件进行调速
Select a temperature sensor as source for hwmon3/pwm7:
1. hwmon0/temp1_input 10) hwmon3/temp3_input
2. hwmon1/temp1_input 11) hwmon3/temp4_input
3. hwmon1/temp2_input 12) hwmon3/temp5_input
4. hwmon1/temp3_input 13) hwmon3/temp6_input
5. hwmon2/temp1_input 14) hwmon3/temp7_input
6. hwmon2/temp2_input 15) hwmon3/temp8_input
7. hwmon2/temp6_input 16) hwmon3/temp9_input
8. hwmon3/temp1_input 17) None (Do not affect this PWM output)
9. hwmon3/temp2_input
# 风扇起转温度
Enter the low temperature (degree C)
below which the fan should spin at minimum speed (20): 50
# 最高温度
Enter the high temperature (degree C)
above which the fan should spin at maximum speed (60): 70
# 风扇停转时的pwm值
Enter the minimum PWM value (0-255)
at which the fan STOPS spinning (press t to test) (100): 50
# 风扇起转时pwm值
Enter the minimum PWM value (0-255)
at which the fan STARTS spinning (press t to test) (100): 60
输入数字保存并推出之后,会生成/etc/fancontrol
文件
fancontrol
上一步生成的fancontrol的文件将用于实际调速,你也可以直接编辑此文件
Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon2=devices/platform/coretemp.0 hwmon3=devices/platform/nct6775.2592
DEVNAME=hwmon2=coretemp hwmon3=nct6798
# 温度与 PWM 对应关系
FCTEMPS=hwmon3/pwm2=hwmon2/temp1_input hwmon3/pwm7=hwmon2/temp1_input hwmon3/pwm6=/var/lib/hdd_temp/max_hdd_temp.txt
# 风扇与 PWM 对应关系
FCFANS=hwmon3/pwm6=hwmon3/fan6_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm7=hwmon3/fan7_input
# 最低和最高温度
MINTEMP=hwmon3/pwm2=40 hwmon3/pwm7=40 hwmon3/pwm6=35
MAXTEMP=hwmon3/pwm2=70 hwmon3/pwm7=70 hwmon3/pwm6=45
# 最低启动和停止 PWM 值
MINSTART=hwmon3/pwm2=150 hwmon3/pwm7=100 hwmon3/pwm6=80
MINSTOP=hwmon3/pwm2=0 hwmon3/pwm7=24 hwmon3/pwm6=80
# 最低和最高 PWM 值
MINPWM=hwmon3/pwm7=0 hwmon3/pwm6=80
MAXPWM=hwmon3/pwm2=255 hwmon3/pwm7=255 hwmon3/pwm6=255
启动fancontrol
systemctl start fancontrol
systemctl enable fancontrol
查看状态fancontrol已在运行,且风扇转速已降低
root@pve:~# systemctl status fancontrol
● fancontrol.service - fan speed regulator
Loaded: loaded (/lib/systemd/system/fancontrol.service; enabled; preset: enabled)
Active: active (running) since Sun 2025-05-25 16:54:33 CST; 30min ago
Docs: man:fancontrol(8)
man:pwmconfig(8)
Process: 741023 ExecStartPre=/usr/sbin/fancontrol --check (code=exited, status=0/SUCCESS)
Main PID: 741205 (fancontrol)
Tasks: 2 (limit: 38120)
Memory: 1.4M
CPU: 1.988s
CGroup: /system.slice/fancontrol.service
├─741205 /bin/bash /usr/sbin/fancontrol
└─763096 sleep 10
May 25 16:54:33 pve fancontrol[741205]: Controls hwmon3/fan6_input
May 25 16:54:33 pve fancontrol[741205]: MINTEMP=35
May 25 16:54:33 pve fancontrol[741205]: MAXTEMP=45
May 25 16:54:33 pve fancontrol[741205]: MINSTART=80
May 25 16:54:33 pve fancontrol[741205]: MINSTOP=80
May 25 16:54:33 pve fancontrol[741205]: MINPWM=80
May 25 16:54:33 pve fancontrol[741205]: MAXPWM=255
May 25 16:54:33 pve fancontrol[741205]: AVERAGE=1
May 25 16:54:33 pve fancontrol[741205]: Enabling PWM on fans...
May 25 16:54:33 pve fancontrol[741205]: Starting automatic fan control...
root@pve:~#
0