无法获得 CPU 温度



我目前的 Linux 有问题,我试图通过 bash 获取温度的任何东西都不起作用。

我试过 lm 传感器,我得到的只是 GPU 温度和cpu_fan(错了,总是说 0 RPM(在/sys/class/thermal 中,内核被命名为 cooling_deviceX 内核,其中没有散热信息,只有电源和状态最后,/proc/acpi,什么都没有,只是醒来

我不明白的是,它以前曾经工作过。但是自从我上次重新安装以来,什么都没有。

我有一个 Ryzen 7 1700,我正在运行带有自定义编译内核 (4.9.76( 的 mint 18.1,配置是从原始内核导入的。

这到底是出了什么问题?

编辑:我已经找到了问题的原因,似乎缺乏对 Ryzen 的支持,仅适用于内核 4.11 及更高版本。这就解释了为什么它以前有效,因为我使用的是主线 4.15 内核。

以下是我用来在 Linux 上获取 CPU 温度的脚本:

T=$(cat /sys/class/thermal/thermal_zone0/temp); echo $(( $T / 1000 ))°C

这对你有用吗?

另外,您可以尝试运行sudo sensors-detect

 $ sudo sensors-detect
[sudo] password for brian: 
# sensors-detect revision $Revision$
# System: LENOVO 2347G2U [ThinkPad T430] (laptop)
# Kernel: 4.14.11-1-ARCH x86_64
# Processor: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz (6/58/9)
This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and 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): 

这是我多年来使用的内容:

_cputemp(){
  local T=`sensors|sed -E -n '/[0-9]:.*+[0-9]+.[0-9]°[CF]/!b;s:.[0-9]*°[CF].*$::;s:^.*+::;p'`
  local S=`echo "$T"|sed ':a;N;s:n:+:g;ba'`
  local C=`echo "$T"|wc -l`
  printf "%s°Cn" $((($S)/$C))
}

该函数sensors程序运行,然后取找到的所有温度的平均值。因此,严格来说,它不仅仅是CPU温度。

最新更新