/sbin vs /usr/sbin when called from udev rules
by henca from LinuxQuestions.org on (#6N3FN)
I am aware that some distributions out there are moving things from /*bin to /usr/*bin, but fortunately Slackware is still having everything needed to mount partitions in /*bin rather than /usr/*bin as /usr might be on a separate partition needed to be mounted.
I might be old school, but I really prefer to have a rather big separate /usr partition and a smaller partition for /.
However, recently I found out the hard way that having binaries called by some udev rules below /usr might be a bad idea.
I had created a custom package for a third party software for a HASP license USB dongle. This package had an udev rule which called a binary /usr/sbin/aksusbd when the USB dongle was inserted. To my surprise the license server allways failed after reboot, to fix it the USB dongle had to be removed and reinserted.
It turned out that the udev rule was run before my /usr partition had been mounted and would fail as it was unable to find the /usr/sbin dirctory.
I rebuilt the custom package, moved the binary to /sbin/aksusbd and rewrote the udev rule. Much to my surprise the problem persisted. It turned out that the custom udev rule would not run because another udev rule had failed.
The rule /lib/udev/rules.d/60-openobex.rules failed for the same reason when trying to run
/usr/sbin/obex-check-device for any USB device.
I have never cared for any obex USB devices, but those would obviously be broken if plugged in at boot. Also other USB devices requiring custom udev rules will be broken if plugged in at boot.
Instead of continuing and attempting to fix all standard udev rules I ended up with a brute force solution: Disabling and reenabling all USB ports at the end of /etc/rc.d/rc.local. That would make the udev rules to run successfully as /usr is mounted when rc.local is run.
regards Henrik
I might be old school, but I really prefer to have a rather big separate /usr partition and a smaller partition for /.
However, recently I found out the hard way that having binaries called by some udev rules below /usr might be a bad idea.
I had created a custom package for a third party software for a HASP license USB dongle. This package had an udev rule which called a binary /usr/sbin/aksusbd when the USB dongle was inserted. To my surprise the license server allways failed after reboot, to fix it the USB dongle had to be removed and reinserted.
It turned out that the udev rule was run before my /usr partition had been mounted and would fail as it was unable to find the /usr/sbin dirctory.
I rebuilt the custom package, moved the binary to /sbin/aksusbd and rewrote the udev rule. Much to my surprise the problem persisted. It turned out that the custom udev rule would not run because another udev rule had failed.
The rule /lib/udev/rules.d/60-openobex.rules failed for the same reason when trying to run
/usr/sbin/obex-check-device for any USB device.
I have never cared for any obex USB devices, but those would obviously be broken if plugged in at boot. Also other USB devices requiring custom udev rules will be broken if plugged in at boot.
Instead of continuing and attempting to fix all standard udev rules I ended up with a brute force solution: Disabling and reenabling all USB ports at the end of /etc/rc.d/rc.local. That would make the udev rules to run successfully as /usr is mounted when rc.local is run.
regards Henrik