A system administrator needs to ensure that a specific kernel module 'usb_storage' is not loaded automatically during boot on a RHEL 9 system. Which configuration file should be modified to blacklist this module?
Trap 1: Add 'blacklist usb_storage' to /etc/modules-load.d/usb_storage.conf
The /etc/modules-load.d/ directory is handled by the systemd-modules-load.service and is intended only to specify modules to load at boot, not to block them. A 'blacklist usb_storage' line there would be misinterpreted—either as an invalid directive or as an attempt to load a module named 'blacklist'—resulting in boot-time failures. Blacklisting belongs in modprobe configuration under /etc/modprobe.d/.
Trap 2: Add 'install usb_storage /bin/false' to /etc/sysconfig/modules/
The /etc/sysconfig/ tree is a SysVinit-era location for environment variables and service configuration, and /etc/sysconfig/modules/ is not a standard directory for module blacklist rules. Even though 'install usb_storage /bin/false' is a valid modprobe directive when placed in a modprobe.d file, the udev/modprobe machinery will never read it from this path, so the module remains loadable.
Trap 3: Add 'blacklist usb_storage' to /etc/init.d/rc.local
The /etc/init.d/rc.local script is executed near the end of the boot sequence, after udev has already probed devices and automatically loaded needed modules—so usb_storage may have been loaded long before this line ever runs. Moreover, simply writing a 'blacklist' directive in a shell script has no effect on the kernel's module autoloading mechanism; it must be processed by modprobe in its configuration files. This option neither prevents the module from loading nor configures the system declaratively.
- A
Add 'blacklist usb_storage' to /etc/modules-load.d/usb_storage.conf
Why wrong: The /etc/modules-load.d/ directory is handled by the systemd-modules-load.service and is intended only to specify modules to load at boot, not to block them. A 'blacklist usb_storage' line there would be misinterpreted—either as an invalid directive or as an attempt to load a module named 'blacklist'—resulting in boot-time failures. Blacklisting belongs in modprobe configuration under /etc/modprobe.d/.
- B
Add 'install usb_storage /bin/false' to /etc/sysconfig/modules/
Why wrong: The /etc/sysconfig/ tree is a SysVinit-era location for environment variables and service configuration, and /etc/sysconfig/modules/ is not a standard directory for module blacklist rules. Even though 'install usb_storage /bin/false' is a valid modprobe directive when placed in a modprobe.d file, the udev/modprobe machinery will never read it from this path, so the module remains loadable.
- C
Add 'blacklist usb_storage' to /etc/modprobe.d/blacklist.conf
This is the standard and correct approach: /etc/modprobe.d/ contains configuration consumed by modprobe, and the 'blacklist' directive instructs it to ignore any request to load usb_storage from automatic discovery (e.g., udev or coldplug). Files in this directory follow a .conf naming convention, so blacklist.conf is a conventional choice. This prevents the module from being loaded by alias, though a user could still force it with an explicit full-name modprobe command.
- D
Add 'blacklist usb_storage' to /etc/init.d/rc.local
Why wrong: The /etc/init.d/rc.local script is executed near the end of the boot sequence, after udev has already probed devices and automatically loaded needed modules—so usb_storage may have been loaded long before this line ever runs. Moreover, simply writing a 'blacklist' directive in a shell script has no effect on the kernel's module autoloading mechanism; it must be processed by modprobe in its configuration files. This option neither prevents the module from loading nor configures the system declaratively.