2010-01-25 13:10:10 +03:00
udev - Linux userspace device management
2005-10-03 18:28:11 +04:00
2010-01-25 13:10:10 +03:00
Integrating udev in the system has complex dependencies and may differ from
distribution to distribution. A system may not be able to boot up or work
reliably without a properly installed udev version. The upstream udev project
2011-04-08 19:54:04 +04:00
does not recommend replacing a distro's udev installation with the upstream
2010-01-25 13:10:10 +03:00
version.
The upstream udev project's set of default rules may require a most recent
2011-05-05 20:58:58 +04:00
kernel release to work properly. This is currently version 2.6.32.
2005-10-03 18:28:11 +04:00
2009-06-17 20:04:05 +04:00
Tools and rules shipped by udev are not public API and may change at any time.
2011-04-08 19:55:18 +04:00
Never call any private tool in /lib/udev from any external application; it might
2009-06-17 20:04:05 +04:00
just go away in the next release. Access to udev information is only offered
2011-04-08 19:56:16 +04:00
by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of
the /dev/.udev directory are private to udev and do change whenever needed.
2005-10-03 18:28:11 +04:00
2005-11-16 07:22:31 +03:00
Requirements:
2011-05-05 20:58:58 +04:00
- Version 2.6.32 of the Linux kernel with sysfs, procfs, signalfd, inotify,
unix domain sockets, networking and hotplug enabled
2011-05-05 21:47:12 +04:00
- Some architectures might need a later kernel, that supports accept4(),
or need to backport the accept4() syscall wiring in the kernel.
2011-05-05 20:58:58 +04:00
- These options are needed:
2009-06-11 19:58:14 +04:00
CONFIG_HOTPLUG=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_NET=y
CONFIG_UNIX=y
CONFIG_SYSFS=y
CONFIG_SYSFS_DEPRECATED*=n
CONFIG_PROC_FS=y
2009-09-08 16:57:42 +04:00
CONFIG_INOTIFY_USER=y
2009-06-11 19:59:46 +04:00
CONFIG_SIGNALFD=y
2011-05-05 20:58:58 +04:00
- These options might be needed:
CONFIG_TMPFS=y
2009-07-07 11:48:23 +04:00
CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes)
2009-08-31 12:19:40 +04:00
CONFIG_BLK_DEV_BSG=y (SCSI devices)
2005-10-03 18:28:11 +04:00
2011-04-08 19:59:01 +04:00
- Udev does not work with the CONFIG_SYSFS_DEPRECATED* option.
2009-06-04 03:44:04 +04:00
2009-08-31 12:19:40 +04:00
- Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work,
but it is not supported.
2005-10-03 18:28:11 +04:00
2010-01-25 13:10:10 +03:00
- The deprecated hotplug helper /sbin/hotplug should be disabled in the
kernel configuration, it is not needed today, and may render the system
unusable because the kernel may create too many processes in parallel
so that the system runs out-of-memory.
2011-04-08 20:00:01 +04:00
- The proc filesystem must be mounted on /proc, and the sysfs filesystem must
2010-01-25 13:10:10 +03:00
be mounted at /sys. No other locations are supported by a standard
udev installation.
2005-10-03 18:28:11 +04:00
2011-05-05 20:58:58 +04:00
- The default rule sset requires the following group names resolvable at udev startup:
2011-04-08 20:00:01 +04:00
disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, and kmem.
2011-04-08 20:01:18 +04:00
Especially in LDAP setups, it is required that getgrnam() be able to resolve
these group names with only the rootfs mounted and while no network is
2009-01-04 19:38:33 +03:00
available.
2005-11-16 07:22:31 +03:00
2011-04-29 16:27:11 +04:00
- Some udev extras have external dependencies like:
2011-04-08 20:04:38 +04:00
libacl, libglib2, libusb, usbutils, pciutils, and gperf.
2011-04-29 16:27:11 +04:00
All these extras can be disabled with configure options.
2005-10-03 18:28:11 +04:00
2010-01-25 13:10:10 +03:00
Setup:
- At bootup, the /dev directory should get the 'devtmpfs' filesystem
2011-04-08 19:59:01 +04:00
mounted. Udev manages the permissions and ownership of the kernel-created
device nodes, and udev possibly creates additional symlinks. If needed, udev also
2010-01-25 13:10:10 +03:00
works on an empty 'tmpfs' filesystem, but some static device nodes like
/dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself.
2005-11-16 07:22:31 +03:00
2010-01-25 13:10:10 +03:00
- The udev daemon should be started to handle device events sent by the kernel.
During bootup, the kernel can be asked to send events for all already existing
2011-04-08 20:14:48 +04:00
devices so that they too can be configured by udev. This is usually done by:
2010-01-25 13:10:10 +03:00
/sbin/udevadm trigger --type=subsystems
/sbin/udevadm trigger --type=devices
2011-04-08 20:15:39 +04:00
- Restarting the daemon never applies any rules to existing devices.
2005-10-03 18:28:11 +04:00
2011-04-08 19:55:18 +04:00
- New/changed rule files are picked up automatically; there is no daemon
2010-01-25 13:10:10 +03:00
restart or signal needed.
Operation:
2011-04-08 20:18:32 +04:00
- Based on events the kernel sends out on device creation/removal, udev
creates/removes device nodes in the /dev directory.
2010-01-25 13:10:10 +03:00
- All kernel events are matched against a set of specified rules, which
possibly hook into the event processing and load required kernel
2011-04-08 20:20:18 +04:00
modules to set up devices. For all devices, the kernel exports a major/minor
2011-04-08 19:59:01 +04:00
number; if needed, udev creates a device node with the default kernel
2010-01-25 13:10:10 +03:00
name. If specified, udev applies permissions/ownership to the device
node, creates additional symlinks pointing to the node, and executes
programs to handle the device.
- The events udev handles, and the information udev merges into its device
database, can be accessed with libudev:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/
http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/
2011-04-29 16:27:11 +04:00
For more details about udev and udev rules, see the udev man pages:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/
2005-10-03 18:28:11 +04:00
2009-08-31 12:19:40 +04:00
Please direct any comment/question to the linux-hotplug mailing list at:
2007-12-27 06:17:46 +03:00
linux-hotplug@vger.kernel.org