udev/ubuntu problem solved
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as /proc/bus/usb/.usbfs
and has udev create /dev/bus/usb and bind-mounts that as /proc/bus/usb.
so even though I get events for /proc/bus/usb/NNN/NNN devices and they exist if I manually look, my app doesn't find them. the reason is: udev runs /lib/udev/openct_usb, but creates the device in /dev/bus/usb (and thus on ubuntu /proc/bus/usb) only after my script finishes. while I can add sleeps to avoid races, they don't help because udev will not create the device until my script gives up.
the solution is to add some
( ...
) &
disown %1
exit 0
in my script so the core code runs in the background, where it can wait for the device file to be created by udev and then start the ifdhandler process that will handle it.
also during debugging I noticed: it is not a good idea to start/stop udev using the init script. at first I thought udev wasn't re-reading it rules properly, so I tried that. but the result of restarting udev init script is
this: /proc/bus/usb is no longer a bind mount of /dev/bus/usb. instead it is an independend copy, and it is no longer updated at all. thus new devices show up only in /dev/bus/usb and /proc/bus/usb/.usbfs, but not in /proc/bus/usb/.
Regards, Andreas
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/usb/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.
What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
Quoted 6 lines
so even though I get events for
/proc/bus/usb/NNN/NNNdevices and they exist if I manually look, my app doesn't find them. the reason is: udev runs/lib/udev/openct_usb, but creates the device in/dev/bus/usb(and thus on ubuntu/proc/bus/usb) only after my script finishes. while I can add sleeps to avoid races, they don't help because udev will not create the device until my script gives up.
Are you using PROGRAM? That is for plugging external program into udev to give devices a name or symlink. If you use RUN+=, your program never runs before the node and all symlinks are created.
Quoted 3 lines
also during debugging I noticed: it is not a good idea to start/stop udev using the init script. at first I thought udev wasn't re-reading it rules properly, so I tried that.
Nobody should ever stop udev, You may miss important system events here.
Quoted 2 lines
the result of restarting udev init script is
this:/proc/bus/usbis no longer a bind mount of/dev/bus/usb
Well, systems that do such crap, just ask for trouble like this.
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 3 lines · On Tuesday 10 July 2007 17:39:24 Kay Sievers wrote:
What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
I was worried about that too. I guess they made that change so all applications get the benefit of the ACL's in /dev/bus/usb without changes to the source code (i.e. path adjustment).
Quoted 3 lines
Are you using PROGRAM? That is for plugging external program into udev to give devices a name or symlink. If you use RUN+=, your program never runs before the node and all symlinks are created.
no I'm using RUN+= and I thought this would work the wy you described. testing on ubuntu edgy (which has udev 108-0ubuntu4) shows this is different. when I have my loop inside the script I RUN+= I can increase the timeout to 20 seconds, still it times out as the $DEVICE file is not there. if I have the script start the loop in the background then it find the file after 100 ms (one sleep).
maybe my diagnosis is a bit off: not the device file is created late, but the DEVICE event is processed first, and the other events are in a queue in the meantime till my RUN+= script is finished? and some other event triggers the creation of /dev/bus/usb/NNN/NNN and it is processes after the event with MODALIAS and DEVICE=/proc/bus/usb/NNN/NNN ? that would explain what I'm seing too. is this explanation possible?
Thanks,
Andreas
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Andreas Jellinghaus
Quoted 3 lines · On Tuesday 10 July 2007 17:39:24 Kay Sievers wrote:
What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
I was worried about that too. I guess they made that change so all applications get the benefit of the ACL's in
/dev/bus/usbwithout changes to the source code (i.e. path adjustment).
Libusb takes care of that, it handles /dev/bus/usb by default, and falls back to /proc if it doesn't exist.
Quoted 10 lines
Quoted 3 lines
Are you using PROGRAM? That is for plugging external program into udev to give devices a name or symlink. If you use RUN+=, your program never runs before the node and all symlinks are created.
no I'm using RUN+= and I thought this would work the wy you described. testing on ubuntu edgy (which has udev 108-0ubuntu4) shows this is different. when I have my loop inside the script I RUN+= I can increase the timeout to 20 seconds, still it times out as the $DEVICE file is not there. if I have the script start the loop in the background then it find the file after 100 ms (one sleep).
Oh, you are on a different event, not the one that creates the node. The "usb_device" class devices create the node, but you hook into the usb interface. On older kernel it's a timing problem, without a proper solution. Kernel 2.6.22 will create the device nodes from the parent device of the interface, so in the future this work properly.
Quoted 6 lines
maybe my diagnosis is a bit off: not the device file is created late, but the DEVICE event is processed first, and the other events are in a queue in the meantime till my RUN+= script is finished? and some other event triggers the creation of
/dev/bus/usb/NNN/NNNand it is processes after the event with MODALIAS and DEVICE=/proc/bus/usb/NNN/NNN ? that would explain what I'm seing too. is this explanation possible?
Yeah, the "interface device" and the "node device" are siblings in the kernel device tree and therefore have no defined order and udev can't access the properties from each other. 2.6.22 should solve that problem.
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
so if udev gets several events: are those processed serialized or in parallel?
if serialized (including waiting for any RUN+= job to finish) it would explain the problems I'm seeing.
Thanks.
Regards, Andreas
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/usb/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on /dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that /dev/bus/usb/devices exists).
The whole lot is then bind-mounted to /proc/bus/usb; so an application using /proc/bus/usb sees the same tree as a fixed one.
We would fix the apps, but unfortunately we don't have the source to VMware!
Scott
Signature · 3 lines
Scott James Remnant Ubuntu Development Manager [email protected]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · Andreas Jellinghaus
so if udev gets several events: are those processed serialized or in parallel?
if serialized (including waiting for any RUN+= job to finish) it would explain the problems I'm seeing.
One after the other for the same event, yes. All RUN keys for one device run after all rules are processed and the device node is created.
Multiple events run at the same time, if they don't depend on each other, like a child always waits for the parent to finish.
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 18 lines · Scott James Remnant
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/usb/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on
/dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that/dev/bus/usb/devicesexists).
Quoted 5 lines
The whole lot is then bind-mounted to
/proc/bus/usb; so an application using/proc/bus/usbsees the same tree as a fixed one.We would fix the apps, but unfortunately we don't have the source to VMware!
vmware originally said they would fix their program up to handle this properly. Unfortunatly, they seem to have forgotten this and do not seem to be willing to do this, especially when distros do looney things like this to apease them :)
thanks,
greg k-h
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 22 lines · Greg KH
Quoted 21 lines · Scott James Remnant
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/usb/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on
/dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that/dev/bus/usb/devicesexists).The whole lot is then bind-mounted to
/proc/bus/usb; so an application using/proc/bus/usbsees the same tree as a fixed one.
Quoted 8 lines
Quoted 2 lines
We would fix the apps, but unfortunately we don't have the source to VMware!
vmware originally said they would fix their program up to handle this properly. Unfortunatly, they seem to have forgotten this and do not seem to be willing to do this, especially when distros do looney things like this to apease them :)
VMware appears to work on my laptop here, which is running the development version of Ubuntu (which lacks the /proc/bus/usb hack).
Scott
Signature · 3 lines
Scott James Remnant Ubuntu Development Manager [email protected]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 27 lines · Scott James Remnant
Quoted 25 lines · Greg KH
Quoted 23 lines · Scott James Remnant
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/usb/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on
/dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that/dev/bus/usb/devicesexists).The whole lot is then bind-mounted to
/proc/bus/usb; so an application using/proc/bus/usbsees the same tree as a fixed one.We would fix the apps, but unfortunately we don't have the source to VMware!
Quoted 7 lines
Quoted 5 lines
vmware originally said they would fix their program up to handle this properly. Unfortunatly, they seem to have forgotten this and do not seem to be willing to do this, especially when distros do looney things like this to apease them :)
VMware appears to work on my laptop here, which is running the development version of Ubuntu (which lacks the
/proc/bus/usbhack).
Are you using usb devices within the guest operating systems and Ubuntu as the host os?
thanks,
greg k-h
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 33 lines · Greg KH
Quoted 32 lines · Scott James Remnant
Quoted 30 lines · Greg KH
Quoted 18 lines · Scott James Remnant
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/us/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on
/dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that/dev/bus/usb/devicesexists).Quoted 5 lines
The whole lot is then bind-mounted to
/proc/bus/usb; so an application using/proc/bus/usbsees the same tree as a fixed one.We would fix the apps, but unfortunately we don't have the source to VMware!
vmware originally said they would fix their program up to handle this properly. Unfortunatly, they seem to have forgotten this and do not seem to be willing to do this, especially when distros do looney things like this to apease them :)
Quoted 6 lines
Quoted 2 lines
VMware appears to work on my laptop here, which is running the development version of Ubuntu (which lacks the
/proc/bus/usbhack).Are you using usb devices within the guest operating systems and Ubuntu as the host os?
Yes
Scott
Signature · 3 lines
Scott James Remnant Ubuntu Development Manager [email protected]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 34 lines · Scott James Remnant
Quoted 33 lines · Greg KH
Quoted 32 lines · Scott James Remnant
Quoted 30 lines · Greg KH
Quoted 18 lines · Scott James Remnant
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Andreas Jellinghaus
I finally figured out what is wrong with udev on ubuntu.
ubuntu mounts usbfs as
/proc/bus/us/.usbfs
and has udev create/dev/bus/usband bind-mounts that as/proc/bus/usb.What are theses guys smoking? That's so sick to bind-mount /dev-directories to /proc! I wouldn't support such a system at all. It is totally broken.
It works <g>
What we do is mount the usbfs filesystem on
/dev/bus/usb/.usbfs, and symlink the devices file from that into the parent directory (so that/dev/bus/usb/devicesexists).Quoted 5 lines
The whole lot is then bind-mounted to
/proc/bus/usb; so an application using/proc/bus/usbsees the same tree as a fixed one.We would fix the apps, but unfortunately we don't have the source to VMware!
vmware originally said they would fix their program up to handle this properly. Unfortunatly, they seem to have forgotten this and do not seem to be willing to do this, especially when distros do looney things like this to apease them :)
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
VMware appears to work on my laptop here, which is running the development version of Ubuntu (which lacks the
/proc/bus/usbhack).Are you using usb devices within the guest operating systems and Ubuntu as the host os?
Yes
Great, then you can disable that bind mount from your init scripts and everyone will be happy :)
thanks,
greg k-h
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 3 lines · Greg KH
Great, then you can disable that bind mount from your init scripts and everyone will be happy :)
It's already disabled
Scott
Signature · 3 lines
Scott James Remnant Ubuntu Development Manager [email protected]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel