linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev synchronization problems
@ 2005-09-15  1:50 J.C. Wren
  2005-09-15 15:34 ` Kay Sievers
  2005-09-19 16:51 ` J.C. Wren
  0 siblings, 2 replies; 3+ messages in thread
From: J.C. Wren @ 2005-09-15  1:50 UTC (permalink / raw)
  To: linux-hotplug

    Forgive me if this has been addressed before.  I did some googling 
for answers, but either there are none, or more likely, I am not using 
the correct search terms for useful results.

    I have a script to create compact flash cards for an application.  
It worked well until I switched from devfs to udev.

    The script is pretty basic.  sfdisk, mke2fs, tune2fs, mount, cp, 
umount.  I run into errors where sfdisk completes, then mke2fs complains 
that /dev/hde1 (hde is the PCMCIA CF card) doesn't exist.  Or sometimes 
it gets past that, and tune2fs complains /dev/hde1 doesn't exist.

    As near as I can tell, it's because udevd doesn't react fast enough 
(from my scripts perspective) and present /dev/hde1 once it's been 
created.  So I tried a few things.  I put a loop in the script waiting 
for /dev/hde1 to become present.  Didn't fix it.  Added some 'sleep 1' 
commands.  Didn't fix it.  Tried a while loop that waited for /dev/hde1 
to become present in /proc/partitions.  Didn't fix it.  However, running 
these commands by hand almost always succeed.

    Is there some reliable way to determine that /dev/hde1 is *really* 
there, and ready for action? 

    I've tried 2.6.12-gentoo-r10, 2.6.13 (vanilla), both against udev 
068 and 069. 

    I've been through the udev utilities, didn't see anything that 
looked like it was what I neeed.  Is there a handy command that makes 
sure things are flushed and updated before the next action can take place?

    I'll cheerfully take a solution, or go back to Google if someone can 
tell me what sort of search terms would be relevant.

    Thanks,
       --jc



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 3+ messages in thread

* Re: udev synchronization problems
  2005-09-15  1:50 udev synchronization problems J.C. Wren
@ 2005-09-15 15:34 ` Kay Sievers
  2005-09-19 16:51 ` J.C. Wren
  1 sibling, 0 replies; 3+ messages in thread
From: Kay Sievers @ 2005-09-15 15:34 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Sep 14, 2005 at 09:50:04PM -0400, J.C. Wren wrote:
>    Forgive me if this has been addressed before.  I did some googling 
> for answers, but either there are none, or more likely, I am not using 
> the correct search terms for useful results.
> 
>    I have a script to create compact flash cards for an application.  
> It worked well until I switched from devfs to udev.
> 
>    The script is pretty basic.  sfdisk, mke2fs, tune2fs, mount, cp, 
> umount.  I run into errors where sfdisk completes, then mke2fs complains 
> that /dev/hde1 (hde is the PCMCIA CF card) doesn't exist.  Or sometimes 
> it gets past that, and tune2fs complains /dev/hde1 doesn't exist.
> 
>    As near as I can tell, it's because udevd doesn't react fast enough 
> (from my scripts perspective) and present /dev/hde1 once it's been 
> created.  So I tried a few things.  I put a loop in the script waiting 
> for /dev/hde1 to become present.  Didn't fix it.  Added some 'sleep 1' 
> commands.  Didn't fix it.  Tried a while loop that waited for /dev/hde1 
> to become present in /proc/partitions.  Didn't fix it.  However, running 
> these commands by hand almost always succeed.
> 
>    Is there some reliable way to determine that /dev/hde1 is *really* 
> there, and ready for action? 
> 
>    I've tried 2.6.12-gentoo-r10, 2.6.13 (vanilla), both against udev 
> 068 and 069. 
> 
>    I've been through the udev utilities, didn't see anything that 
> looked like it was what I neeed.  Is there a handy command that makes 
> sure things are flushed and updated before the next action can take place?
> 
>    I'll cheerfully take a solution, or go back to Google if someone can 
> tell me what sort of search terms would be relevant.

I don't see why a while loop wouldn't work. Please run "udevmonitor" while
yoy run your script and post the output here.
I expect fdisk writes the partitiontanble and triggers a reread with
a ioctl, which will create the hotplug events for the partition devices.
You have to wait for the nodes to appear.

Kay


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 3+ messages in thread

* Re: udev synchronization problems
  2005-09-15  1:50 udev synchronization problems J.C. Wren
  2005-09-15 15:34 ` Kay Sievers
@ 2005-09-19 16:51 ` J.C. Wren
  1 sibling, 0 replies; 3+ messages in thread
From: J.C. Wren @ 2005-09-19 16:51 UTC (permalink / raw)
  To: linux-hotplug

Kay has a solution that worked for me.

>Ah, that ide-cs driver stuff is the horror. It sends events for every
>open()/close(), which is insane. The SUSE kernel has patched that out,
>so I always forget about this. You may try if this helps:
>
>   KERNEL="hd[a-z]*", SYSFS{removable}="1", OPTIONS="ignore_remove"
>
>Kay

I put this in /etc/udev/rules.d/10-local.rules, and problem solved.

Thanks, Kay!

    --jc

J.C. Wren wrote:

>    Forgive me if this has been addressed before.  I did some googling 
> for answers, but either there are none, or more likely, I am not using 
> the correct search terms for useful results.
>
>    I have a script to create compact flash cards for an application.  
> It worked well until I switched from devfs to udev.
>
>    The script is pretty basic.  sfdisk, mke2fs, tune2fs, mount, cp, 
> umount.  I run into errors where sfdisk completes, then mke2fs 
> complains that /dev/hde1 (hde is the PCMCIA CF card) doesn't exist.  
> Or sometimes it gets past that, and tune2fs complains /dev/hde1 
> doesn't exist.
>
>    As near as I can tell, it's because udevd doesn't react fast enough 
> (from my scripts perspective) and present /dev/hde1 once it's been 
> created.  So I tried a few things.  I put a loop in the script waiting 
> for /dev/hde1 to become present.  Didn't fix it.  Added some 'sleep 1' 
> commands.  Didn't fix it.  Tried a while loop that waited for 
> /dev/hde1 to become present in /proc/partitions.  Didn't fix it.  
> However, running these commands by hand almost always succeed.
>
>    Is there some reliable way to determine that /dev/hde1 is *really* 
> there, and ready for action?
>    I've tried 2.6.12-gentoo-r10, 2.6.13 (vanilla), both against udev 
> 068 and 069.
>    I've been through the udev utilities, didn't see anything that 
> looked like it was what I neeed.  Is there a handy command that makes 
> sure things are flushed and updated before the next action can take 
> place?
>
>    I'll cheerfully take a solution, or go back to Google if someone 
> can tell me what sort of search terms would be relevant.
>
>    Thanks,
>       --jc
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. 
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> 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



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2005-09-19 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-15  1:50 udev synchronization problems J.C. Wren
2005-09-15 15:34 ` Kay Sievers
2005-09-19 16:51 ` J.C. Wren

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