Monitoring your hardware's temperature

Posted by fsateler on Thu 5 Jan 2006 at 10:36

Sometimes it is useful to know the temperature of your hardware, to prevent it from frying. This information can easily be found, if your hardware provides the sensors needed, and we have the necessary software.

Most computers come with temperature sensors, which can be used to prevent your hardware from excessive heat. The most important thing to watch is, of course, your CPU temperature. This is where lm-sensors comes in. So, lets install it:

# apt-get install lm-sensors

Please notice that lm-sensors needs a recent version of i2c, so your kernel must have it installed (either via a 2.6 kernel (debian's default kernel works), or a patch to your 2.4 kernel). Once we have it installed, we need to configure it. A tool, sensors-detect can be used, but first we must ensure the necessary files are created under /dev. If you have a static /dev, you must manually create them:

# cd /dev && ./MAKEDEV i2c

If you have a dynamic /dev, then you need to load the i2c-dev module (I have only dynamic /dev systems, so I don't know if this module needs to be loaded also on those systems).

# modprobe i2c-dev

After this, you can proceed with the configuration.

# sensors-detect

Follow the instructions, throughout the wizard. Finally, we need to load the modules sensors-detect told us that should be loaded. In my case, it was i2c-viapro, i2c-isa, eeprom and w83627hf.

# modprobe -a i2c-viapro i2c-isa eeprom w83627hf

After this, we should be able to read sensor information. Just run the sample sensors program shipped with lm-sensors, and watch all your sensors! Now, there may be problems with the output: Information given by the hardware must be translated, and sometimes the configuration file doesn't handle your chip nicely. Check with your CMOS hardware monitor (probably by rebooting) that the readings are correct, and if not, modify /etc/sensors.conf (this file is extensively self-documented).

After you are done with /etc/sensors.conf, you can proceed to install a sensor monitor compatible with lm-sensors (eg: ksensors, xsensors, wmtemp). Alternatively, you might want to install the sensord daemon, which logs to syslog.

Now that we have our CPU covered, we can get worried about the next important thing: hard drives. This is simpler to set up. Just install the hddtemp package.

# apt-get install hddtemp

With the package installed, we can now check our drives temperature. Note that hddtemp must be run as root.

# hddtemp /dev/hd?
/dev/hda: Maxtor 6E040L0: 40 C
/dev/hdb: ST340824A: 47 C
/dev/hdc: CREATIVE CD-RW RW8439E: S.M.A.R.T. not available
/dev/hdd: LTN526: S.M.A.R.T. not available

As you can see, both my hard drives support temperature sensors, but my two CD drives don't. Note that hddtemp is not limited to IDE drives, it's just that I only have these.

Also, hddtemp has the ability to run as a daemon, but the Debian installation comes disabled by default. To enable it, we must edit /etc/default/hddtemp, and set it to RUN_DAEMON="true" (if you want, you can set also which hard drives to check, to speed things up a bit). Then you can run the provided init script, and hddtemp will be running.
Running hddtemp as a daemon, has the advantage of letting regular users check the hard drives temperature, if we have netcat (or equivalent software) installed:

$ nc localhost 7634 ; echo
|/dev/hda|Maxtor 6E040L0|39|C||/dev/hdb|ST340824A|47|C|

Now you can install a frontend (such as sensors-applet), and watch your hardware's temperature in real time, and maybe be alerted of too high temperatures.

 

 


Posted by Steve (82.41.xx.xx) on Thu 5 Jan 2006 at 11:53
[ Send Message | View Steve's Scratchpad | View Weblogs ]

A nice introduction, thanks!

One thing that I do upon my hosts sometimes is use the thermal kernel module.

This appears to allow me to measure the CPU temperature:

root@itchy:~# modprobe thermal
root@itchy:~# cat /proc/acpi/thermal_zone/THRM/temperature
temperature:             23 C

I'm not sure what is required to get this working, other than ACPI, but it seemed to work on most of the machines I have access to ...

Steve

[ Parent | Reply to this comment ]

Posted by trakic (217.147.xx.xx) on Thu 5 Jan 2006 at 13:18
[ Send Message | View Weblogs ]
Try hddtemp for harddisc monitoring ;-)

http://packages.debian.org/unstable/utils/hddtemp

[ Parent | Reply to this comment ]

Posted by fsateler (201.214.xx.xx) on Thu 5 Jan 2006 at 17:08
[ Send Message | View Weblogs ]
Thanks for the heads up :)
However, I can't seem to be able to use thermal zone:
[root@genoa2 ~]# modprobe -v thermal
insmod /lib/modules/2.6.14-2-k7/kernel/drivers/acpi/processor.ko
insmod /lib/modules/2.6.14-2-k7/kernel/drivers/acpi/thermal.ko
[root@genoa2 ~]# cat /proc/acpi/thermal_zone/THRM/temperature
cat: /proc/acpi/thermal_zone/THRM/temperature: No such file or directory
[root@genoa2 ~]# ls /proc/acpi/thermal_zone/
[root@genoa2 ~]#
My hardware is indeed somewhat old (from the days when AMD Athlon's (not XP) were new), so perhaps acpi thermal module needs more modern hardware than lm-sensors.
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Sat 7 Jan 2006 at 21:11
[ Send Message | View Steve's Scratchpad | View Weblogs ]

I'm sorry to say that I don't know what the requirements are - just I saw a mention of it on a mailing list and know it works for me ..

Steve

[ Parent | Reply to this comment ]

Posted by Anonymous (72.25.xx.xx) on Sun 30 Jul 2006 at 20:03
I have an athlon XP 1700+ on a VIA-based motherboard with kernel 2.6.15. The acpi reported cpu temperature is erratic, jumping from ~ 24C to over 75C from one reading to the next. I don't believe it's right. The bios itself doesn't show those jumps. Anyway, I was just wondering if anybody else has seen something similar.

[ Parent | Reply to this comment ]

Posted by Anonymous (193.196.xx.xx) on Thu 5 Jan 2006 at 13:40
I run a grsecurity patched kernel and get following message:

Do you want to scan the ISA bus? (YES/no):
/dev/port: Operation not permitted

Syslog says:
Jan 5 14:37:16 pluto kernel: grsec: From 84.171.164.44: denied open of /dev/port by /usr/sbin/sensors-detect[sensors-detect:22934] uid/euid:0/0 gid/egid:0/0, parent /bin/bash[bash:1304] uid/euid:0/0 gid/egid:0/0

How can I allow sensors-detect accessing /dev/port?

I know this is sort of offtopic here but perhaps someone knows :-)

Thanks!

[ Parent | Reply to this comment ]

Posted by Anonymous (83.173.xx.xx) on Sat 22 Apr 2006 at 19:31
If you told your kernel to deny writing to /dev/port in the grsec-options then there is no way that sensors-detect would write to /dev/port.
You'll have to disable this option in the kernel if you want to use /dev/port to scan for devices or skip these probes.

Regards,
Jean-Pierre

[ Parent | Reply to this comment ]

Posted by Anonymous (62.4.xx.xx) on Thu 5 Jan 2006 at 15:10
i greatly recommend using munin which uses both the mentionned measures and graphs them over time.

apt-get install munin munin-node

http://www.debian-administration.org/articles/229

[ Parent | Reply to this comment ]

Posted by sno (62.254.xx.xx) on Fri 6 Jan 2006 at 17:48
[ Send Message | View Weblogs ]
great article, been using lm-sensors to monitor hardware for a while now but some things i wasn't aware about which will be a good help.

Didnt catch that article on munin so will have to give that a blast too :)

[ Parent | Reply to this comment ]

Posted by undefined (192.91.xx.xx) on Tue 10 Jan 2006 at 16:16
[ Send Message ]
munin? nah, CACTI! :-P

apt-get install cacti

munin has the benefit of having a client portion (where cacti relies on the server querying the client through snmp or custom scripts), so client stats appear to be much easier to obtain.

but cacti looks better. ;-)

[ Parent | Reply to this comment ]

Posted by Anonymous (24.218.xx.xx) on Sat 7 Jan 2006 at 11:54
When I run sensors-detect, I get "No i2c device files found. Use prog/mkdev/mkdev.sh to create them". How do I use prog/mkdev/mkdev.sh to create them?

[ Parent | Reply to this comment ]

Posted by sno (62.254.xx.xx) on Sat 7 Jan 2006 at 18:09
[ Send Message | View Weblogs ]
from the article:

Please notice that lm-sensors needs a recent version of i2c, so your kernel must have it installed (either via a 2.6 kernel (debian's default kernel works), or a patch to your 2.4 kernel). Once we have it installed, we need to configure it. A tool, sensors-detect can be used, but first we must ensure the necessary files are created under /dev. If you have a static /dev, you must manually create them:

# cd /dev && ./MAKEDEV i2c

If you have a dynamic /dev, then you need to load the i2c-dev module (I have only dynamic /dev systems, so I don't know if this module needs to be loaded also on those systems).

# modprobe i2c-dev

re-read and follow the instructions and that should get ya working.

[ Parent | Reply to this comment ]

Posted by Anonymous (38.117.xx.xx) on Sat 7 Jan 2006 at 20:50
So how do we know if we have a static dev or dynamic one?

[ Parent | Reply to this comment ]

Posted by sno (62.254.xx.xx) on Sun 8 Jan 2006 at 13:40
[ Send Message | View Weblogs ]
as far as i understand it in newer 2.6 kernels are inclupding udev' which is dynamic dev (ie it creates the structure as needed, in user space). Instead of the historically static way.

Not the best explanation, maybe someone else can help out there :)

[ Parent | Reply to this comment ]

Posted by fsateler (201.214.xx.xx) on Sun 8 Jan 2006 at 19:34
[ Send Message | View Weblogs ]
My bet would be: if you have a folder /dev/.static your system is dynamic. Otherwise it is static. Another possibility is is you have udev installed. If you have it, then you have a dynamic /dev.
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by agi (80.25.xx.xx) on Tue 10 Jan 2006 at 14:50
[ Send Message ]
If you don't want to mess with kernel modules, and you're running i386 hardware, you may want to try (x)mbmon. It's quite simple, but does the full job (temp, fan RPMs, etc.).

[ Parent | Reply to this comment ]

Posted by chris (80.203.xx.xx) on Wed 25 Jan 2006 at 07:12
[ Send Message | View Weblogs ]

Interesting article :)

Works well using the basic commands e.g.

$ hddtemp /dev/hda
/dev/hda: WDC WD800JB-00JJA0: 43°C

$ smartctl -a /dev/hda

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

194 Temperature_Celsius     0x0022   099   094   000    Old_age   Always       -       44

Now all I need to figure is why for temperature the VALUE column and the RAW_VALUE column are so different. I mean - the RAW_VALUE always corresponds to hddtemp's result. The VALUE column is always at least double and sometimes higher - throws the munin smart graphing output completely :)

[ Parent | Reply to this comment ]

Posted by Anonymous (80.221.xx.xx) on Mon 10 Mar 2008 at 22:55
VALUE has not much to do with actual Celsius scale. Its just a value for knowing, when harddrive is "broken" or as in this case, too hot. In VALUE its "bigger number, the better", unlike in temperature, so it cannot be used directly.

Often this VALUE is somehow reversed temperature. For example, when harddrive is in 30C degrees, the VALUE could be 100. 31C degrees could be VALUE 99. 32C degrees VALUE 98, and so on... 60 degrees VALUE 70.

In this SMART table, device is broken when VALUE reaches TRESHOLD. I do NOT know why treshhold is always 000 in harddrives, and "zero"value in VALUE always quite high, like 100. In my example VALUE 000 (broken device) would mean 130C. ...And i think HDD gets broken way before that?

[ Parent | Reply to this comment ]

Posted by Anonymous (70.74.xx.xx) on Fri 17 Mar 2006 at 19:50

New user here - decided I'd had enough of Windows-related failures and figured I'd try switching to Linux. I heard it was complicated, but have done a fair amount of computer programming in the last 20 years (from the age of 9) and would at least like to "think" I'm not a stupid idiot.

Anyway.

I followed the above instructions exactly and (I believe) lm-sensors configured correctly:

Driver `w83781d' (should be inserted):
Detects correctly:
* Bus `VIA i2c' (Bit-shift algorithm)
Busdriver `i2c-via', I2C address 0x2d (and 0x48 0x49)
ISA bus address 0x0290 (Busdriver `i2c-isa')
Chip `Winbond W83781D' (confidence: 8)

I then added these lines to /etc/modules:

# I2C adapter drivers
i2c-isa
# I2C chip drivers
w83781d

I then went to "run the sample sensors program shipped with lm-sensors" and received the message "No sensors found!"

After this, I browsed through /etc/sensors.conf - everything seemed to be in order. I rebooted, tried the sample sensors program again, and got the same message. After that, I installed the following through apt: ksensors, xsensors, wmtemp, munin, mbmon and xmbmon.

ksensors doesn't appear to display CPU temperature.

xsensors brings up an empty window, and doesn't seem to have any config options.

Now, the Windows user in me assumes that "installing a program" creates a folder with similarly-named files; searching my hard drive for "xsens" found nothing. How in the sweet beautiful fark may I begin using this program?

I was also unable to use wmtemp, munin, mbmon and xmbmon or even find where their files were supposedly installed to.

I used DOS for many years before switching to Windows, and am thinking that obviously, learning Linux through means of a GUI is not the proper way. However, back in the DOS days you could download a program from a BBS, unzip it and it would "just work." Not only that, but you would actually know where the files were. What kind of rocket science is required to find the files in the first place so that I can begin tinkering with them?

[ Parent | Reply to this comment ]

Posted by fsateler (201.214.xx.xx) on Sat 18 Mar 2006 at 15:52
[ Send Message | View Weblogs ]
I can't seem to figure what is going wrong. Maybe you need to load the i2c-via module too?
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by Anonymous (68.148.xx.xx) on Wed 22 Mar 2006 at 18:43
woo-HOO!

Turns out I'm just stupid and didn't know that an "AMD K6/2" is a 686 and not a 586.

Installed the i2c-686 packages and XSensors worked beautifully. :)
Now to go uninstall everything I don't need...


(But if anyone is able to spend a moment and help clarify where files go when programs are "installed," that would be very much appreciated, if somewhat off-topic.)

[ Parent | Reply to this comment ]

Posted by fsateler (201.214.xx.xx) on Thu 23 Mar 2006 at 04:04
[ Send Message | View Weblogs ]
dpkg -L packagename
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by Anonymous (24.200.xx.xx) on Sun 26 Mar 2006 at 04:24
Thanks for the nice introduction! I came across sensors while trying to set up throttling on my laptop. Sorry if my question sounds very basic, but here is what happens when I run 'sensors':

$ sensors
Can't access procfs/sysfs file
Unable to find i2c bus information;
For 2.6 kernels, make sure you have mounted sysfs and libsensors
was compiled with sysfs support!
For older kernels, make sure you have done 'modprobe i2c-proc'!

I am running a 2.6.15 kernel and:

$ lsmod | grep 'i2c'
i2c_dev 8832 0
i2c_sis96x 5380 0
i2c_core 19472 3 i2c_dev,eeprom,i2c_sis96x

which are the modules recommended by sensors-detect.

The /sys directory is there and contains a bus/i2c subdirectory. Am I doing something wrong here?

Thanks.

[ Parent | Reply to this comment ]

Posted by Anonymous (192.100.xx.xx) on Mon 10 Apr 2006 at 13:32
Same for me I have a 2.6.15-1-686-smp #2 SMP i686 GNU/Linux Kernel running on a debian installation. The kernel image is the one pre-compiled.

my lspci:

0000:00:00.0 Host bridge: Intel Corporation 945G/P Memory Controller Hub (rev 02)
0000:00:02.0 VGA compatible controller: Intel Corporation 945G Integrated Graphics Controller (rev 02)
0000:00:02.1 Display controller: Intel Corporation 945G Integrated Graphics Controller (rev 02)
0000:00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
0000:00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)
0000:00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 01)
0000:00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 01)
0000:00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 01)
0000:00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 01)
0000:00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
0000:00:1e.2 Multimedia audio controller: Intel Corporation 82801G (ICH7 Family) AC'97 Audio Controller (rev 01)
0000:00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
0000:00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
0000:00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) Serial ATA Storage Controllers cc=IDE (rev 01)
0000:00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
0000:01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)

No bad information in dmesg about loading adapter. The only information in dmesg is:
i2c /dev entries driver

If I look in /dev I find /dev/i2c-0.
the output of lsmod:

lsmod | grep i2
i2c_i801 8204 0
i2c_dev 9216 0
i2c_core 19840 3 i2c_i801,eeprom,i2c_dev


but the output of sensors:
Can't access procfs/sysfs file
Unable to find i2c bus information;
For 2.6 kernels, make sure you have mounted sysfs and libsensors
was compiled with sysfs support!

I have installed:

dpkg -l | grep sensors
ii libsensors3 2.10.0-4 library to read temperature/voltage/fan sens
ii lm-sensors 2.10.0-4 utilities to read temperature/voltage/fan se

Any help?

Thanks
Stefano

[ Parent | Reply to this comment ]

Posted by Niccolo (88.38.xx.xx) on Sat 10 Jun 2006 at 22:50
[ Send Message ]
Same problem here, with a fresh Debian Etch on an IMB xSerier 206m.

Doing an strace of sensors program, I see that it tries to open /sys/class/hwmon/, which is empty in my system. I have insetead /sys/bus/i2c/drivers which is populated.

Is this a problem related to udev?

[ Parent | Reply to this comment ]

Posted by CarloWood (62.163.xx.xx) on Sat 9 Jun 2007 at 04:15
[ Send Message ]
I have the same problem:

hikaru:/usr/src/libsensors>sudo modprobe w83627ehf
FATAL: Error inserting w83627ehf (/lib/modules/2.6.18-4-amd64/kernel/drivers/hwmon/w83627ehf.ko): No such device

and

hikaru:/usr/src/libsensors>ls /sys/class/hwmon
hikaru:/usr/src/libsensors>

Recompiling lm-sensors did not help.

I think this might be caused by this bug:
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bu g/90265
as I have a P5B Deluxe motherboard as well.

The "solution" then would be to upgrade to kernel 2.6.22. I tried to do
that - but my custom kernel doesn't boot: it fails to put together my
RAID arrays :((. I have no clue how to solve that.


[ Parent | Reply to this comment ]

Posted by Anonymous (78.49.xx.xx) on Sat 30 May 2009 at 20:23
try:
sudo modprobe w83627ehf force_id=0x8860

[ Parent | Reply to this comment ]

Posted by Anonymous (192.19.xx.xx) on Thu 7 Jan 2010 at 17:47
I see same issue. How was it fixed? I have 2.6.20 kernel on MPC8313 board

[ Parent | Reply to this comment ]

Posted by kaspar (84.73.xx.xx) on Sun 11 Jun 2006 at 20:03
[ Send Message ]
Same Problem.

sensors-detect seems to work, indicates the existence of some chips in my Labtop.

But sensors concatenates the same response as described.


root@erich:~# uname -a
Linux erich 2.6.15-1-686 #2 Mon Mar 6 15:27:08 UTC 2006 i686 GNU/Linux


and

root@erich:~# lsmod | grep 'i2c'
i2c_i801 7916 0
i2c_algo_pcf 5988 0
i2c_dev 8640 0
i2c_core 19280 4 eeprom,i2c_i801,i2c_algo_pcf,i2c_dev

Who knows how to get it working?
Thanks

[ Parent | Reply to this comment ]

Posted by Anonymous (89.152.xx.xx) on Thu 22 Jun 2006 at 23:59
The only way I found to solve this problem was to install libsysfs (http://linux-diag.sourceforge.net/Sysfsutils.html) and recompile lm_sensors.

I'm using linux 2.6.17 and lm_sensors 2.10.0.

Hope this helps,
Hugo Leote

[ Parent | Reply to this comment ]

Posted by dcd03 (218.58.xx.xx) on Mon 12 Feb 2007 at 14:50
[ Send Message ]
maybe just add
sysfs /sys sysfs defaults 0 0
to /etc/fstab and then remount all file systems can help.

[ Parent | Reply to this comment ]

Posted by mkb (62.56.xx.xx) on Tue 18 Jul 2006 at 22:05
[ Send Message | View Weblogs ]
I followed the steps outlined but sensors-detect only seemed to pick up my RAM:

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

Driver `eeprom' (should be inserted):
Detects correctly:
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x50
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x51
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x54
Chip `SPD EEPROM' (confidence: 8)
* Bus `SMBus I801 adapter at 0400'
Busdriver `i2c-i801', I2C address 0x55
Chip `SPD EEPROM' (confidence: 8)

(everything else was a fail)... Does anybody know how to get the temp of a Xeon cpu? I've a dual Xeon box:
michael@ratty:~$ uname -a
Linux ratty 2.6.8-3-686-smp #1 SMP Thu Feb 9 07:05:39 UTC 2006 i686 GNU/Linux

I also tried the modprobe thermal but /proc/acpi/thermal_zone/ is empty.

Thanks, Michael

[ Parent | Reply to this comment ]

Posted by Anonymous (15.227.xx.xx) on Tue 9 Jan 2007 at 16:10
Great article, very helpful. Thanks!!

[ Parent | Reply to this comment ]

Posted by Anonymous (84.69.xx.xx) on Fri 30 Nov 2007 at 21:54
Excellent easy to follow guide. well done!

[ Parent | Reply to this comment ]

Posted by Anonymous (68.5.xx.xx) on Tue 21 Jul 2009 at 18:09
Fairly easy to follow and you get some results, not they really mean anything (for me at least). The only temp that comes out correctly for me is the system temp. The others are too high, low or don't exist. As nice as linux is stuff like this is the real kicker, people who need accurate system information have to use M$ (or maybe osx).

[ Parent | Reply to this comment ]

Posted by Anonymous (2800:0xx:0xx:0xxx:0xxx:0xxx:xx) on Mon 14 Jan 2013 at 16:16
This is what I get:

temp1: +36.0°C (low = -55.0°C, high = +127.0°C)
temp2: +39.0°C (low = -55.0°C, high = +127.0°C

What in the world is that? I assume it is room temperature, there's no AC. It doesn't give me the CPU temp. It only found 2 sensors:
Adapter: SMBus I801 adapter at 0580

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1622 votes ~ 7 comments )