Table of Contents
The hotplug system controls the initialization of most devices in a
computer. It is not only used for devices that can be inserted and
removed during operation, but for all devices that are detected
while the system is booting. It works closely together with the
sysfs file system and udev,
which are described in Chapter 19, Dynamic Device Nodes with udev.
Until the kernel has been booted, only devices that are absolutely necessary, like the bus system, boot disks, and keyboard, are initialized. The kernel triggers hotplug events for all devices that were detected. The udevd daemon listens to these events and calls the respective hotplug scripts to initialize these devices. For devices that cannot be detected automatically or whose events were lost during early boot time, there is coldplug. It replays recorded events or scans the system for uninitialized devices and uses static configurations for old devices like ISA.
Apart from a few historic exceptions, most devices are initialized immediately as soon as they are accessible, either during system boot or when devices are hot plugged. During initialization, interfaces are registered with the kernel. This registration triggers further hotplug events that cause an automatic configuration of the respective interface.
In former versions of SUSE LINUX, a static set of configuration data was used as the basis for initializing devices. Now, the system looks at each available device and searches for suitable configuration data or generates it.
The most important hotplug functions are configured in two files. The first
/etc/sysconfig/hotplug, contains variables
that influence the behavior of hotplug and
coldplug. All variables are commented. The
/proc/sys/kernel/hotplug, contains the name
of the executable program called by the kernel. Device configurations
are located in
/etc/sysconfig/hardware. Starting with
SUSE LINUX 9.3, this
file is usually empty because udevd receives
hotplug messages via a netlink socket.
The hotplug system not only administers devices, but also interfaces. A device is linked to either a bus or an interface. A bus can be regarded as a multiple interface. An interface links devices to each other or to an application. There are also virtual devices, such as network tunnels. Devices usually require drivers in the form of kernel modules. Interfaces are mostly represented by device nodes created by udev. The distinction of devices and interfaces is important for understanding the overall concept.
Devices entered in the
sysfs file system are found
/sys/devices. Interfaces are located under
sysfs should have a link to their
devices. However, there are still some drivers that do
not automatically add this link. Without that link, it is unknown to which
device this interface belongs and a suitable configuration cannot
Devices are addressed by means of a device description. This
may be the device path in
a description of the connection point
bus-pci-0000:02:00.0), an individual ID
id-32311AE03FB82538), or something
similar. In the past, interfaces were addressed by means of their
names. These names represented a simple numbering of the
existing devices and might have changed when devices were added or removed.
Interfaces can also be addressed by means of a description of the associated device. Usually, the context indicates whether the description refers to the device itself or to its interface. Typical examples of devices, interfaces, and descriptions include:
A device that is connected to the PCI bus
and has a network interface (
bus-pci-0000:02:00.0). The network
interface is used by network services or connected
to a virtual network device, such as a tunnel or VLAN,
which in turn has an interface.
A device (
that makes several physical interfaces available in the form of a bus
with several interfaces (