lm_sensors modules don't want to load on boot

Thomas Cameron thomas.cameron at camerontech.com
Wed Jul 21 02:37:26 UTC 2004


----- Original Message ----- 
From: "Ben Vitale" <bsvitale at comcast.net>
To: "For users of Fedora Core releases" <fedora-list at redhat.com>
Sent: Tuesday, July 20, 2004 8:56 PM
Subject: lm_sensors modules don't want to load on boot


> Hi folks,
>
> I have this file..
>
> -rwxr-xr-x  1 root root 102 Jul 12 22:44 /etc/rc.d/init.d/lm_sensors
>
> Which contains:
>
> #!/bin/sh
> /sbin/modprobe i2c-nforce2
> /sbin/modprobe i2c-isa
> /sbin/modprobe eeprom
> /sbin/modprobe it87
>
> But when I boot into FC2, these statements don't seem to get executed,
> and my sensors don't show up gkrellm.  After startup, if I execute those
> commands manually from the command-line as root, they load without error
> and the sensors work properly.
>
> What am I missing to get that accomplished on startup?
>
> Thanks,
> Ben

The scripts in /etc/rc.d/init.d don't get directly run at boot time.
Instead, there are symbolic links to them from /etc/rc.d/rcX.d where X is
the runlevel you are booting up (typically 3 or 5).  So for a script called
/etc/rc.d/init.d/foo you might have a link to /etc/rc.d/rc3.d/S99foo.  The
links which start with S (that's capital S) get started when your system
enters the runlevel for the directory.  The links which start with a K (big
K) get stopped (think Kill).

The "official" way for the symlinks to be created is via the chkconfig
utility.  Read the man page for chkconfig for more info.

Be aware that creating start/stop scripts is non-trivial the first time you
do it.  Your start script needs to have a case statement for start and stop.
I would do it like this:

#!/bin/bash
# chkconfig: 2345 99 00
# description: Quick hack to load the kernel modules for lm_sensors
case "$1" in
  start)
    /sbin/modprobe i2c-nforce2
    /sbin/modprobe i2c-isa
    /sbin/modprobe eeprom
    /sbin/modprobe it87
  ;;
  stop)
    /sbin/modprobe -r i2c-nforce2
    /sbin/modprobe -r i2c-isa
    /sbin/modprobe -r eeprom
    /sbin/modprobe -r it87
  ;;
  *)
    echo "Usage:  $0 {start|stop}
esac

Hope this is helpful!

TC





More information about the fedora-list mailing list