Compdigitec Labs

« | Home | »

Measure CPU temperature and your fan speed in Ubuntu Linux

By admin | July 18, 2008

Update (2010-10-10): If you are getting “E: Couldn’t find package sensors-applet” errors, then add universe to /etc/apt/sources.list (add or uncomment http://archive.ubuntu.com/ubuntu <dist code> universe)

lm-sensors is a very useful tool to measure your CPU temperature and your fan speed (which is not in /proc/cpuinfo) in Ubuntu Linux. In order to use it, you will first need to install it.

$ sudo apt-get install lm-sensors libsensors4
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
i2c read-edid sensord
The following NEW packages will be installed:
libsensors4 lm-sensors
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
Need to get 0B/250kB of archives.
After this operation, 918kB of additional disk space will be used.
Selecting previously deselected package libsensors4.
(Reading database ... 117271 files and directories currently installed.)
Unpacking libsensors4 (from .../libsensors4_1%3a3.0.0-4ubuntu1_i386.deb) ...
Selecting previously deselected package lm-sensors.
Unpacking lm-sensors (from .../lm-sensors_1%3a3.0.0-4ubuntu1_i386.deb) ...
Setting up libsensors4 (1:3.0.0-4ubuntu1) ...
udev active, devices will be created in /dev/.static/dev/</code>

Setting up lm-sensors (1:3.0.0-4ubuntu1) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

Now, before you can use it, you need to configure it by running sensors-detect as root. Just press Enter whenever the script asks you a question.
When it asks you “Do you want to add these lines automatically?”, type in yes and press enter.

$ sudo sensors-detect
# sensors-detect revision 5016 (2007-11-11 22:20:16 +0100)

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.

We can start with probing for (PCI) I2C or SMBus adapters.
Do you want to probe now? (YES/no):
Probing for PCI bus adapters…
Use driver `i2c-viapro’ for device 0000:00:07.3: VIA Technologies VT82C596 Apollo ACPI

We will now try to load each adapter module in turn.
Module `i2c-viapro’ already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

To continue, we need module `i2c-dev’ to be loaded.
Do you want to load `i2c-dev’ now? (YES/no):
Module loaded successfully.

We are now going to do the I2C/SMBus adapter probings. Some chips may
be double detected; we choose the one with the highest confidence
value in that case.
If you found that the adapter hung after probing a certain address,
you can specify that address to remain unprobed.

Next adapter: SMBus Via Pro adapter at 5000 (i2c-0)
Do you want to scan it? (YES/no/selectively):
Client found at address 0x2d
Handled by driver `gl520sm’ (already loaded), chip type `gl520sm’
Client found at address 0×50
Probing for `Analog Devices ADM1033′… No
Probing for `Analog Devices ADM1034′… No
Probing for `SPD EEPROM’… Yes
(confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM’… No
Client found at address 0×51
Probing for `Analog Devices ADM1033′… No
Probing for `Analog Devices ADM1034′… No
Probing for `SPD EEPROM’… Yes
(confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM’… No
Client found at address 0×52
Probing for `Analog Devices ADM1033′… No
Probing for `Analog Devices ADM1034′… No
Probing for `SPD EEPROM’… Yes
(confidence 8, not a hardware monitoring chip)
Probing for `EDID EEPROM’… No

Some chips are also accessible through the ISA I/O ports. We have to
write to arbitrary I/O ports to probe them. This is usually safe though.
Yes, you do have ISA I/O ports even if you do not have any ISA slots!
Do you want to scan the ISA I/O ports? (YES/no):
Probing for `National Semiconductor LM78′ at 0×290… No
Probing for `National Semiconductor LM78-J’ at 0×290… No
Probing for `National Semiconductor LM79′ at 0×290… No
Probing for `Winbond W83781D’ at 0×290… No
Probing for `Winbond W83782D’ at 0×290… No
Probing for `Silicon Integrated Systems SIS5595′… No
Probing for `VIA VT82C686 Integrated Sensors’… No
Probing for `VIA VT8231 Integrated Sensors’… No
Probing for `IPMI BMC KCS’ at 0xca0… No
Probing for `IPMI BMC SMIC’ at 0xca8… No

Some Super I/O chips may also contain sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no):
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor’… No
Trying family `SMSC’… No
Trying family `VIA/Winbond/Fintek’… No
Trying family `ITE’… No
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor’… No
Trying family `SMSC’… No
Trying family `VIA/Winbond/Fintek’… No
Trying family `ITE’… No

Some CPUs or memory controllers may also contain embedded sensors.
Do you want to scan for them? (YES/no):
AMD K8 thermal sensors… No
AMD K10 thermal sensors… No
Intel Core family thermal sensor… No
Intel AMB FB-DIMM thermal sensor… No

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `gl520sm’ (should be inserted):
Detects correctly:
* Bus `SMBus Via Pro adapter at 5000′
Busdriver `i2c-viapro’, I2C address 0x2d
Chip `gl520sm’ (confidence: 6)

I will now generate the commands needed to load the required modules.
Just press ENTER to continue:

To load everything that is needed, add this to /etc/modules:

#----cut here----
# I2C adapter drivers
i2c-viapro
# Chip drivers
gl520sm
#----cut here----

Do you want to add these lines automatically? (yes/NO) yes

If it gives the error “You need to be root to run this script.”, then re-run it as root.

You’re done! Type sensors in the command line to run.

$ sensors
gl520sm-i2c-0-2d
Adapter: SMBus Via Pro adapter at 5000
+5V:         +5.13 V  (min =  +0.00 V, max =  +0.00 V)
+3.3V:       +3.31 V  (min =  +0.00 V, max =  +0.00 V)
+12V:       +12.03 V  (min =  +0.00 V, max =  +0.00 V)
Vcore:       +2.11 V  (min =  +0.00 V, max =  +0.00 V)
fan1:          0 RPM  (min =    0 RPM, div = 1)
fan2:          0 RPM  (min =    0 RPM, div = 1)
temp1:       +35.0 C  (high = -130.0 C, hyst = -130.0 C)
temp2:       +35.0 C  (high = -130.0 C, hyst = -130.0 C)
cpu0_vid:   +2.050 V
beep_enable:disabled

If you want a graphical applet, run this:

$ sudo apt-get install sensors-applet
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libsensors-applet-plugin0
Recommended packages:
hddtemp
The following NEW packages will be installed:
libsensors-applet-plugin0 sensors-applet
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
Need to get 118kB of archives.
After this operation, 713kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com hardy/universe libsensors-applet-plugin0 2.2.1-1ubuntu3 [18.5kB]
Get:2 http://us.archive.ubuntu.com hardy/universe sensors-applet 2.2.1-1ubuntu3 [99.7kB]
Fetched 118kB in 1s (74.0kB/s)
Selecting previously deselected package libsensors-applet-plugin0.
(Reading database ... 117338 files and directories currently installed.)
Unpacking libsensors-applet-plugin0 (from .../libsensors-applet-plugin0_2.2.1-1ubuntu3_i386.deb) ...
Selecting previously deselected package sensors-applet.
Unpacking sensors-applet (from .../sensors-applet_2.2.1-1ubuntu3_i386.deb) ...
Setting up libsensors-applet-plugin0 (2.2.1-1ubuntu3) ...</code>

Setting up sensors-applet (2.2.1-1ubuntu3) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

Then right click a panel and select “Add to Panel”. Then in the list select “Hardware Sensors Monitor” and click “Add”.

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 15 Comments »

15 Responses to “Measure CPU temperature and your fan speed in Ubuntu Linux”

  1. trompyx Says:
    January 31st, 2009 at 7:36 am

    very good post, tnx

  2. Joel Says:
    April 4th, 2009 at 10:02 am

    This came in handy for my new server thank you very much!

  3. Bombpersons Says:
    July 6th, 2009 at 3:45 pm

    Wow, this is very nifty =D

  4. oku Says:
    July 26th, 2009 at 1:20 am

    Ha~~~

  5. arjunah Says:
    September 4th, 2009 at 10:18 am

    It works out of the box! Thanks a lot!

  6. Alexandra Jau Says:
    December 26th, 2009 at 6:11 pm

    Thank you for great tip. Works like a charm.

  7. Overheat issues on Toshiba A210 / Measuring CPU temperature « Moving towards linux..! Says:
    January 12th, 2010 at 6:07 am

    [...] lmSensors – is probably the best acknowledged one. (guides here and here) [...]

  8. Ryan Says:
    May 24th, 2010 at 2:36 pm

    Very good post and it just worked. Thank you very much.

  9. Yanis Says:
    July 20th, 2011 at 5:02 pm

    Great post. Thanks !

  10. noisy machine1 Says:
    October 17th, 2011 at 1:25 am

    thanks for this.

  11. Как смотреть тепературу процессора под Ubuntu Linux « Интересно почитать… Says:
    July 24th, 2012 at 6:14 am

    [...] видимо, это не всегда работает, по идее эта команда должна показывать и частоту вращения кулера. [...]

  12. Sun Says:
    December 26th, 2012 at 12:55 pm

    Sorry if this sounds a little dumb, but after doing everything and installing the graphical applet where is this “panel” you’re talking about? Is it in settings? or is it the applets on the top right corner, I can’t seem to find it.
    Thanks for the help, can’t wait to see this in action!

  13. Sun Says:
    December 26th, 2012 at 12:56 pm

    I am running Ubuntu 12.10 btw.

  14. Sun Says:
    December 26th, 2012 at 12:59 pm

    This is what I see when I run “sensors”:

    acpitz-virtual-0
    Adapter: Virtual device
    temp1: +52.0°C (crit = +98.0°C)

    coretemp-isa-0000
    Adapter: ISA adapter
    Core 0: +35.0°C (crit = +90.0°C)

    Does this mean my fan is broken?

  15. admin Says:
    December 29th, 2012 at 8:06 pm

    @Sun:

    If you’re using GNOME3 sensors-applet will work fine.

    However if you’re using Unity I think you’ll need something like https://launchpad.net/indicator-sensors

Comments