Gentoo Wiki ArchivesGentoo Wiki

Lm_sensors

This article is part of the Hardware series.
Laptops TV Tuner Cards Wireless Servers Storage Other Hardware Motherboards Related

Contents

This guide describes how to access and display temperature, fan speeds and power voltage information available on most motherboards. The application that makes this possible is lm_sensors.

Warning:

Be careful when activating sensors, like i2c, in the kernel. On some systems this might stop the fans from working and can disable the ACPI system-overheat shutdown as well. This will cause your computer to freeze at best, or may even cause serious hardware damage.

Refer to your hardware's specific wiki page or the forum for more information.


Subpages

Setup

To use sensors, there are two components you will require, the userspace tools, lm_sensors, and some kernel modules.

The usual install procedure goes as follows:

  1. Install all of the modules into the kernel
  2. Install lm_sensors
  3. Use the lm_sensors auto-detect script to determine required modules
  4. Un-install non-required modules
  5. Configure sensor names and properties


Kernel

Unless you know exactly which drivers are needed, activate everything under 'I2C support' and 'Hardware Monitoring Support' for now. The sensors-detect will let you know which ones you need:

Linux Kernel Configuration: Kernel modules
Device Drivers  --->
    <M> I2C support  --->
        <M> I2C device interface
            I2C Hardware Bus support --->  
            # Activate everything
    <M> Hardware Monitoring Support --->
        # Activate everything

Userspace

Install lm_sensors:

# emerge -a lm_sensors

If you would like to use monitoring programs, add the USE flag lm_sensors to your /etc/make.conf:

File: /etc/make.conf

USE=" ... lm_sensors ... "

and update your system. Programs like ksysguard utilize lm_sensors:

# emerge -uDNpv world

Detection

Log in as root and run sensors-detect:

# sensors-detect

Go through the detection process. At the end sensors-detect writes a new /etc/conf.d/lm_sensors. There you find all modules you need; the rest can be removed again from the kernel.

You start sensor monitoring by starting the init script:

# /etc/init.d/lm_sensors start

sensors shows you now the temp, fan speed etc. If you see nothing, look at the troubleshooting section.

If you want to start at sensor monitoring at boot time, add lm_sensors to your runlevel:

# rc-update add lm_sensors default

Configuration

By default, lm_sensors does not use any English names for any of the sensors - or it may only have English names for some of them. You can change the names, as well as disable sensors, and change the mathematics that are used by editing the configuration file /etc/sensors.conf. This file contains a lot of comments.

The easiest way change your settings, is to run sensors, and note down the top line returned (the sensor chip), then edit /etc/sensors.conf, and search for the first part of the name. For example, if your sensor chip is a w83781d-isa-0290, a search for w83781d, will return something like:

chip "lm78-*" "lm78-j-*" "lm79-*" "w83781d-*"

then below this line, will be the config lines for that chip.

An example config is:

File: /etc/sensors.conf
 chip "lm78-*" "lm78-j-*" "lm79-*" "w83781d-*"
    label in0 "VCore 1"
    label in1 "VCore 2"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "-12V"
    label in6 "-5V"
    label temp1 "CPU temp"
    label fan2 "CPU fan"
    ignore fan1
    ignore fan3
    ignore temp2
    ignore temp3
    compute in3 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
    compute in4 ((28/10)+1)*@  ,  @/((28/10)+1)
    compute in5 -(210/60.4)*@  ,  -@/(210/60.4)
    compute in6 -(90.9/60.4)*@ ,  -@/(90.9/60.4)
 

This configuration sets some English names, sets ignore on the unused fans, and contains the default calculations for some of the voltages. Most of these values were not changed, except the addition of the labels for CPU temp and CPU fan, and the ignore lines for the fans and temps not in use.

Monitoring

If you would like regular status reports, you will need a monitoring daemon.

Sensord

sensord is a daemon that logs the monitoring output from lm_sensors to syslog. To enable building lm_sensors with sensord, enable the sensord USE flag:

# echo "sys-apps/lm_sensors sensord" >> /etc/portage/package.use

Then run:

# emerge -uDNva lm_sensors

To start sensord and add it to start at boot:

# /etc/init.d/sensord start
# rc-update add sensord default

Unfortunately, this adds unwanted clutter to /var/log/messages. Assuming that you are using the gentoo's default logger (syslog-ng), the following recipe will filter out the events into their own log file (/var/log/sensord):

File: /etc/syslog-ng/syslog-ng.conf
 ...
 destination sensord { file("/var/log/sensord"); };
 filter f_sensord { facility(local4); };
 log { source(src); filter(f_sensord); destination(sensord); };
 ...
 

It's recommended that each line be placed in the appropriate area in the file for consistency sake. It is evident what this means after reviewing the syslog-ng.conf file. local4 is the default facility that is used by sensord. Additional information is in the man page for sensord.

If you have added rules to the syslog-ng.conf file and want to enable them and start logging to /var/log/sensord immediately, restart syslog-ng (this should automatically also restart sensord):

# /etc/init.d/syslog-ng restart

For more information on configuration of sensord, such as changing the logging interval time or reporting facility:

# man sensord

Graphical Sensor Monitors

KDE

Gnome

Other

Troubleshooting

Q: "My sensors do not show up!" or "My sensors are not detected!"

Read [1] and [2], and check the bug reports. If this won't help, you can try experimenting with the modules and their parameters or send the lm_sensors' guys a bug report.

Q: "My sensors always show 10 degrees too much!"

You may need to edit /etc/sensors.conf as appropriate.

Q: "My sensor data needs to be divided by 2!"

Edit /etc/sensors.conf and find uncommented compute temp for cpu appropriate for your chip, then replace 2 with 1 after the letters @* in the same line.

Q: "sensors-detect spits out No i2c device files found. Use prog/mkdev/mkdev.sh to create them!"

Try running modprobe i2c-dev; sensors-detect, if that fails, try google.

Q: "sensors-detect is unable to find some modules! Why are these modules missing?"

Make sure you activated the according option when configuring the kernel and be sure to read point 1.!

Q: "The w83627hf module triggers high fan speed."

Try to solve this by modprobe w83627hf init=0

Q: "sensord won't start. In /var/log/syslog it says 'GPIO5 disabled, no VID function' "

A: Add ignore vid to /etc/sensors.conf.


Links

Retrieved from "http://www.gentoo-wiki.info/Lm_sensors"

Last modified: Sat, 06 Sep 2008 20:06:00 +1000 Hits: 92,502

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.