I managed to make my own script.
#!/bin/bash
while true; do
val=$(sensors | awk '/temp1/ {print $2}')
max="+75.0"
if [[ "$val" > "$max" ]]; then
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
fi
sleep 10
clear
sensors
done
exit 0
For 16.04 (also here):
#!/bin/bash
while true; do
val=$(sensors | awk '/temp1/ {print $2}')
max="+75.0"
if [[ "$val" > "$max" ]]; then
systemctl suspend
fi
sleep 10
clear
sensors
done
exit 0
That's not a bug, it's a feature! Check your temperatures, the only reason the CPU speed is decreased is because you're overheating. Look at the first output you show, you have one of your cores running at 92°C! That's pretty hot to begin with and it probably went even higher before your clock speed was reduced.
You can check the maximum temperature your CPU can deal with by running sensors
. For example, for my Intel i7:
$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +77.0°C (high = +95.0°C, crit = +105.0°C)
Core 2: +79.0°C (high = +95.0°C, crit = +105.0°C)
So, on my machine, 95.0°C is considered high and 105°C is the critical temperature at which the machine will be shut down. Your specs might be a little different but 92.0°C is definitely high.
Now, you can force your CPU to keep the same clock speed. This is controlled by the CPU governor. You probably have it set to ondemand
, but the following options are available:
- Performance keeps the CPU at the highest possible frequency
- Powersave keeps the CPU at the lowest possible frequency
- Userspace exports the available frequency information to the user level (through the /sys file system)
and permits user-space control of the CPU frequency
- Ondemand scales the CPU frequencies according to the CPU usage (like does the userspace frequency scaling
daemons, but in kernel)
- Conservative acts like the ondemand but increases frequency step by step
To change your governor to, for example, "Performance", run this:
echo "performance" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
However, the likely result will simply be that your computer will shutdown when the high temperatures are reached. It might also still scale it down, I'm not sure how the safety features are implemented. In any case, the main point is that you don't want to do this because it can seriously harm your hardware.
There are very good reasons why your computer won't let you go past certain temperatures and you don't want to screw with that. I don't know of any way to actually disable the temperature limit and I wouldn't tell you if I did. There are easier ways, but disabling the temperature safety limits is certainly a good way to destroy your computer.
Best Answer
On this webpage there is a bash script that will attempt to keep your CPU below a specified temperature. http://seperohacker.blogspot.com/2012/10/linux-keep-your-cpu-cool-with-frequency.html
You just need to provide it with your desired maximum temperature, and it will throttle your CPU(s) in an effort to stay below that temperature.
Shameless plug- I wrote and maintain the above script.