$ lsmod .... ehci_hcd 40249 0 usbcore 128741 4 ehci_hcd,ohci_hcd,usbhid usb_common 12354 1 usbcore e1000 86156 0 libata 140630 4 libahci,ahci,ata_piix,ata_generic ....
lsmodcommand lists all currently loaded kernel modules. The above
lsmodoutput has been shortened. Let's say we are going to blacklist
usbcoremodule. Before you unload or blacklist any module it is good to see what other modules depend on it:
# modinfo -F depends usbcore usb-commonFrom the above example we can see that
usb-commonmodule depends on
usbcore. To blacklist a module without dependencies create a
/etc/modprobe.d/blacklist.conf( if non existing ) fle and add line:
blacklist usbcoreOnce done update initramfs and reboot your system:
# update-initramfs -u # rebootAfter reboot use
lsmodeto see whether module is present. In case that other modules are dependent on the module you are trying to blacklist, like in the above example, you will need to blacklist all dependent modules otherwise the initial module you have blacklisted would load anyway. Fortunately, there is a trick to blacklist all modules including their dependencies.
/etc/modprobe.d/blacklist.confto completely blacklist
usbcoreincluding all its dependent modules:
install usbcore /bin/trueUpdate initramfs and reboot:
# update-initramfs -uJust to be complete, please note that it is a good practice to create a separate module configuration file for each blacklisted module. For example if you wish to blacklist module
e1000than create separate