What is udev in linux
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 1, 2026
Key Facts
- Replaces the older static devfs system with dynamic device management
- Runs as a daemon (udevd) that responds to kernel uevent messages
- Uses configuration files in /etc/udev/rules.d/ to define device naming and permissions
- Integrated into systemd in modern Linux distributions as part of systemd-udevd
- Manages character devices, block devices, and USB devices automatically
Understanding udev in Linux
udev (userspace /dev) is a critical Linux system daemon that manages the /dev directory dynamically. Rather than maintaining static device files, udev listens for kernel events when hardware is plugged in or removed, creating appropriate device nodes on-the-fly. This approach provides flexibility, scalability, and efficient resource usage compared to older static device management systems.
How udev Works
The Linux kernel detects hardware changes and sends uevent messages (formerly netlink messages) to userspace. The udev daemon intercepts these events and processes them according to matching rules. Rules can specify device naming conventions, ownership, permissions, and trigger custom scripts. When a device is removed, udev automatically deletes the corresponding /dev node.
udev Rules and Configuration
Rules files located in /etc/udev/rules.d/ define how devices are handled. Each rule can match on device attributes like vendor ID, product ID, or device path. Matched rules can rename devices, set ownership and permissions, create symlinks, or execute custom commands. Rules are processed in lexical order, allowing fine-grained control over device management. Example rule: SUBSYSTEM=="usb", ATTR{idVendor}=="1234", NAME="mydevice"
Device Management Tasks
udev handles numerous device-related tasks:
- Device Naming: Apply consistent naming schemes to devices instead of kernel defaults
- Permission Management: Set ownership and access permissions for device nodes
- Hotplug Events: Automatically mount storage devices, start services, or run scripts
- Symlinks: Create user-friendly symbolic links to device nodes
- Device Blacklisting: Prevent certain devices from being loaded or accessed
udev Integration with systemd
Modern Linux distributions integrate udev directly into systemd as systemd-udevd. This integration streamlines system boot and device initialization. systemd's udev implementation is more efficient and feature-rich than standalone udev. Many distributions no longer maintain separate udev packages, instead relying on systemd's version.
Common udev Commands and Debugging
udevadm info: Displays detailed information about a device. udevadm monitor: Watches for kernel and udev events in real-time. udevctl reload-rules: Reloads rule files without restarting. udevadm test: Simulates device event processing without applying changes. These tools help diagnose device recognition and naming issues.
Practical Applications
System administrators use udev rules to persist network interface names across reboots, automatically format and mount USB drives, configure keyboard and mouse settings, manage serial device naming, and trigger custom scripts on specific hardware events. Embedded Linux systems often rely heavily on udev customization.
Related Questions
How do I write custom udev rules?
Create a rule file in /etc/udev/rules.d/ with a .rules extension. Rules contain match criteria (SUBSYSTEM, ATTR, KERNEL) and actions (NAME, OWNER, MODE). Use udevadm info to identify device attributes, then test rules with udevadm test before deploying.
How do I list all devices managed by udev?
Use 'ls -la /dev' to see device files, or 'lsblk' for block devices, 'lsusb' for USB devices. The command 'udevadm info --query=all --path=/sys/class/device/path' shows detailed information about specific devices.
What is the difference between udev and devfs?
devfs was a kernel-based static device filesystem that was difficult to manage and maintain. udev is userspace-based and dynamic, offering greater flexibility, better hotplug support, and easier customization through rule files.
More What Is in Daily Life
Also in Daily Life
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Wikipedia - udevCC-BY-SA-4.0
- Linux man-pages - udevGPL-2.0
Missing an answer?
Suggest a question and we'll generate an answer for it.