Alexander E. Patrakov wrote:
Anthony Wright wrote:
When udev tries to create entries in some cases it uses modprobe, and if
this fails it causes an entry to be created in /dev/.udev/failed/

Ignore the issue. It is prsent in all distros. Of course, this is fixable by replacing the current modprobe rule with the following:

ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c '/sbin/modprobe $env{MODALIAS} || true'"

(and similar changes to other rules) but I consider calling /bin/sh a bloat.

The problem with the change you're suggesting is that it will always return true, so no entries will be created in /dev/.udev/failed/, even if an entry should exist because the device doesn't have a driver either in the kernel or a module.

Can I suggest changing the modalias.rules file to replace the first modprobe entry with the entry below, and with similar changes to the SCSI modprobes in the same file. It performs the modprobe as before, but then returns success or failure based on whether, after the modprobe, the device has a driver according to the /sys filesystem. This means it works with drivers built into the kernel as well as with modules.

ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c '/sbin/modprobe $$MODALIAS ; [ -e /sys$$DEVPATH/driver -o -e /sys$$DEVPATH/device/driver ] '"

I appreciate this is somewhat more complex than the original, but the additional complexity is relatively minor and the result is a /dev/.udev/failed/ that is correct. This change removed more than half the entries in my /dev/.udev/failed/.

Please note the replacement of $env(MODALIAS) with $$MODALIAS, this is because the udev program_run buffer is only 255 bytes long, and some of the modalias strings for serio devices are very long causing the buffer to overflow.

Tony Wright.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to