Skip to contentSkip to conversation

Udev and initscripts

DISCUSSION Alexander E. Patrakov 2 participants 2 messages Jun 4, 2004

lore
Share & tools
lore
#0 lore raw

It has been stated many times that scripts that should run after device is available should live in /etc/dev.d directory. However, I have trouble following this. The recommendation works perfectly when one has to wait for creation of a single device, but it is difficult or impossible to implement when waiting for many unknown devices.

The problem is that Linux From Scratch needs an initscript with the following properties:

1) it should read a file "/etc/sysconfig/modules" (aka "/etc/modules" in Debian). All modules listed there by the user should be modprobed into the kernel.

2) The next initscript should be able to assume that all devices it needs are already there.

How do I implement (2), i.e., wait for creation of all devices that can be created by a user-specified list of modules?

Just doing nothing does not work, as illustrated by the following example:

[root in ~]# modprobe nbd ; ( ls /dev/nbd* | wc -l ) ; sleep 1 ; \
( ls /dev/nbd* | wc -l )

     113
     128
Signature · 12 lines
Alexander E. Patrakov


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 9 lines · Alexander E. Patrakov

The problem is that Linux From Scratch needs an initscript with the following properties:

1) it should read a file "/etc/sysconfig/modules" (aka "/etc/modules" in Debian). All modules listed there by the user should be modprobed into the kernel.

2) The next initscript should be able to assume that all devices it needs are already there.

I believe this is the real source of the problem; if you are going to support hotplug, then you really have to support it properly. That means that instead of having an initscript wait for devices to appear, the actions that initscript would do upon the device appearance should be done by a hotplug script.

If the initscript really does need to wait until the devices appear, then you'll need to have a hotplug script that is invoked when the device(s) are created that creates some type of "flag" file that the initscript can wait for. However, this approach is fraught with problems, like the fact that the initscript will wait forever if the device just happens to not be attached to the system during this boot, or the device is not responding, etc.

-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel