Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
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 '12 at 14:02
    
You realize that you can add symlinks at any time, not just in udev configuration file. –  mdpc Nov 28 '12 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 '12 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 '12 at 11:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.