2

I have a problem with my current linux, anything I try to get temperatures through bash doesn't work.

I've tried lm-sensors, all I get is gpu temp and cpu_fan (and wrong, always says 0 RPM) In /sys/class/thermal, cores are named cooling_deviceX and no thermal info in there, only power and state And finally, /proc/acpi, nothing, juste wakeup

What I don't understand is that it used to work before. But ever since my last reinstall, nothing.

I have a Ryzen 7 1700, and I'm running mint 18.1 with a custom compiled kernel (4.9.76), config was imported from original kernel.

What went wrong for this to happen?

Edit: I have found the cause of the issue, It seems to be a lack of support for Ryzen, only available with kernels 4.11 and up. Which explains why it worked before because I was on a mainline 4.15 kernel.

Zawz
  • 31
  • 4
  • While an interesting problem, you forgot to include your best attempt at coding a solution (yes, it looks like you're not asking for free code), but we're not mind readers. StackOverflow is about helping people fix their existing programming code. Edit your Q to show sample inputs/outputs and your best attempt at coding a solution to your problem. ***Please*** read https://stackoverflow.com/help/on-topic , https://stackoverflow.com/help/how-to-ask , https://stackoverflow.com/help/dont-ask , https://stackoverflow.com/help/mcve before posting more Qs here. Glad you solved it. Good luck – shellter Jan 27 '18 at 05:20

2 Answers2

1

Here's the script I use to get my CPU temperature on Linux:

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

Does that work for you?

Also, you could try running 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): 
briancaffey
  • 2,339
  • 6
  • 34
  • 62
  • ok. could you try `sudo sensors-detect`? I'm not sure if this is necessary but it may help @Zawz – briancaffey Jan 27 '18 at 04:06
  • That's the first thing I tried. Nothing correct comes out – Zawz Jan 27 '18 at 04:10
  • After studying carefully the output I noticed that sensors-detect scans for K8 and 10th to 16th AMD thermal sensors but doesn't find any. I'm gonna do some research on that and see what I can find – Zawz Jan 27 '18 at 04:12
0

Here is what I am using for years:

_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°C\n" $((($S)/$C))
}

That function run sensors program, then take the average value of all temperatures founds. So, strictly speaking, it is not only CPU temperature.

Bach Lien
  • 1,030
  • 6
  • 7