18.3. Hotplug Agents

A hotplug agent is an executable program that performs suitable actions for an event. The agents for device events are located in /etc/hotplug and are designated as <event name>.agent. For interface events, all programs in /etc/dev.d are executed by udev. More information on udev can be found in 19. Dynamic Device Nodes with udev.

Usually, device agents load kernel modules, but occasionally they also call additional commands. In SUSE LINUX, this is handled by /sbin/hwup or /sbin/hwdown. These programs search for a configuration suitable for the device in the directory /etc/sysconfig/hardware and apply it. To prevent a certain device from being initialized, create a suitable configuration file with the start mode manual or off. If /sbin/hwup does not find any configuration, modules are automatically loaded by the agent. For more information, see 18.4. “Automatic Module Loading”. More information about /sbin/hwup is available in the file /usr/share/doc/packages/sysconfig/README and in the manual page of hwup.

Interface agents are started indirectly over udev. In this way, udev first generates a device node the system can access. udev enables the assignment of persistent names to interfaces. See 19. Dynamic Device Nodes with udev for details. Subsequently, the individual agents set up the interfaces. The procedures for some interfaces are described below.

18.3.1. Activating Network Interfaces

Network interfaces are initialized with /sbin/ifup and deactivated with /sbin/ifdown. Details are provided in the file /usr/share/doc/packages/sysconfig/README and in the manual page of the command ifup. Because Linux does not use device nodes for network interfaces, these are not managed by udev.

If a computer has several network devices with different drivers, the designations of the interface can change if another driver is loaded faster after the system is booted. For this reason, SUSE LINUX manages events for PCI network devices by means of a queue. This feature can be disabled with the variable HOTPLUG_PCI_QUEUE_NIC_EVENTS=no in the file /etc/sysconfig/hotplug.

The best way to achieve consistent interface designations is to specify the names of the individual interfaces in the configuration files. Details about this method are available in the file /usr/share/doc/packages/sysconfig/README.

18.3.2. Activating Storage Devices

Interfaces to storage devices must be mounted to be able to access them. This can be fully automated or preconfigured. The configuration takes place in the variables HOTPLUG_DO_MOUNT, HOTPLUG_MOUNT_TYPE, and HOTPLUG_MOUNT_SYNC in /etc/sysconfig/hotplug and in the file /etc/fstab.

Fully automated operation can be activated by setting the variable HOTPLUG_DO_MOUNT=yes. Use the variable HOTPLUG_MOUNT_TYPE to switch between two modes: subfs or fstab.

In the HOTPLUG_MOUNT_TYPE=subfs mode, a directory is created in the directory /media. The name of the subdirectory is derived from the device properties. When the medium is accessed, it is automatically mounted and unmounted by submountd. Devices in this mode can easily be removed when the access control light goes out.

In the HOTPLUG_MOUNT_TYPE=fstab mode, storage devices are mounted in the conventional way by means of a suitable entry in the file /etc/fstab. The variable HOTPLUG_MOUNT_SYNC can be set to enable access in synchronous or asynchronous mode. In the asynchronous mode, write access is faster, because the results are buffered. However, careless removal of the data medium can result in incomplete writing of data. In the synchronous mode, all data is written immediately, but the access takes longer. The device must be unmounted manually with umount.

Fully automated operation can be deactivated by setting the variable HOTPLUG_DO_MOUNT=no. In this case, the device must be manually mounted and unmounted.

In the two latter operating modes, the use of persistent device names is recommended, because traditional device names may change depending on the initialization sequence. Details about persistent device names is available in 19. Dynamic Device Nodes with udev.