Udisks
   HOME

TheInfoList



OR:

udev (userspace ) is a device manager for the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
. As the successor of
devfsd devfsd is a device manager for the Linux kernel. Primarily, it creates device nodes in the directory when kernel drivers make the underlying hardware accessible. The nodes exist in a virtual device file system named devfs. In systems that suppo ...
and hotplug, udev primarily manages
device node A device is usually a constructed tool. Device may also refer to: Technology Computing, electronics, mechanisms and telecommunication * Appliance, a device for a particular task * Computer, a computing device * Device file, an interface of a pe ...
s in the directory. At the same time, udev also handles all
user space A modern computer operating system usually uses virtual memory to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides memory protection and hardware prote ...
events raised when hardware devices are added into the system or removed from it, including
firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, h ...
loading as required by certain devices.


Rationale

It is an
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
's
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
that is responsible for providing an abstract interface of the hardware to the rest of the software. Being a
monolithic kernel A monolithic kernel is an operating system software architecture, architecture with the entire operating system running in kernel space. The monolithic model differs from other architectures such as the microkernel in that it alone defines a high ...
, the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
does exactly that:
device driver In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s are part of the Linux kernel, and make up more than half of its source code. Hardware can be accessed through
system call In computing, a system call (syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive ...
s or over their
device node A device is usually a constructed tool. Device may also refer to: Technology Computing, electronics, mechanisms and telecommunication * Appliance, a device for a particular task * Computer, a computing device * Device file, an interface of a pe ...
s. To be able to deal with peripheral devices that are
hotplug Hot swapping is the replacement or addition of components to a computer system without stopping, shutting down, or rebooting the system. Hot plugging describes only the addition of components to a running computer system. Components which ha ...
-capable in a user-friendly way, a part of handling all of these hotplug-capable hardware devices was handed over from the kernel to a
daemon A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore. Demon, daemon or dæmon may also refer to: Entertainment Fictional entities * Daemon (G.I. Joe), a character ...
running in user-space. Running in user space serves security and stability purposes.


Design

Device driver In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s are part of the Linux kernel, in which their primary functions include device discovery, detecting device state changes, and similar low-level hardware functions. After loading a device driver into memory from the kernel, detected events are sent out to the userspace daemon udevd. It is the device manager, , that catches all of these events and then decides what shall happen next. For this, has a very comprehensive set of configuration files, which can all be adjusted by the computer administrator, according to their needs. * In case a new storage device is connected over USB, is notified by the kernel and itself notifies the udisksd-daemon. That daemon could then mount the file systems. * In case a new Ethernet cable is plugged into the Ethernet NIC, is notified by the kernel and itself notifies the NetworkManager-daemon. The NetworkManager-daemon could start dhclient for that NIC, or configure according to some manual configuration. The complexity of doing so forced application authors to re-implement hardware support logic. Some hardware devices also required privileged helper programs to prepare them for use. These often have to be invoked in ways that could be awkward to express with the Unix permissions model (for example, allowing users to join
wireless network A wireless network is a computer network that uses wireless data connections between network nodes. Wireless networking allows homes, telecommunications networks, and business installations to avoid the costly process of introducing cables int ...
s only if they are logged into the video console). Application authors resorted to using
setuid The Unix and Linux access rights flags setuid and setgid (short for ''set user identity'' and ''set group identity'') allow users to run an executable with the file system permissions of the executable's owner or group respectively and to chang ...
binaries or run service daemons to provide their own access control and privilege separation, potentially introducing security holes each time.
HAL HAL may refer to: Aviation * Halali Airport (IATA airport code: HAL) Halali, Oshikoto, Namibia * Hawaiian Airlines (ICAO airline code: HAL) * HAL Airport, Bengaluru, India * Hindustan Aeronautics Limited an Indian aerospace manufacturer of fight ...
was created to deal with these challenges, but is now deprecated in most Linux distributions, its functionality being replaced by udevd.


Overview

Unlike traditional
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
systems, where the
device node A device is usually a constructed tool. Device may also refer to: Technology Computing, electronics, mechanisms and telecommunication * Appliance, a device for a particular task * Computer, a computing device * Device file, an interface of a pe ...
s in the directory have been a static set of files, the Linux udev device manager dynamically provides only the nodes for the devices actually present on a system. Although
devfs In Unix-like operating systems, a device file, device node, or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These spec ...
used to provide similar functionality,
Greg Kroah-Hartman Greg Kroah-Hartman is a major Linux kernel developer. , he is the Linux kernel maintainer for the branch, the staging subsystem, USB, driver core, debugfs, kref, kobject, and the sysfs kernel subsystems, Userspace I/O (with Hans J. Koch), ...
cited a number of reasons for preferring udev over devfs: * udev supports persistent device naming, which does not depend on, for example, the order in which the devices are plugged into the system. The default udev setup provides persistent names for storage devices. Any hard disk is recognized by its unique filesystem id, the name of the disk and the physical location on the hardware it is connected to. * udev executes entirely in
user space A modern computer operating system usually uses virtual memory to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides memory protection and hardware prote ...
, as opposed to devfs's
kernel space A modern computer operating system usually uses virtual memory to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides memory protection and hardware prote ...
. One consequence is that udev moved the naming policy out of the kernel and can run arbitrary programs to compose a name for the device from the device's properties, before the node is created; there, the whole process is also interruptible and it runs with a lower priority. The udev, as a whole, is divided into three parts: *
Library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
''libudev'' that allows access to device information; it was incorporated into the
systemd systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
183 software bundle. * User space
daemon A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore. Demon, daemon or dæmon may also refer to: Entertainment Fictional entities * Daemon (G.I. Joe), a character ...
that manages the virtual . * Administrative
command-line utility A console application or command-line program is a computer program (applications or utilities) designed to be used via a text-only user interface. A console application can be used with a computer terminal, a system console, or a terminal emu ...
for diagnostics. The system gets calls from the kernel via
netlink Netlink is a socket family used for inter-process communication (IPC) between both the kernel and userspace processes, and between different userspace processes, in a way similar to the Unix domain sockets available on certain Unix-like operat ...
socket. Earlier versions used
hotplug Hot swapping is the replacement or addition of components to a computer system without stopping, shutting down, or rebooting the system. Hot plugging describes only the addition of components to a running computer system. Components which ha ...
, adding a link to themselves in with this purpose.


Operation

udev is a generic device manager running as a
daemon A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore. Demon, daemon or dæmon may also refer to: Entertainment Fictional entities * Daemon (G.I. Joe), a character ...
on a Linux system and listening (via a
netlink Netlink is a socket family used for inter-process communication (IPC) between both the kernel and userspace processes, and between different userspace processes, in a way similar to the Unix domain sockets available on certain Unix-like operat ...
socket) to uevents the kernel sends out if a new device is initialized or a device is removed from the system. The udev package comes with an extensive set of rules that match against exported values of the event and properties of the discovered device. A matching rule will possibly name and create a device node and run configured programs to set up and configure the device. udev rules can match on properties like the kernel subsystem, the kernel device name, the physical location of the device, or properties like the device's serial number. Rules can also request information from external programs to name a device or specify a custom name that will always be the same, regardless of the order devices are discovered by the system. In the past a common way to use udev on Linux systems was to let it send events through a socket to
HAL HAL may refer to: Aviation * Halali Airport (IATA airport code: HAL) Halali, Oshikoto, Namibia * Hawaiian Airlines (ICAO airline code: HAL) * HAL Airport, Bengaluru, India * Hindustan Aeronautics Limited an Indian aerospace manufacturer of fight ...
, which would perform further device-specific actions. For example, HAL would notify other software running on the system that the new hardware had arrived by issuing a broadcast message on the
D-Bus D-Bus (short for "Desktop Bus") is a message-oriented middleware mechanism that allows communication between multiple Process (computing), processes running concurrently on the same machine. D-Bus was developed as part of the freedesktop.org pro ...
IPC IPC may refer to: Businesses and organizations Arts and media * Intellectual Property Committee, a coalition of US corporations with intellectual property interests * International Panorama Council, an international network of specialists in ...
system to all interested processes. In this way, desktops such as
GNOME A gnome () is a mythological creature and diminutive spirit in Renaissance magic and alchemy, introduced by Paracelsus in the 16th century and widely adopted by authors, including those of modern fantasy literature. They are typically depict ...
or
K Desktop Environment 3 K Desktop Environment 3 (KDE 3) is the third series of releases of the K Desktop Environment (after that called ''KDE Software Compilation''). It was one of the two major desktop environments for GNU/Linux systems between 2002 and 2008. There ar ...
could start the
file browser A file manager or file browser is a computer program that provides a user interface to manage files and folders. The most common operations performed on files or groups of files include creating, opening (e.g. viewing, playing, editing or p ...
to browse the file systems of newly attached
USB flash drive A flash drive (also thumb drive, memory stick, and pen drive/pendrive) is a data storage device that includes flash memory with an integrated USB interface. A typical USB drive is removable, rewritable, and smaller than an optical disc, and u ...
s and SD cards. By the middle of 2011 HAL had been deprecated by most Linux distributions as well as by the KDE, GNOME and
Xfce Xfce or XFCE (pronounced as four individual letters, ) is a Free and open-source software, free and open-source desktop environment for Linux and other Unix-like operating systems. Xfce aims to be fast and Lightweight software, lightweight whil ...
desktop environments, among others. The functionality previously embodied in HAL has been integrated into udev itself, or moved to separate software such as udisks and upower. * udev provides low-level access to the linux device tree. Allows programs to enumerate devices and their properties and get notifications when devices come and go. * dbus is a framework to allow programs to communicate with each other, securely, reliably, and with a high-level object-oriented programming interface. * udisks (formerly known as DeviceKit-disks) is a daemon that sits on top of libudev and other kernel interfaces and provides a high-level interface to storage devices and is accessible via dbus to applications. * upower (formerly known as DeviceKit-power) is a daemon that sits on top of libudev and other kernel interfaces and provides a high-level interface to power management and is accessible via dbus to applications. *
NetworkManager NetworkManager is a daemon that sits on top of libudev and other Linux kernel interfaces (and a couple of other daemons) and provides a high-level interface for the configuration of the network interfaces. Rationale NetworkManager is a software ...
is a daemon that sits on top of libudev and other kernel interfaces (and a couple of other daemons) and provides a high-level interface to network configuration and setup and is accessible via dbus to apps. udev receives messages from the kernel, and passes them on to subsystem daemons such as Network Manager. Applications talk to Network Manager over D-Bus. :Kernel -> udev -> Network Manager <=> D-Bus <=> Firefox HAL is obsolete and only used by legacy code. Ubuntu 10.04 shipped without HAL. Initially a new daemon DeviceKit was planned to replace certain aspects of HAL, but in March 2009, DeviceKit was deprecated in favor of adding the same code to udev as a package: udev-extras, and some functions have now moved to udev proper.


History

udev was introduced in Linux 2.5. The Linux kernel version 2.6.13 introduced or updated a new version of the uevent interface. A system using a new version of udev will not boot with kernels older than 2.6.13 unless udev is disabled and a traditional directory is used for device access. In April 2012, udev's
codebase In software development, a codebase (or code base) is a collection of source code used to build a particular software system, application, or software component. Typically, a codebase includes only human-written source code system files; thu ...
was merged into the
systemd systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
source tree, making systemd 183 the first version to include udev. In October 2012,
Linus Torvalds Linus Benedict Torvalds ( , ; born 28 December 1969) is a Finnish software engineer who is the creator and lead developer of the Linux kernel. He also created the distributed version control system Git. He was honored, along with Shinya Yam ...
criticized
Kay Sievers Kay Sievers is a German computer programmer, best known for developing the udev device manager of Linux, systemd and the Gummiboot EFI bootloader. Kay Sievers made major contributions to Linux's hardware hotplug and device management subsystems ...
's approach to udev maintenance and bug fixing related to
firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, h ...
loading, stating: In 2012, the
Gentoo Linux Gentoo Linux (pronounced ) is a Linux distribution built using the Portage package management system. Unlike a binary software distribution, the source code is compiled locally according to the user's preferences and is often optimized for ...
project created a
fork In cutlery or kitchenware, a fork (from 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tines with which one can spear foods either to h ...
of systemd's udev codebase in order to avoid dependency on the systemd architecture. The resulting fork is called ''
eudev systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
'' and it makes udev functionality available without systemd. A stated goal of the project is to keep eudev independent of any
Linux distribution A Linux distribution, often abbreviated as distro, is an operating system that includes the Linux kernel for its kernel functionality. Although the name does not imply product distribution per se, a distro—if distributed on its own—is oft ...
or
init In Unix-based computer operating systems, init (short for ''initialization'') is the first process started during booting of the operating system. Init is a daemon process that continues running until the system is shut down. It is the direc ...
system. The Gentoo project describes eudev as follows: On May 29, 2014, support for firmware loading through udev was dropped from systemd, as it has been decided that it is the kernel's task to load firmware. Two days later,
Lennart Poettering Lennart Poettering (born 15 October 1980) is a German software engineer working for Microsoft and the original author of PulseAudio, Avahi and systemd. Life and career Poettering was born in Guatemala City but grew up in Rio de Janeiro, B ...
suggested this patch be postponed until
kdbus D-Bus (short for "Desktop Bus") is a message-oriented middleware mechanism that allows communication between multiple processes running concurrently on the same machine. D-Bus was developed as part of the freedesktop.org project, initiated by G ...
starts to be utilized by udev; at that point, the plan was to switch udev to use kdbus as the underlying messaging system, and to get rid of the userspace-to-userspace netlink-based transport.


Authors

udev was developed by
Greg Kroah-Hartman Greg Kroah-Hartman is a major Linux kernel developer. , he is the Linux kernel maintainer for the branch, the staging subsystem, USB, driver core, debugfs, kref, kobject, and the sysfs kernel subsystems, Userspace I/O (with Hans J. Koch), ...
and
Kay Sievers Kay Sievers is a German computer programmer, best known for developing the udev device manager of Linux, systemd and the Gummiboot EFI bootloader. Kay Sievers made major contributions to Linux's hardware hotplug and device management subsystems ...
, with much help from Dan Stekloff, among others.


References


External links

* {{Linux kernel Computer configuration Interfaces of the Linux kernel Linux file system-related software Linux kernel features Unix file system-related software