Revision as of 01:53, 22 April 2013

zh-CN:Lm sensorslm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans. This document explains how to install, configure, and use lm_sensors so that you can monitor CPU temperatures, motherboard temperatures, and fan speeds.

Usage

Installation

Setting up lm_sensors

Use sensors-detect to detect and generate a list of kernel modules:

# sensors-detect

This will create the /etc/conf.d/lm_sensors configuration file which is used by the sensors daemon to automatically load kernel modules on boot. You will be asked if you want to probe for various hardware. The "safe" answers are the defaults, so just hitting Template:Keypress to all the questions will generally not cause any problems.

When the detection is finished, you will be presented with a summary of the probes. Here is an example summary from my system:

sensord

There is an optional daemon called sensord (included with the lm_sensors package) which can log your data to a round robin database (rrd) and later visualize graphically. See the sensord man page for details.

Troubleshooting

Renumbering Cores for Multi-CPU Systems

In rare cases, the actual numbering of physical cores on multi-processor motherboards can be incorrect. Consider the following HP Z600 workstation with dual Xeons:

Note the cores are numbered 0, 1, 9, 10 which is repeated into the second CPU. Most users want the core temperatures to report out in sequential order, i.e. 0,1,2,3,4,5,6,7. Fixing the order is accomplished in two steps.

Step 1. ID what each chip is reporting

Run sensors with the -u switch to see what options are available for each physical chip:

Sensors not working since Linux 2.6.31

A change in version 2.6.31 has made some sensors stop working. See this FAQ entry for a detailed explanation and for some example errors. To fix sensors, add the following to your kernel boot line (e.g. in your GRUB/GRUB2 configuration file) and reboot your machine:

acpi_enforce_resources=lax

Warning: In some situations, this may be dangerous. Consult the FAQ for details.

Note that in most cases the information is still accessible via other modules (e.g. via ACPI modules) for the hardware in question. Many utilities and monitors (e.g. /usr/bin/sensors) can gather information from either source. Where possible, this is the preferred solution.

K10Temp Module

Some K10 processors have issues with their temperature sensor. From the kernel documentation (linux-<version>/Documentation/hwmon/k10temp):

All these processors have a sensor, but on those for Socket F or AM2+, the sensor may return inconsistent values (erratum 319). The driver will refuse to load on these revisions unless you specify the force=1 module parameter.

Due to technical reasons, the driver can detect only the mainboard's socket type, not the processor's actual capabilities. Therefore, if you are using an AM3 processor on an AM2+ mainboard, you can safely use the force=1 parameter.

On affected machines the module will report "unreliable CPU thermal sensor; monitoring disabled". If you still want to use the module you can: