解决 Linux 无法读取微星 B550M 系列主板传感器数据的问题
大概六月底的时候组了台 All-in-One 小主机,主板是微星的 B550M PRO-VDH,安装 Proxmox VE(基于 Debian)后发现 lm-sensors
能拿到的数据实在是太少了,温度都不全
只能拿到这些:
1
2
3
4
5
6
7
8
9
10
11
12
|
root@home:~# sensors
nvme-pci-0100
Adapter: PCI adapter
Composite: +38.9°C (low = -273.1°C, high = +89.8°C)
(crit = +94.8°C)
Sensor 1: +38.9°C (low = -273.1°C, high = +65261.8°C)
Sensor 2: +36.9°C (low = -273.1°C, high = +65261.8°C)
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +41.0°C
Tccd1: +40.0°C
|
检查 Reddit 发现有人遇到了相似的问题,是因为 Linux 内核没有对微星 B550M 系列主板用的 Nuvoton NCT6687-R 控制器芯片的原生支持,需要自己加载一个第三方的 Kernel Module:Fred78290/nct6687d
又因为启用了 Secure Boot,内核模块需要签名才能够被加载,所以需要配置 MOK (Machine Owner Key) 和 DKMS (Dynamic Kernel Module Support) 的模块自动签名
#
生成并注册 MOK
根据 Debian Wiki 的 Secure Boot 章节,为了保持和 Ubuntu 的一致,MOK 应该被放在 /var/lib/shim-signed/mok/
目录下,然后通过 openssl
生成 MOK:
1
2
3
4
5
6
7
|
mkdir -p /var/lib/shim-signed/mok/
cd /var/lib/shim-signed/mok/
openssl req -nodes -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -days 36500 -subj "/CN=Kernel Signing MOK/"
openssl x509 -inform der -in MOK.der -out MOK.pem
|
创建好 MOK 后,通过 mokutil
注册 MOK:
1
|
mokutil --import /var/lib/shim-signed/mok/MOK.der
|
按照要求设置用于注册的一次性密码,记下,然后重启
接下来按照屏幕提示,选择注册 MOK,然后输入之前设置的一次性密码来确认注册
开机后,可以检查一下 MOK 是否注册成功:
1
|
mokutil --test-key /var/lib/shim-signed/mok/MOK.der
|
#
DKMS 配置
我的 Proxmox VE 似乎没有预装 DKMS,需要手动安装一下:
1
2
|
apt-get update
apt-get install dkms
|
然后编辑 /etc/dkms/framework.conf
,找到被注释的 mok_signing_key
和 mok_certificate
,取消注释,改成此前 MOK 的位置
1
2
3
4
5
6
7
|
# Location of the key and certificate files used for Secure boot. $kernelver
# can be used in path to represent the target kernel version.
# mok_signing_key can also be a "pkcs11:..." string for PKCS#11 engine, as
# long as the sign_file program supports it.
# (default: /var/lib/dkms):
mok_signing_key=/var/lib/shim-signed/mok/MOK.priv
mok_certificate=/var/lib/shim-signed/mok/MOK.der
|
#
编译并安装模块
克隆仓库并编译,下面是编译 deb 包并安装的步骤,Proxmox VE 下面可能会提示缺一些包,比如 build-essential
和 Kernel 头文件,总之缺啥装啥 (o゜▽゜)o☆
别的发行版可以参考 Fred78290/nct6687d 的 README.md
1
2
3
4
5
|
cd /tmp
git clone https://github.com/Fred78290/nct6687d
cd nct6687d
make deb
dpkg -i ../nct6687d-dkms_*.deb
|
安装完成后编辑 /etc/modules
文件,加上 nct6687
:
1
2
3
4
5
6
7
8
|
root@home:~# cat /etc/modules
# /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.
# Parameters can be specified after the module name.
nct6687
|
然后重启一下,或者使用 modprobe nct6687d
加载模块
#
重新 sensors-detect
然后一路 y
,就 OK 了。现在再来看看 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
|
root@home:~# sensors
nct6687-isa-0a20
Adapter: ISA adapter
+12V: 12.12 V (min = +12.12 V, max = +12.14 V)
+5V: 5.08 V (min = +5.07 V, max = +5.08 V)
+3.3V: 3.34 V (min = +0.00 V, max = +3.34 V)
CPU Soc: 998.00 mV (min = +1.00 V, max = +1.00 V)
CPU Vcore: 1.17 V (min = +0.24 V, max = +1.17 V)
CPU 1P8: 1.83 V (min = +1.83 V, max = +1.83 V)
CPU VDDP: 0.00 V (min = +0.00 V, max = +0.00 V)
DRAM: 1.35 V (min = +1.35 V, max = +1.36 V)
Chipset: 784.00 mV (min = +0.78 V, max = +0.89 V)
CPU SA: 694.00 mV (min = +0.69 V, max = +0.86 V)
Voltage #2: 1.52 V (min = +1.52 V, max = +1.53 V)
AVCC3: 3.38 V (min = +3.38 V, max = +3.38 V)
AVSB: 3.34 V (min = +0.00 V, max = +3.34 V)
VBat: 1.83 V (min = +0.00 V, max = +1.83 V)
CPU Fan: 920 RPM (min = 758 RPM, max = 920 RPM)
Pump Fan: 0 RPM (min = 0 RPM, max = 0 RPM)
System Fan #1: 2238 RPM (min = 2097 RPM, max = 2238 RPM)
System Fan #2: 0 RPM (min = 0 RPM, max = 0 RPM)
System Fan #3: 0 RPM (min = 0 RPM, max = 0 RPM)
System Fan #4: 0 RPM (min = 0 RPM, max = 0 RPM)
System Fan #5: 0 RPM (min = 0 RPM, max = 0 RPM)
System Fan #6: 0 RPM (min = 0 RPM, max = 0 RPM)
CPU: +45.0°C (low = +38.0°C, high = +45.0°C)
System: +42.5°C (low = +35.0°C, high = +42.5°C)
VRM MOS: +40.5°C (low = +33.0°C, high = +40.5°C)
PCH: +43.5°C (low = +34.0°C, high = +43.5°C)
CPU Socket: +40.0°C (low = +33.0°C, high = +40.0°C)
PCIe x1: +38.0°C (low = +32.0°C, high = +38.0°C)
M2_1: +0.0°C (low = +0.0°C, high = +0.0°C)
nvme-pci-0100
Adapter: PCI adapter
Composite: +38.9°C (low = -273.1°C, high = +89.8°C)
(crit = +94.8°C)
Sensor 1: +38.9°C (low = -273.1°C, high = +65261.8°C)
Sensor 2: +36.9°C (low = -273.1°C, high = +65261.8°C)
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +45.4°C
Tccd1: +42.5°C
|
锵锵 (≧∇≦)ノ
#
支持 Kernel 升级
Proxmox VE 下运行 apt dist-upgrade
升级内核后,发现有以下提示:
1
|
dkms: autoinstall for kernel 6.8.8-4-pve was skipped since the kernel headers for this kernel do not seem to be installed.
|
这是因为新内核的头文件没有安装(之前安装的是指定版本的头文件),这里把以前安装的指定版本的的头文件卸载,再安装 proxmox-headers-6.8
元包(始终指向 PVE 内核 6.8 版本的最新版本) ,这样在每次执行 apt dist-upgrade
的时候头文件就会和内核一起更新
reboot
后再 dkms autoinstall
即可