Ubuntu 16.04でのクーリングファンの制御方法
- リンクを取得
- ×
- メール
- 他のアプリ
この記事のまとめ:
- Ubuntu 16.04でクーリングファンの回転数の制御を行う方法をまとめてみました。
背景:
Windowsではマザーボードメーカーがクーリングファインの制御用のソフトウェアを用意してくれていて、それを使えば自由に設定を変更できますが、Linux用には用意してくれていないのがほとんどです。そのため、自分で設定するしかなく、今回その設定を行ってみました。
設定の流れ
- パッケージインストール
- 温度センサーの検出
- 温度センサーの確認
- ファン制御設定
- ファン制御の実行
1. パッケージインストール
lm-sensors
というパッケージを使いますのでまずはこれをインストールします。
$ sudo apt install lm-sensors
2. 温度センサーの検出
センサーモジュールを検出するためにsensors-detect
コマンドを実行します。下記が私の環境での実行例で、私の環境ではIntel digital thermal sensor (ドライバー: coretemp)
とNuvoton NCT6791D Super IO Sensors (ドライバー: nct6775)
というモジュールが見つかったことがわかります(私のPC環境が丸裸ですw)。後者がマザーボードに搭載してあるモジュールのようです。
$ sudo sensors-detect# sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)# System: ASUS All Series# Board: ASUSTeK COMPUTER INC. H87-PLUS# Kernel: 4.15.0-34-generic x86_64# Processor: Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (6/60/3)This program will help you determine which kernel modules you needto load to use lm_sensors most effectively. It is generally safeand recommended to accept the default answers to all questions,unless you know what you're doing.Some south bridges, CPUs or memory controllers contain embedded sensors.Do you want to scan for them? This is totally safe. (YES/no):Module cpuid loaded successfully.Silicon Integrated Systems SIS5595... NoVIA VT82C686 Integrated Sensors... NoVIA VT8231 Integrated Sensors... NoAMD K8 thermal sensors... NoAMD Family 10h thermal sensors... NoAMD Family 11h thermal sensors... NoAMD Family 12h and 14h thermal sensors... NoAMD Family 15h thermal sensors... NoAMD Family 16h thermal sensors... NoAMD Family 15h power sensors... NoAMD Family 16h power sensors... NoIntel digital thermal sensor... Success!(driver `coretemp')Intel AMB FB-DIMM thermal sensor... NoIntel 5500/5520/X58 thermal sensor... NoVIA C7 thermal sensor... NoVIA Nano thermal sensor... NoSome Super I/O chips contain embedded sensors. We have to write tostandard I/O ports to probe them. This is usually safe.Do you want to scan for Super I/O sensors? (YES/no):Probing for Super-I/O at 0x2e/0x2fTrying family `National Semiconductor/ITE'... NoTrying family `SMSC'... NoTrying family `VIA/Winbond/Nuvoton/Fintek'... YesFound `Nuvoton NCT6791D Super IO Sensors' Success!(address 0x290, driver `nct6775')Probing for Super-I/O at 0x4e/0x4fTrying family `National Semiconductor/ITE'... NoTrying family `SMSC'... NoTrying family `VIA/Winbond/Nuvoton/Fintek'... NoTrying family `ITE'... NoSome systems (mainly servers) implement IPMI, a set of common interfacesthrough which system health data may be retrieved, amongst other things.We first try to get the information from SMBIOS. If we don't find itthere, we have to read from arbitrary I/O ports to probe for suchinterfaces. This is normally safe. Do you want to scan for IPMIinterfaces? (YES/no):Probing for `IPMI BMC KCS' at 0xca0... NoProbing for `IPMI BMC SMIC' at 0xca8... NoSome hardware monitoring chips are accessible through the ISA I/O ports.We have to write to arbitrary I/O ports to probe them. This is usuallysafe though. Yes, you do have ISA I/O ports even if you do not have anyISA slots! Do you want to scan the ISA I/O ports? (yes/NO): yesProbing for `National Semiconductor LM78' at 0x290... NoProbing for `National Semiconductor LM79' at 0x290... NoProbing for `Winbond W83781D' at 0x290... NoProbing for `Winbond W83782D' at 0x290... NoLastly, we can probe the I2C/SMBus adapters for connected hardwaremonitoring devices. This is the most risky part, and while it worksreasonably well on most systems, it has been reported to cause troubleon some systems.Do you want to probe the I2C/SMBus adapters now? (YES/no):Using driver `i2c-i801' for device 0000:00:1f.3: Intel Lynx Point (PCH)Module i2c-i801 loaded successfully.Next adapter: NVIDIA i2c adapter 1 at 1:00.0 (i2c-0)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 2 at 1:00.0 (i2c-1)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 4 at 1:00.0 (i2c-2)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 6 at 1:00.0 (i2c-3)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 7 at 1:00.0 (i2c-4)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 1 at 6:00.0 (i2c-5)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 2 at 6:00.0 (i2c-6)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 4 at 6:00.0 (i2c-7)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 6 at 6:00.0 (i2c-8)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 7 at 6:00.0 (i2c-9)Do you want to scan it? (yes/NO/selectively): yesNext adapter: NVIDIA i2c adapter 8 at 6:00.0 (i2c-10)Do you want to scan it? (yes/NO/selectively): yesNext adapter: SMBus I801 adapter at f000 (i2c-11)Do you want to scan it? (YES/no/selectively): yesClient found at address 0x51Probing for `Analog Devices ADM1033'... NoProbing for `Analog Devices ADM1034'... NoProbing for `SPD EEPROM'... Yes(confidence 8, not a hardware monitoring chip)Client found at address 0x53Probing for `Analog Devices ADM1033'... NoProbing for `Analog Devices ADM1034'... NoProbing for `SPD EEPROM'... Yes(confidence 8, not a hardware monitoring chip)Now follows a summary of the probes I have just done.Just press ENTER to continue:Driver `nct6775':* ISA bus, address 0x290Chip `Nuvoton NCT6791D Super IO Sensors' (confidence: 9)Driver `coretemp':* Chip `Intel digital thermal sensor' (confidence: 9)To load everything that is needed, add this to /etc/modules:#----cut here----# Chip driverscoretempnct6775#----cut here----If you have some drivers built into your kernel, the list above willcontain too many modules. Skip the appropriate ones!Do you want to add these lines automatically to /etc/modules? (yes/NO)yesSuccessful!Monitoring programs won't work until the needed modules areloaded. You may want to run '/etc/init.d/kmod start'to load them.Unloading i2c-i801... OKUnloading cpuid... OK
上記コマンドの出力結果として、/etc/modules
に搭載しているモジュールのドライバー情報が追記されます。私の環境ではcoretemp
とnct6775
のドライバーが追加されました。
# /etc/modules: kernel modules to load at boot time.## This file contains the names of kernel modules that should be loaded# at boot time, one per line. Lines beginning with "#" are ignored.# Generated by sensors-detect on Sun Sep 30 01:06:09 2018# Chip driverscoretempnct6775
3. 温度センサーの確認
センサーから取得できる情報はsensors
コマンドで取得できます。Nuvoton NCT6791D Super IO Sensors
と思われるnct6791-isa-0290
と、Intel digital thermal sensor
と思われるcoretemp-isa-0000
が表示されています。それ以外に2つありますが今回は無視します。なお、各項目についてはマザーボードごとのコンフィグファイルがGithubにありますのでこれを参考にするとわかるかもしれません。
$ sensorsnct6791-isa-0290Adapter: ISA adapterVcore: +0.80 V (min = +0.00 V, max = +1.74 V)in1: +1.03 V (min = +0.00 V, max = +0.00 V) ALARMAVCC: +3.38 V (min = +2.98 V, max = +3.63 V)+3.3V: +3.38 V (min = +2.98 V, max = +3.63 V)in4: +1.00 V (min = +0.00 V, max = +0.00 V) ALARMin5: +0.16 V (min = +0.00 V, max = +0.00 V) ALARMin6: +0.79 V (min = +0.00 V, max = +0.00 V) ALARM3VSB: +3.31 V (min = +2.98 V, max = +3.63 V)Vbat: +3.41 V (min = +2.70 V, max = +3.63 V)in9: +1.01 V (min = +0.00 V, max = +0.00 V) ALARMin10: +0.16 V (min = +0.00 V, max = +0.00 V) ALARMin11: +0.14 V (min = +0.00 V, max = +0.00 V) ALARMin12: +0.14 V (min = +0.00 V, max = +0.00 V) ALARMin13: +0.14 V (min = +0.00 V, max = +0.00 V) ALARMin14: +0.14 V (min = +0.00 V, max = +0.00 V) ALARMfan1: 0 RPM (min = 0 RPM)fan2: 413 RPM (min = 0 RPM)fan3: 0 RPM (min = 0 RPM)fan4: 0 RPM (min = 0 RPM)fan5: 0 RPM (min = 0 RPM)SYSTIN: +115.0ーC (high = +0.0ーC, hyst = +0.0ーC) sensor = therCPUTIN: +29.0ーC (high = +80.0ーC, hyst = +75.0ーC) sensor = ther ← CPU温度AUXTIN0: +37.0ーC (high = +0.0ーC, hyst = +0.0ーC) ALARM sensor ← MB温度?AUXTIN1: +106.0ーC sensor = thermistorAUXTIN2: +106.0ーC sensor = thermistorAUXTIN3: +107.0ーC sensor = thermistorPECI Agent 0: +31.0ーC ← 各CPUコアの最大温度PCH_CHIP_CPU_MAX_TEMP: +0.0ーCPCH_CHIP_TEMP: +0.0ーCPCH_CPU_TEMP: +0.0ーCintrusion0: ALARMintrusion1: ALARMbeep_enable: disabledacpitz-virtual-0Adapter: Virtual devicetemp1: +27.8ーC (crit = +105.0ーC)temp2: +29.8ーC (crit = +105.0ーC)asus-isa-0000Adapter: ISA adaptercpu_fan: 0 RPMcoretemp-isa-0000Adapter: ISA adapterPackage id 0: +31.0ーC (high = +80.0ーC, crit = +100.0ーC)Core 0: +27.0ーC (high = +80.0ーC, crit = +100.0ーC)Core 1: +29.0ーC (high = +80.0ーC, crit = +100.0ーC)Core 2: +26.0ーC (high = +80.0ーC, crit = +100.0ーC)Core 3: +29.0ーC (high = +80.0ーC, crit = +100.0ーC)
4. ファン制御設定
pwmconfig
コマンドを使うことでファン制御用の設定ファイルを作る支援をしてくれます。
一度実行すると長いのでパートごとに分けて説明します。
まずは実行すると、先ほど検出したモジュールとそれのファン制御 (pwm)情報を表示してくれます。私の環境ではhwmon2
にpwmが5つあり、ファンが3つ接続されていることがわかります。
$ sudo pwmconfig# pwmconfig revision 6243 (2014-03-20)This program will search your sensors for pulse width modulation (pwm)controls, and test each one to see if it controls a fan onyour motherboard. Note that many motherboards do not have pwmcircuitry 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 speedafter testing. However, it is ** very important ** that youphysically verify that the fans have been to full speedafter the program has completed.Found the following devices:hwmon0 is acpitzhwmon1 is coretemphwmon2 is nct6791hwmon3 is asusFound the following PWM controls:hwmon2/pwm1 current value: 255hwmon2/pwm2 current value: 255hwmon2/pwm3 current value: 255hwmon2/pwm4 current value: 255hwmon2/pwm5 current value: 255Giving the fans some time to reach full speed...Found the following fan sensors:hwmon2/fan1_input current speed: 929 RPMhwmon2/fan2_input current speed: 1345 RPMhwmon2/fan3_input current speed: 1221 RPMhwmon2/fan4_input current speed: 0 ... skipping!hwmon2/fan5_input current speed: 0 ... skipping!hwmon3/fan1_input current speed: 0 ... skipping!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:
続いて、接続されているファンがどのpwmに制御されていて、制御値とファンの回転数を表示してくれます。私の環境では、fan1はhwmon2/pwm1に、fan2はhwmon2/pwm2に、fan3はhwmon2/pwm3に制御されているということがわかります。
Testing pwm control hwmon2/pwm1 ...hwmon2/fan1_input ... speed was 929 now 0It appears that fan hwmon2/fan1_inputis controlled by pwm hwmon2/pwm1Would you like to generate a detailed correlation (y)?Note: If you had gnuplot installed, I could generate a graphical plot.PWM 255 FAN 926PWM 240 FAN 907PWM 225 FAN 860PWM 210 FAN 809PWM 195 FAN 771PWM 180 FAN 725PWM 165 FAN 686PWM 150 FAN 638PWM 135 FAN 593PWM 120 FAN 538PWM 105 FAN 487PWM 90 FAN 443PWM 75 FAN 367PWM 60 FAN 298PWM 45 FAN 0Fan Stopped at PWM = 45hwmon2/fan2_input ... speed was 1345 now 1398no correlationhwmon2/fan3_input ... speed was 1221 now 1211no correlationTesting pwm control hwmon2/pwm2 ...hwmon2/fan1_input ... speed was 929 now 932no correlationhwmon2/fan2_input ... speed was 1345 now 403It appears that fan hwmon2/fan2_inputis controlled by pwm hwmon2/pwm2Would you like to generate a detailed correlation (y)? yNote: If you had gnuplot installed, I could generate a graphical plot.PWM 255 FAN 1341PWM 240 FAN 1315PWM 225 FAN 1238PWM 210 FAN 1180PWM 195 FAN 1119PWM 180 FAN 1072PWM 165 FAN 999PWM 150 FAN 903PWM 135 FAN 827PWM 120 FAN 734PWM 105 FAN 646PWM 90 FAN 532PWM 75 FAN 454PWM 60 FAN 412PWM 45 FAN 394PWM 30 FAN 387PWM 28 FAN 387PWM 26 FAN 388PWM 24 FAN 388PWM 22 FAN 388PWM 20 FAN 389PWM 18 FAN 390PWM 16 FAN 390PWM 14 FAN 392PWM 12 FAN 390PWM 10 FAN 389PWM 8 FAN 390PWM 6 FAN 390PWM 4 FAN 391PWM 2 FAN 390PWM 0 FAN 391hwmon2/fan3_input ... speed was 1221 now 1215no correlationTesting pwm control hwmon2/pwm3 ...hwmon2/fan1_input ... speed was 929 now 933no correlationhwmon2/fan2_input ... speed was 1345 now 1387no correlationhwmon2/fan3_input ... speed was 1221 now 0It appears that fan hwmon2/fan3_inputis controlled by pwm hwmon2/pwm3Would you like to generate a detailed correlation (y)? yNote: If you had gnuplot installed, I could generate a graphical plot.PWM 255 FAN 1223PWM 240 FAN 1186PWM 225 FAN 1134PWM 210 FAN 1074PWM 195 FAN 1036PWM 180 FAN 965PWM 165 FAN 915PWM 150 FAN 854PWM 135 FAN 799PWM 120 FAN 720PWM 105 FAN 657PWM 90 FAN 558PWM 75 FAN 484PWM 60 FAN 417PWM 45 FAN 0Fan Stopped at PWM = 45Testing pwm control hwmon2/pwm4 ...hwmon2/fan1_input ... speed was 929 now 925no correlationhwmon2/fan2_input ... speed was 1345 now 1369no correlationhwmon2/fan3_input ... speed was 1221 now 1182no correlationNo correlations were detected.There is either no fan connected to the output of hwmon2/pwm4,or the connected fan has no rpm-signal connected to one ofthe tested fan sensors. (Note: not all motherboards havethe 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)? nTesting pwm control hwmon2/pwm5 ...hwmon2/fan1_input ... speed was 929 now 924no correlationhwmon2/fan2_input ... speed was 1345 now 1330no correlationhwmon2/fan3_input ... speed was 1221 now 1228no correlationNo correlations were detected.There is either no fan connected to the output of hwmon2/pwm5,or the connected fan has no rpm-signal connected to one ofthe tested fan sensors. (Note: not all motherboards havethe 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)? nTesting is complete.Please verify that all fans have returned to their normal speed.
最後に、ファンの制御のコンフィグファイルを作成します。下記の実行例では hwmon2/pwm1 (fan1) を40℃未満ではPWM 0(最弱)で動作させ、40℃になるとPWM 100、60℃にはPWM 255 (最強)の強さでファンを制御する設定を作っています。
The fancontrol script can automatically respond to temperature changesof your system by changing fanspeeds.Do you want to set up its configuration file now (y)? yWhat should be the path to your fancontrol config file (/etc/fancontrol)?Loading configuration from /etc/fancontrol ...Select fan output to configure, or other action:1) hwmon2/pwm3 4) Change INTERVAL 7) Show configuration2) hwmon2/pwm2 5) Just quit3) hwmon2/pwm1 6) Save and quitselect (1-n): 3Devices:hwmon0 is acpitzhwmon1 is coretemphwmon2 is nct6791hwmon3 is asusCurrent temperature readings are as follows:hwmon0/temp1_input 27hwmon0/temp2_input 29hwmon1/temp1_input 30hwmon1/temp2_input 28hwmon1/temp3_input 26hwmon1/temp4_input 26hwmon1/temp5_input 27hwmon2/temp1_input 115 ← SYSIN (sensorsコマンドの表示順)hwmon2/temp2_input 29 ← CPUINhwmon2/temp3_input 37 ← AUXTIN0hwmon2/temp4_input 106 ← AUXTIN1hwmon2/temp5_input 106 ← AUXTIN2hwmon2/temp6_input 108 ← AUXTIN3hwmon2/temp7_input 30 ← PECI Agent 0hwmon2/temp8_input 0 ← PCH_CHIP_CPU_MAX_TEMPhwmon2/temp9_input 0 ← PCH_CHIP_TEMPSelect a temperature sensor as source for hwmon2/pwm1:1) hwmon0/temp1_input2) hwmon0/temp2_input3) hwmon1/temp1_input4) hwmon1/temp2_input5) hwmon1/temp3_input6) hwmon1/temp4_input7) hwmon1/temp5_input8) hwmon2/temp1_input9) hwmon2/temp2_input10) hwmon2/temp3_input11) hwmon2/temp4_input12) hwmon2/temp5_input13) hwmon2/temp6_input14) hwmon2/temp7_input15) hwmon2/temp8_input16) hwmon2/temp9_input17) None (Do not affect this PWM output)select (1-n): 14Enter the low temperature (degree C)below which the fan should spin at minimum speed (20): 40Enter the high temperature (degree C)over which the fan should spin at maximum speed (60): 60Enter the minimum PWM value (0-255)at which the fan STOPS spinning (press t to test) (100): 0Enter the minimum PWM value (0-255)at which the fan STARTS spinning (press t to test) (150): 100Enter the PWM value (0-255) to use when the temperatureis over the high temperature limit (255): 255Select fan output to configure, or other action:1) hwmon2/pwm3 4) Change INTERVAL 7) Show configuration2) hwmon2/pwm2 5) Just quit3) hwmon2/pwm1 6) Save and quitselect (1-n): 6Saving configuration to /etc/fancontrol...Configuration saved
5. ファン制御の実行
下記を実行することで上記の設定ファイルに基づいてファンの制御をしてくれます。
$ sudo /etc/init.d/fancontrol restart
なお、ファン制御を実行中にはpwmconfig
コマンドは次のように表示され実行できません。pwmconfigコマンドを再度実行する際は、一度、fancontrol
を停止しましょう。
$ sudo pwmconfigFile /var/run/fancontrol.pid exists. This typically means that thefancontrol deamon is running. You should stop it before running pwmconfig.If you are certain that fancontrol is not running, then you can delete/var/run/fancontrol.pid manually.$ sudo /etc/init.d/fancontrol stop
pwmconfigコマンドで作成したコンフィグファイルは/etc/fancontrol
に保存されています。このファイルは直接編集しても問題ないです。なお、私の設定は下記の通りです。
# Configuration file generated by pwmconfig, changes will be lostINTERVAL=60DEVPATH=hwmon2=devices/platform/nct6775.656DEVNAME=hwmon2=nct6791FCTEMPS=hwmon2/pwm1=hwmon2/temp7_input hwmon2/pwm2=hwmon2/temp3_input hwmon2/pwm3=hwmon2/temp3_inputFCFANS=hwmon2/pwm1=hwmon2/fan1_input hwmon2/pwm2=hwmon2/fan2_input hwmon2/pwm3=hwmon2/fan3_inputMINTEMP=hwmon2/pwm1=40 hwmon2/pwm2=40 hwmon2/pwm3=40MAXTEMP=hwmon2/pwm1=60 hwmon2/pwm2=60 hwmon2/pwm3=60MINSTART=hwmon2/pwm1=100 hwmon2/pwm2=100 hwmon2/pwm3=100MINSTOP=hwmon2/pwm1=0 hwmon2/pwm2=0 hwmon2/pwm3=0MAXPWM=hwmon2/pwm1=255 hwmon2/pwm2=255 hwmon2/pwm3=255
今回は以上です。 最後まで読んでいただき、ありがとうございます。
- リンクを取得
- ×
- メール
- 他のアプリ
コメント
コメントを投稿