CPU Temperature

From FreekiWiki
Jump to navigation Jump to search

Overview

Systems that freeze after a period of use (but not when started cold) may be having problems with overheating. This is especially true for laptops. You can use lm-sensors to determine the temperature of the CPU.

Using lm-sensors

Install and Configure lm-sensors

  • Install the lm-sensors package (see InstallingSoftware).
  • Run sudo sensors-detect and answer YES to all YES/no questions. I generally use the ISA bus rather than the SMBus bus, your choice to this question!.
  • At the end of sensors-detect, a list of modules that needs to be loaded will displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
  • Next, run "sudo /etc/init.d/module-init-tools". This will read the changes you made to /etc/modules in step 3, and insert the new modules into the kernel.
  • Run "sensors" to get temperature readings.

Run a Stress Test

It is useful to have this running continuously and also have it logging to a file. The following file will record the output of sensors and uptime (so you can monitor the load and get a timestamp) in a file, every 30 seconds and display it on the screen (thanks to the magic of tee and an infinite loop).

while  [[ true ]] ; do uptime ; sensors ; sleep 30s; done | tee temp_load.log

Run that command in one terminal window and this in another:

 stress --cpu 10 --io 4 --vm 10 --vm-bytes 10M --hdd 2 --timeout 4h 

This will stress the machine for four hours, or until it crashes ;)

More Information

The ubuntu-maintained page can be found here.

This page contains commands written thanks to the magic of tea!