Is it just for convenience or is there some reason for it?

cat /etc/udev/conf.d/rules.d/98-kexec.rules
  • 7
    They are executed in lexical order: the earlier numbers have precedence....
    – jasonwryan
    May 22, 2015 at 3:41
  • @jasonwryan no, the rules with later numbers may override the other ones.
    – jarno
    Nov 2, 2021 at 17:25

1 Answer 1


You could read why directly from the manual.

man udev


The udev rules are read from the files located in the system rules directory /usr/lib/udev/rules.d, the volatile runtime directory /run/udev/rules.d and the local administration directory /etc/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical file names replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same name in /lib. This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely.

  • 1
    If you want to create a custom udev rule, are there some guidelines for choosing the number prefix?
    – jarno
    Nov 2, 2021 at 17:08
  • 2
    Oh, there are some guidelines.
    – jarno
    Nov 2, 2021 at 17:27
  • @jarno Good you find one. They are ordered and they may depend on each other. Best to put it just higher then the rules file you want to customize or make addition to. and same number & same name if you want full override. Also if your rules are just action that don't affect driver and system decision, put them in the end as every node meta will be stable at that level.
    – user.dz
    Nov 2, 2021 at 17:34
  • Yes, I just found out that my custom USB wakeup rule had an effect only, if the number is 50 or higher; I suppose it is due to /usr/lib/udev/rules.d/50-udev-default.rules
    – jarno
    Nov 2, 2021 at 17:51
  • 1
    @jarno You may use udevadm test ... to verify which rules are loaded for that device and action applied on it.
    – user.dz
    Nov 2, 2021 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .