linux - 无法获取cpu温度

标签 linux bash temperature

我当前的 linux 有问题,我尝试通过 bash 获取温度的任何方法都不起作用。

我试过 lm-sensors,我得到的只是 gpu temp 和 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): 

关于linux - 无法获取cpu温度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48472355/

相关文章:

c - 在 Linux 命令 shell 中将 C 程序的输出重定向为另一个程序的输入

bash - 如果文件夹不存在,如何使用 Bash 创建文件夹?

regex - 如何从shell中的字符串中检索url?

linux - `!:-` 是做什么的?

java - 温度转换方法输出Java

c# - 如何使用 C# 从 Linux 机器读取不断增长的文件

ruby - 如何让本地代理服务器将 html 返回到浏览器?

Arduino 温度传感器倒计时

Java Swing JTextField - 只有数字

ruby-on-rails - 通过 CLI 的 rails 不工作