4

udev is responsible for populating /dev. It adds and removes device nodes to /dev dynamically based on rules/configs/scripts under /lib/udev and /etc/udev/.

If I have a CDROM device node /dev/sr0 I can add a symlink /dev/cdrom by adding a rule like:

SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="cdrom", GROUP="cdrom"

I understand how symlinks are created in udev. But who (or "which rule") created /dev/sr0 (or another non symlink device node) in the first place?

1 Answer 1

4

The default device, based on the kernel name (sr0 in this case) is always created automatically as a real device file, so no rule is needed for that.

Additional synonyms are then created by writing rules which specify symlinks to be added which point at the real file.

4
  • 1
    Thanks, that helped! Googling for "default device node" brought up this link: Dynamic Kernel Device Management with udev. In 12.6 it says "If no matching rule is found, the default device node name is used to create the device node." (Unfortunately I cant vote up since I dont have 15 reputation.)
    – 0x80
    Nov 28, 2012 at 14:02
  • You realize that you can add symlinks at any time, not just in udev configuration file.
    – mdpc
    Nov 28, 2012 at 19:24
  • Well of course - the point of doing it as a udev rule is that it will persist when you reboot, or when you unplug the device and then plug it back in again.
    – TomH
    Nov 28, 2012 at 21:01
  • 1
    Adding any symbolic links via ln -s will be removed after reboot. But you can add static devices by adding them to /lib/udev/devices without creating a rule.
    – 0x80
    Nov 30, 2012 at 11:59

You must log in to answer this question.

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