12
Dynamic Kernel Device
Management with udev
The kernel can add or remove almost any device in a running system. Changes in the
device state (whether a device is plugged in or removed) need to be propagated to
userspace. Devices need to be congured as soon as they are plugged in and recognized.
Users of a certain device need to be informed about any changes in this device's recog-
nized state. udev provides the needed infrastructure to dynamically maintain the device
node les and symbolic links in the /dev directory. udev rules provide a way to plug
external tools into the kernel device event processing. This enables you to customize
udev device handling by, for example, adding certain scripts to execute as part of
kernel device handling, or request and import additional data to evaluate during device
handling.
12.1 The /dev Directory
The device nodes in the /dev directory provide access to the corresponding kernel
devices. With udev, the /dev directory reects the current state of the kernel. Every
kernel device has one corresponding device le. If a device is disconnected from the
system, the device node is removed.
The content of the /dev directory is kept on a temporary le system and all les are
rendered at every system start-up. Manually created or modied les do not, by design,
survive a reboot. Static les and directories that should always be present in the /dev
directory regardless of the state of the corresponding kernel device can be placed in the
/lib/udev/devices directory. At system start-up, the contents of that directory
Dynamic Kernel Device Management with udev 207