The objective is to blacklist selected modules from loading.

Operating System and Software Versions

  • Operating System: - Debian, Ubuntu, Mint


Privileged access to your Ubuntu System as root or via sudo command is required.




  • # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given linux commands to be executed as a regular non-privileged user


There maybe a time when you need to disable some modules from being loaded during your system's boot time. In this "how to" we will discus some of the few ways how to blacklist module including its dependencies, that is, disable permanently module from loading during the boot time.

First, we need to know how to list all modules currently loaded by your Linux system:
$ 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
lsmod command lists all currently loaded kernel modules. The above lsmod output has been shortened. Let's say we are going to blacklist usbcore module. Before you unload or blacklist any module it is good to see what other modules depend on it:

Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.

$ modinfo -F depends usbcore
From the above example we can see that usb-common module depends on usbcore. To blacklist a module without dependencies create a /etc/modprobe.d/blacklist.conf ( if non existing ) fle and add line:
blacklist usbcore
Once done update initramfs and reboot your system:
# update-initramfs -u
# reboot
After reboot use lsmod to 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.

If from some reasons you are unable to blacklist modules and all its dependencies, make the module fail to load and thus also cause all dependent modules stop from loading. Add the following line to your /etc/modprobe.d/blacklist.conf to completely blacklist usbcore including all its dependent modules:
install usbcore /bin/true
Update initramfs and reboot:
# update-initramfs -u
Just 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 e1000 than create separate /etc/modprobe.d/e1000.conf file.
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.