Linux

Where Are udev Rules Stored on Linux?

Custom udev rules belong in /etc/udev/rules.d. How system, runtime, and local dirs override each other.

Last updated

udev reads rules from four directories at once. Package shipped rules live in /usr/lib/udev/rules.d (or /lib on older distros). Your custom rules belong in /etc/udev/rules.d. Volatile rules go in /run/udev/rules.d.

All files sort together lexicographically no matter the directory. Same filename in /etc shadows the /usr/lib twin, which is how you override a packaged rule. A symlink to /dev/null with the same name disables one entirely. Files must end in .rules; anything else is ignored silently.

Where udev stores this, by platform

Linux
/etc/udev/rules.d

Your custom .rules files go here with highest priority. Reload with udevadm control --reload-rules plus trigger. Never edit /usr/lib originals; shadow them with same name files here instead.

Frequently asked questions

where do i put a custom udev rule

In /etc/udev/rules.d with a .rules suffix, e.g. 99-my-device.rules. That directory beats /usr/lib and /run twins of the same name. Reload rules and replug the device to test.

why is my udev rule ignored

Usual suspects: wrong extension, lexicographic order losing to a later file, or a same name file in /etc shadowing yours unexpectedly. Check with udevadm test on the device node to see which files actually apply.

Notice an outdated path? Let us know.