Write udev rules with correct file precedence for device management on Linux

domain: freedesktop.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. 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
  2. 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
  3. Use ACTION=="add" or ACTION=="remove" to restrict rules to specific device events
  4. Run udevadm control --reload-rules to reload all rules files without rebooting
  5. Test with udevadm test /sys/path/to/device to see which rules would match and what actions would be taken
  6. For persistent rule ordering, prefix filenames numerically: lower numbers are processed first (e.g., 10-early.rules runs before 99-late.rules)

Known gotchas

Related routes

Write udev rules on Linux to assign a persistent device name or run a script when a USB device is connected
freedesktop.org · 5 steps · unrated
Write a udev rule that runs a custom script automatically when a specific device is plugged in on Linux
man7.org · 5 steps · unrated
write and debug udev rules by simulating device events with udevadm test before relying on real hardware hotplug
freedesktop.org · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans