CentOS 7 相當於 RHEL 7,因為基於穩定性考量所以更新速度並沒有像 Fedora 那樣的快,在相關版本的支援上自然也就不會體驗到最新版本。難免就會有一些硬體相容性上的問題。
鸚鵡最近安裝了一台 CentOS 7 (7-1511),主機板是 Asus B85M-G,因為習慣了用 Cacti 來紀錄硬體資訊(如:硬碟溫度、風扇轉速),系統初步架構完成後開始安裝 Cacti 以及 lm_sensors,執行 sensors 後卻只給我這樣的畫面
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@host ~]# sensors acpitz-virtual-0 Adapter: Virtual device temp1: +27.8°C (crit = +105.0°C) temp2: +29.8°C (crit = +105.0°C) coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +29.0°C (high = +80.0°C, crit = +100.0°C) Core 0: +28.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +29.0°C (high = +80.0°C, crit = +100.0°C) [root@host ~]# |
執行完 sensors-detect 之後依舊無解,只好開始找出解決途徑囉
拜了一下 Google 大神,在 HWZ Forums 上找到 這篇文章 有主機版的詳細硬體資訊,其中提到了:
Nuvoton NCT6791D is a Super I/O Controller: Used for keyboard controller with PS/2 mouse, wake-up functions/HW Monitor functions and fan-speed control.
再拜 Google 大神,在 Red Hat Bugzilla 發現 lm_sensors 3.3.5 已經修正了這個問題,但是 yum 只能更新到 3.3.4 的版本。所以就把腦筋動到 Fedora 的 Source RPM 上囉~
那就開始重新編譯然打包成 RPM 安裝吧,載點:lm_sensors-3.4.0-3.fc23.src.rpm
1 2 3 4 |
[root@host ~]# wget https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Server/source/SRPMS/l/lm_sensors-3.4.0-3.fc23.src.rpm [root@host ~]# rpmbuild --rebuild lm_sensors-3.4.0-3.fc23.src.rpm [root@host ~]# cd ~/rpmbuild/RPMS/x86_64/ [root@host ~]# yum install lm_sensors-3.4.0-3.el7.centos.x86_64.rpm lm_sensors-libs-3.4.0-3.el7.centos.x86_64.rpm lm_sensors-devel-3.4.0-3.el7.centos.x86_64.rpm |
安裝後重新執行 sensors-detect,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Some Super I/O chips contain embedded sensors. We have to write to standard 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/0x2f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... No Trying family `VIA/Winbond/Nuvoton/Fintek'... Yes Found `Nuvoton NCT6791D Super IO Sensors' Success! (address 0x290, driver `nct6775') Probing for Super-I/O at 0x4e/0x4f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... No Trying family `VIA/Winbond/Nuvoton/Fintek'... No Trying family `ITE'... No |
再執行 sensors 卻又是和最上面的畫面一樣
續拜 Google 大神,在 GitHub 找到了這個:
New driver for Nuvoton NCT6775F, NCT6776F, NCT6779D
下載後進行編譯與安裝,卻遇到錯誤
1 2 3 4 |
[root@host nct6775-master]# make make: *** /usr/src/linux-headers-3.10.0-327.10.1.el7.x86_64: 沒有此一檔案或目錄. Stop. make: *** [modules] Error 2 [root@host nct6775-master]# |
開啟 Makefile 檔案,並修正路徑:第8行修改如下
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# For building for the current running version of Linux TARGET := $(shell uname -r) HOME=$(shell pwd) # Or for a specific version #TARGET := 2.6.33.5 KERNEL_MODULES := /lib/modules/$(TARGET) # KERNEL_BUILD := $(KERNEL_MODULES)/build KERNEL_BUILD := /usr/src/kernels/$(TARGET) #SYSTEM_MAP := $(KERNEL_BUILD)/System.map SYSTEM_MAP := /boot/System.map-$(TARGET) DRIVER := nct6775 |
再次編譯與安裝
1 2 3 4 5 6 7 8 9 10 |
[root@host nct6775-master]# make CC [M] /root/nct6775-master/nct6775.o Building modules, stage 2. MODPOST 1 modules CC /root/nct6775-master/nct6775.mod.o LD [M] /root/nct6775-master/nct6775.ko [root@host nct6775-master]# make install cp nct6775.ko /lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/drivers/hwmon depmod -a -F /boot/System.map-3.10.0-327.10.1.el7.x86_64 3.10.0-327.10.1.el7.x86_64 [root@host nct6775-master]# |
再次執行 sensors-detect 和 sensors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
[root@host nct6775-master]# sensors acpitz-virtual-0 Adapter: Virtual device temp1: +27.8°C (crit = +105.0°C) temp2: +29.8°C (crit = +105.0°C) coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +29.0°C (high = +80.0°C, crit = +100.0°C) Core 0: +29.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +29.0°C (high = +80.0°C, crit = +100.0°C) nct6791-isa-0290 Adapter: ISA adapter Vcore: +0.88 V (min = +0.00 V, max = +1.74 V) in1: +1.04 V (min = +0.00 V, max = +0.00 V) ALARM AVCC: +3.34 V (min = +2.98 V, max = +3.63 V) +3.3V: +3.34 V (min = +2.98 V, max = +3.63 V) in4: +1.02 V (min = +0.00 V, max = +0.00 V) ALARM in5: +2.04 V (min = +0.00 V, max = +0.00 V) ALARM in6: +0.80 V (min = +0.00 V, max = +0.00 V) ALARM 3VSB: +3.42 V (min = +2.98 V, max = +3.63 V) Vbat: +3.31 V (min = +2.70 V, max = +3.63 V) in9: +1.02 V (min = +0.00 V, max = +0.00 V) ALARM in10: +0.22 V (min = +0.00 V, max = +0.00 V) ALARM in11: +0.18 V (min = +0.00 V, max = +0.00 V) ALARM in12: +1.02 V (min = +0.00 V, max = +0.00 V) ALARM in13: +1.04 V (min = +0.00 V, max = +0.00 V) ALARM in14: +0.22 V (min = +0.00 V, max = +0.00 V) ALARM fan1: 1151 RPM (min = 0 RPM) fan2: 1114 RPM (min = 0 RPM) SYSTIN: +12.0°C (high = +0.0°C, hyst = +0.0°C) ALARM sensor = thermistor CPUTIN: +28.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor AUXTIN0: +37.0°C sensor = thermistor AUXTIN1: +105.0°C sensor = thermistor AUXTIN2: +103.0°C sensor = thermistor AUXTIN3: +103.0°C sensor = thermistor PECI Agent 0: +28.5°C PCH_CHIP_CPU_MAX_TEMP: +0.0°C PCH_CHIP_TEMP: +0.0°C PCH_CPU_TEMP: +0.0°C intrusion0: ALARM intrusion1: ALARM beep_enable: disabled [root@host nct6775-master]# |
搞定,收工睡覺
後記:
其實更新 kernel 後系統上就已經存在 nct6775.ko 這個檔案
還沒編譯安裝新的 driver 之前 sensors-detect 也有正確偵測到 Nuvoton NCT6791D Super IO Sensors,但就是不能正常工作,也難怪 GitHub 找到的是 New driver for ..