From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Fri, 02 Nov 2007 05:17:41 +0000 Subject: Re: When does udev info (/sys/...) become available? Message-Id: <20071102051741.GA18429@kroah.com> List-Id: References: <200711011814.lA1IEOSO004819@deneb.dwf.com> In-Reply-To: <200711011814.lA1IEOSO004819@deneb.dwf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Thu, Nov 01, 2007 at 12:53:28PM -0600, clemens@dwf.com wrote: > > On 11/1/07, clemens@dwf.com wrote: > > > When does udev populate the /sys file system? > > > I tried using some info that is there later (when the user has control) during > > > an init.d startup scripts and the info is not there yet > > > (and Im not sure how to write the script w/o the information). > > > I tried a delay (sleep) in the script but that didnt help... > > > > Whenever you mount sysfs to /sys. You need to do this before udev runs > > since it relies heavily on the information in /sys. You may need to > > use 'mount -n' if root is read-only at that point and record the mount > > information later. For example, see the LFS bootscripts: > > > > http://downloads.linuxfromscratch.org/lfs-bootscripts-20070813.tar.bz2 > > > > First, /sys and /proc are mounted. Then the /dev tmpfs is mounted and > > udev* is run. Then /etc/mtab is rewritten to record the /, /proc and > > /sys mount points and the rest of the mounts are done. The three > > scripts are mountkernfs, udev and mountfs. > > > > That's not the only way to do it, but it should get you pointed in > > right direction. > > > OK, let me be more specific. > I am using the standard Linux boot. > During the execution of a script in the init.d directory, I try to cat > information from a file in the /sys directory. > I get error messages. > Here is what I see: > ls /sys/class/pps [ this file exists and I get the ls, which is empty ] So your class is created now. > ls /sys/class/pps/pps0 [ this fails, tho the dir is there at 'user' time ] > cat /sys/class/pps/pps0/path [ this obviously also fails ] you need to wait until your device shows up. So don't try to do this in an init script, but do it in a script that runs when udev sees this device show up. That's the only way you are going to properly syncronize something like this. thanks, greg k-h ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel