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.d/event name and /etc/hotplug.d/default. All programs in these directories that have the suffix .hotplug are executed in alphabetical order.

To ensure that events of a particular kind are ignored, remove the executable bits from the respective hotplug agents. Alternatively, change the suffix .hotplug to something else.

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. In this case some agents automatically generate configuration files for hwup. This makes the agent faster the next time it runs. For more information, see Section 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 man hwup.

Before interface agents are called, udev usually generates a device node the system can access. udev enables the assignment of persistent names to interfaces. See Chapter 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 man ifup.

If a computer has several network devices with different drivers, the designations of the interface can change if another driver is loaded faster while the system is booting. 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 solution, however, is to use persistent interface designations. You can 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. Since SUSE LINUX 9.3, udev also deals with network interfaces, although these are not device nodes. This allows use of persistent interface names in a more standardized manner.

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. A fully automated operation can be activated by setting the variable HOTPLUG_DO_MOUNT=yes. Deactivate it by setting the variable to no.

Use the variable HOTPLUG_MOUNT_TYPE to switch between two modes: subfs or fstab. In the HOTPLUG_MOUNT_TYPE=subfs mode, a subdirectory 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 they are no longer accessed. 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.

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 Chapter 19, Dynamic Device Nodes with udev.

SUSE LINUX Administration Guide 9.3