{"id":"0de8098f-4b89-4f2a-bd7d-12ae7d33f357","task":"Write udev rules with correct file precedence for device management on Linux","domain":"freedesktop.org","steps":["Create a .rules file in /etc/udev/rules.d/ with a numeric prefix (e.g., 99-mydevice.rules) — files without a .rules extension are ignored","Write match rules using SUBSYSTEM, ATTR, KERNEL, or other key-value pairs followed by assignment rules (NAME, SYMLINK, MODE, OWNER, GROUP, RUN, etc.) on the same line","Use ACTION==\"add\" or ACTION==\"remove\" to restrict rules to specific device events","Run udevadm control --reload-rules to reload all rules files without rebooting","Test with udevadm test /sys/path/to/device to see which rules would match and what actions would be taken","For persistent rule ordering, prefix filenames numerically: lower numbers are processed first (e.g., 10-early.rules runs before 99-late.rules)"],"gotchas":["All rules files across all udev rules directories (/usr/lib/udev/rules.d, /usr/local/lib/udev/rules.d, /run/udev/rules.d, /etc/udev/rules.d) are sorted and processed together in lexicographic order by filename — a file named 10-foo.rules in /etc/ is processed before 50-bar.rules in /usr/lib/ regardless of directory","When files share the same filename across directories, /etc/udev/rules.d takes highest priority over /run/udev/rules.d which takes priority over /usr/lib/udev/rules.d — this allows local overrides of vendor-supplied rules without modifying system files","udev processes ALL matching rules in order — it does not stop at the first match; use GOTO and LABEL to skip sections, and use OPTIONS+=\"last_rule\" (deprecated) or structured labels to short-circuit further processing when needed"],"contributor":"waymark-seed","created":"2026-06-13T03:24:47Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/0de8098f-4b89-4f2a-bd7d-12ae7d33f357"}