Install and configure lm_sensors in Ubuntu-based systems.

Feb 15, 2007 11:07 GMT  ·  By

The primary goal of the lm_sensors project is to provide the best and most complete hardware health monitoring drivers for Linux. The project developers strive to produce well organized, efficient, safe, flexible and tested code, free of charge, to all Linux users employing the x86 hardware platform. This software can be used on one hand by users who are curious of knowing the hardware health status of their machine. Some users will always try to squeeze every ounce of use out of their hardware by applying various tweaks to their hardware. This software can not only help users do that, but it can also show them how the rest of the hardware is doing. On the other hand, this project can also be used on high-end/unattended servers by setting it to monitor the hardware and email the administrator in the event of a problem, before it becomes critical.

Unfortunately, the lm_sensors project can't be pre-configured to work out-of-the-box because of the different hardware people use. Therefore, if you want to use it, you'll need to configure to suit your system and hardware specs.

Installing lm_sensors

- Open Synaptic GUI, search and install 'lm_sensors' or open a terminal and type:

code
$ sudo apt-get install lm_sensors
- Open a text editor (kwrite or gedit for a GUI editor, or nano for a terminal editor):
code
$ kwrite mkdev.sh
OR
$ nano mkdev.sh
- and then paste the following:
code
#!/bin/bash

# Here you can set several defaults.

# The number of devices to create (max: 256)
NUMBER=32

# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600

# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
if grep -q "/dev devfs" /proc/mounts ; then
echo "You do not need to run this script as your system uses devfs."
exit;
fi
fi

i=0;

while [ $i -lt $NUMBER ] ; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i || exit
chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
i=$[$i + 1]
done
#end of file
- Save and close the editor, then make the file executable:
code
$ chmod +x mkdev.sh
- Then run it:
code
$ sudo ./mkdev.sh
- Finally, run the sensors detection program:
code
$ sudo sensors-detect
Answer YES to all questions, including to the option of automatic entry in /etc/modules.

Running lm_sensors

- Open a terminal and type

code
$ cat /etc/modules
- You will see a list similar to this:
code
# Generated by sensors-detect on Thu Feb 15 12:15:11 2007
# I2C adapter drivers
# modprobe unknown adapter NVIDIA i2c adapter 2 at 2:00.0
i2c-isa
# I2C chip drivers
eeprom
it87
- Load each module listed there. Replace the modules in the example with the ones found on your system.
code
$ sudo modprobe i2c-isa
$ sudo modprobe eeprom
$ sudo modprobe it87
- Run the following command to get the data from sensors.
code
$ sensors
- This command SHOULD give you an output similar to this:

Installing lm_sensors GUI front-ends

Optionally, you can install a front-end that shows the sensor info in Gnome or KDE.

- For Gnome (Add applet to taskbar):

code
$ sudo apt-get install sensors-applet
- For KDE:
code
$ sudo apt-get install ksensors
- Start it (KMenu / Utilities / ksensors in GUI, or type 'ksensors' in a terminal) - Open configuration dialog, go to *module*sensors and select which sensors to show in Panel and which to show in Dock.

After everything has been installed and proved it's working, reboot your system.

Photo Gallery (2 Images)

Open gallery