Chapter 12. Dynamic Kernel Device Management with udev

Contents

12.1. The /dev Directory
12.2. Kernel uevents and udev
12.3. Drivers, Kernel Modules, and Devices
12.4. Booting and Initial Device Setup
12.5. Debugging udev Events
12.6. Influencing Kernel Device Event Handling with udev Rules
12.7. Persistent Device Naming
12.8. The Replaced hotplug Package
12.9. For More Information

Since version 2.6, the kernel is capable of adding or removing almost any device in the running system. Changes in device state (whether a device is plugged in or removed) need to be propagated to userspace. Devices need to be configured as soon as they are plugged in and discovered. Users of a certain device need to be informed about any state changes of this device. udev provides the needed infrastructure to dynamically maintain the device node files 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, for example, by 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 reflects the current state of the kernel. Every kernel device has one corresponding device file. If a device is disconnected from the system, the device node is removed.

The content of the /dev directory is kept on a temporary file system and all files are created from scratch at every system start-up. Manually created or changed files intentionally do not survive a reboot. Static files 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 is copied to the /dev directory with the same ownership and permissions as the files in /lib/udev/devices.