32.3. Hotplug Device Configuration

Hotplug agents have been deprecated as of SUSE Linux 10.0. All device configuration should now be done via udev rules. udev provides a compability rule to call existing custom agents. However, converting custom agents into udev rules should be considered.

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 facilitate device configuration it is usually sufficient to load a kernel module. In some cases, additional commands need to be called for a proper device configuration. In SUSE Linux, this is handled generally by udev rules. However, if a custom device configuration is required, the device configuration is done 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. For example, to prevent a specific device from being initialized, create a configuration file with an appropriate name and set the start mode to manual or off. If /sbin/hwup does not find any configuration, it looks for the environment variable MODALIAS. If it exists, modprobe automatically loads the corresponding module. The MODALIAS variable is automatically generated by kernel hotplug events for devices that require a module to be loaded. For more information, see Section 32.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 33, Dynamic Device Nodes with udev for details. The interfaces itself are then set up according to the respective udev rules. The procedures for some interfaces are described below.

32.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 ifup man page.

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. SUSE Linux tries to keep the numbering persistent—the devices retain the interface name they have been assigned during configuration. This assigment is done via udev rules. To change the assignment later, the udev rules must be changed.

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.

32.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. Additionally, SUSE Linux distinguishes between system and user devices. System devices can only be automatically mounted by creating an entry in /etc/fstab. User devices are handled via hal by default. If a different configuration for user devices is required, these devices can be entered into /etc/fstab. Alternatively, the handling of this device in hal can be modified. For more information about hal, refer to /usr/share/doc/packages/hal/hal-spec.html.

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