udev synchronization problems
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 26 lines · J.C. Wren
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/hde1doesn't exist.As near as I can tell, it's because udevd doesn't react fast enough
(from my scripts perspective) and present/dev/hde1once it's been created. So I tried a few things. I put a loop in the script waiting for/dev/hde1to become present. Didn't fix it. Added some 'sleep 1' commands. Didn't fix it. Tried a while loop that waited for/dev/hde1to 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/hde1is *really*
there, and ready for action?I've tried 2.6.12-gentoo-r10, 2.6.13 (vanilla), both against udev
068 and 069.
Quoted 6 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Kay has a solution that worked for me.
Quoted 7 lines
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
Quoted 38 lines · J.C. Wren
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/hde1doesn't exist.As near as I can tell, it's because udevd doesn't react fast enough
(from my scripts perspective) and present/dev/hde1once it's been created. So I tried a few things. I put a loop in the script waiting for/dev/hde1to become present. Didn't fix it. Added some 'sleep 1' commands. Didn't fix it. Tried a while loop that waited for/dev/hde1to 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/hde1is *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
Quoted 10 lines
-------------------------------------------------------
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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel