LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   How to have udev start at boot (https://www.linuxquestions.org/questions/mandriva-30/how-to-have-udev-start-at-boot-432287/)

RVDowning 04-06-2006 08:11 AM

How to have udev start at boot
 
Running Mandriva 2006.

I found that all my troubles with having usb initialized and usb devices automounted was due to not having udev running. If I do a "service udev start" all is well. Of course, after a reboot, it is not running again.

Where is the start of the udev service supposed to be? It should be started at a pretty low level, but I don't know where.

tuxangler 04-06-2006 08:57 AM

I dont know much about Mandriva.
I have two symlinks in /etc/init.d/rc3.d/
Quote:

linux:/etc/init.d/rc3.d # l *ude*
lrwxrwxrwx 1 root root 12 2006-01-01 17:56 K18boot.udev -> ../boot.udev*
lrwxrwxrwx 1 root root 12 2005-12-26 07:31 S04boot.udev -> ../boot.udev*
These start this Script:

linux:/etc/init.d # cat boot.udev
Code:

#! /bin/sh
# $Id: udev.boot.udev 250 2005-03-10 15:10:24Z hare $
# Copyright (c) 2004 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# /etc/init.d/boot.udev

### BEGIN INIT INFO
# Provides:          boot.udev
# Required-Start:    boot.rootfsck
# Default-Start:    B 2 3 5
# Default-Stop:
# Short-Description: recreate /dev contents and udev device node database
# Description:      This script creates a /dev tree if /dev is
# mounted as a tmpfs. In comparison to the old /dev/ with devices
# populated by the devs RPM this script will only create devices that
# are actually present in the kernel at boot time. The hotplugging
# will later fill in new device entries if devices are attached and
# remove them if devices are detached.
### END INIT INFO
#

. /etc/rc.status
. /etc/udev/udev.conf

DAEMON=/sbin/udevd
udevd_args="--daemon"

case "$1" in
    start)
        case "$pcmcia" in
                off|no|0) echo "pcmcia=$pcmcia" > /dev/shm/nopcmcia
        esac
        if [ -n "$NOPCMCIA" ] ; then
                echo "NOPCMCIA=$NOPCMCIA" > /dev/shm/nopcmcia
        fi
        checkproc $DAEMON
        if [ $? -eq 0 ]; then
                if [ -z "$RUNLEVEL" ] ; then
                        echo -n "Starting udevd (already running)"
                        rc_status -v
                fi
                rc_exit
        fi
        if [ -x $DAEMON ] ; then
                # check for /sys
                if [ ! -d /sys/class ]; then
                    mount -t sysfs none /sys
                fi
                if [ -d /lib/klibc/events ]; then
                    for event in /lib/klibc/events/*; do
                        if [ -f $event ]; then
                            udevd_args="$udevd_args --stop-exec-queue"
                            break;
                        fi
                    done
                fi
                echo -n "Starting udevd "
                [ -d $udev_db ] || mkdir $udev_db
                # Create permissions device
                [ -n "$udev_devperms" ] && touch $udev_devperms
                #
                # Check whether we can use uevent messages
                #
                if zcat /proc/config.gz | grep -q KOBJECT_UEVENT ; then
                    # Yes, just use udevd
                    export UDEVD_EXPECTED_SEQNUM=$(cat /sys/kernel/hotplug_seqnum)
                    export UDEVD_EVENT_TIMEOUT=1
                    startproc $DAEMON $udevd_args
                    echo "" > /proc/sys/kernel/hotplug
                else
                    # No, use the udevsend/udevd combo
                    echo "/sbin/udevsend" > /proc/sys/kernel/hotplug
                fi
                # Create static devices
                if [ -f  /etc/udev/static_devices.txt ]; then
                    /sbin/udev.create_static_devices.sh /etc/udev/static_devices.txt
                fi
                # Remember status and be verbose
                rc_status $status -v
        fi

        ;;
    stop)
        if [ -n "$PREVLEVEL" ]; then
                case "$PREVLEVEL" in
                2|3|5)
                        rc_exit
                        ;;
                esac
        fi
        echo -n "Stopping udevd:"
        echo "/sbin/udevsend" > /proc/sys/kernel/hotplug
        killproc $DAEMON
        rc_status -v
        ;;
    restart)
        echo -n "Restarting udevd:"
        killproc $DAEMON
        export UDEVD_EXPECTED_SEQNUM=$(cat /sys/kernel/hotplug_seqnum)
        startproc $DAEMON $udevd_args
        rc_status -v
        ;;
    status)
        echo -n "Checking for udevd:"
        checkproc -p $UDEVD_PIDFILE /sbin/udevd
        rc_status -v
        ;;
    reload)
        echo -n "Reloading udev rules:"
        udevcontrol reload_rules
        rc_status -v
        ;;
    force-reload)
        if [ -x /sbin/udevstart ] ; then
                echo -n "recreate all available device nodes in /dev: "
                rm -rf $udev_db /dev/disk
                export UDEV_NO_DEVD=1
                export UDEV_NO_HOTPLUGD=1
                /sbin/udevstart &
                unset UDEV_NO_HOTPLUGD
                unset UDEV_NO_DEVD
                rc_status -v
        fi
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
        exit 1
        ;;
esac
rc_exit


RVDowning 04-07-2006 08:04 AM

Well, what I ended up doing was:

Adding "/sbin/udevstart" to the end of "/etc/rc.d/rc.local" did nothing. However, I replaced "/sbin/udevstart" with "service udev start" and that did the trick.

I do see that in "rc.sysinit" there is a "service udev start". Why that doesn't work such that I have to add the same statement in again in "rc.local" I have no idea.

At least this seems to work. However, I notice that if I plug in a new usb device for the first time and then reboot, the system will hang when attempting to go into kde (autologin). I have to do a ctrl-alt-bksp and then log in to KDE. It then comes up fine. Thereafter, if I reboot again with that same new usb device plugged in, all is well.

reddazz 04-07-2006 08:35 AM

Code:

#chkconfig udev on
This will start udev at boot time.

RVDowning 04-07-2006 09:04 AM

But where would it put the instruction to start udev? There is already a "service udev start" in "rc.sysinit". Should this be removed? Also, do you suggest I remove the one I added in "/etc/rc.d/rc.local" and then just key at a terminal "#chkconfig udev on"? I don't follow this.

reddazz 04-07-2006 09:12 AM

Leave things as they are. Enter the commands above and reboot.

RVDowning 04-07-2006 02:57 PM

You certainly know more about it than I do, but I would still think that if I execute "#chkconfig udev on" there ought to be a conflict with the statement "service udev start" in "rc.sysinit". Wouldn't a "start" complain if the item had already been started?

reddazz 04-07-2006 06:50 PM

Quote:

Originally Posted by RVDowning
You certainly know more about it than I do, but I would still think that if I execute "#chkconfig udev on" there ought to be a conflict with the statement "service udev start" in "rc.sysinit". Wouldn't a "start" complain if the item had already been started?

Chkconfig does not actually start a service, it simply marks the service for startup at boot time.

tuxangler 04-07-2006 08:01 PM

For my Distribution "insserv udev start" would work as well.
It creates the Symlinks described above.

westblizz 06-09-2010 01:51 PM

Code:

chkconfig 'service' on
This places the service's script softlink in the boot.d directory.

boot.d is executed from:
/etc/inittab/ -> /etc/init.d/boot -> boot.d


All times are GMT -5. The time now is 03:16 AM.