linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* When does udev info (/sys/...) become available?
@ 2007-11-01 18:14 clemens
  2007-11-01 18:28 ` Kay Sievers
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: clemens @ 2007-11-01 18:14 UTC (permalink / raw)
  To: linux-hotplug

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...

Im not sure where to look for this sort of documentation.

-- 
                                        Reg.Clemens
                                        reg@dwf.com



-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: When does udev info (/sys/...) become available?
  2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
@ 2007-11-01 18:28 ` Kay Sievers
  2007-11-01 18:32 ` Dan Nicholson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2007-11-01 18:28 UTC (permalink / raw)
  To: linux-hotplug

On Nov 1, 2007 7:14 PM,  <clemens@dwf.com> wrote:
> When does udev populate the /sys file system?

Never, it's the kernel itself. You just need to mount it.

Kay

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: When does udev info (/sys/...) become available?
  2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
  2007-11-01 18:28 ` Kay Sievers
@ 2007-11-01 18:32 ` Dan Nicholson
  2007-11-01 18:47 ` Greg KH
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dan Nicholson @ 2007-11-01 18:32 UTC (permalink / raw)
  To: linux-hotplug

On 11/1/07, clemens@dwf.com <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.

--
Dan

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: When does udev info (/sys/...) become available?
  2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
  2007-11-01 18:28 ` Kay Sievers
  2007-11-01 18:32 ` Dan Nicholson
@ 2007-11-01 18:47 ` Greg KH
  2007-11-01 18:53 ` clemens
  2007-11-02  5:17 ` Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-11-01 18:47 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 01, 2007 at 12:14:24PM -0600, clemens@dwf.com wrote:
> When does udev populate the /sys file system?

The kernel populates /sys at boot time, no userspace tool can create
directories in sys.

Perhaps you are getting confused as to when sysfs is being mounted at
/sys by your init scripts?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: When does udev info (/sys/...) become available?
  2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
                   ` (2 preceding siblings ...)
  2007-11-01 18:47 ` Greg KH
@ 2007-11-01 18:53 ` clemens
  2007-11-02  5:17 ` Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: clemens @ 2007-11-01 18:53 UTC (permalink / raw)
  To: linux-hotplug

> On 11/1/07, clemens@dwf.com <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 ]
    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 ]

As noted a sleep doesnt help, so the population is not going on in background.
So, when are these files / this information available?
-- 
                                        Reg.Clemens
                                        reg@dwf.com



-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: When does udev info (/sys/...) become available?
  2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
                   ` (3 preceding siblings ...)
  2007-11-01 18:53 ` clemens
@ 2007-11-02  5:17 ` Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2007-11-02  5:17 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Nov 01, 2007 at 12:53:28PM -0600, clemens@dwf.com wrote:
> > On 11/1/07, clemens@dwf.com <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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-11-02  5:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01 18:14 When does udev info (/sys/...) become available? clemens
2007-11-01 18:28 ` Kay Sievers
2007-11-01 18:32 ` Dan Nicholson
2007-11-01 18:47 ` Greg KH
2007-11-01 18:53 ` clemens
2007-11-02  5:17 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).