I'm fairly new in Linux, looking for a solution to entirely ban kernel module to load.

I know how to unload module but need to prevent it before module loads on boot.

closed as unclear what you're asking by Michael Homer, GAD3R, countermode, Kusalananda, heemayl Jan 9 '17 at 13:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    it doesn't called process until it run. so do you mean you want to prevent running a script or service ? – Wissam Roujoulah Jan 9 '17 at 8:24
  • chmod -x /path/to/program – Ipor Sircer Jan 9 '17 at 8:26
  • 1
    What kind of process are you talking of? How is it started? Why not simply deinstalling that service? – michas Jan 9 '17 at 8:31
  • sorry my mistake, not a process but the modules to ban , there are some modules running on my new Linux box coming from a hosting provider, which I do not want to run. Presumably they are running cause some not needed hardware pieces are present, and do not really want to alter the kernel to remove them... – user209395 Jan 9 '17 at 8:38
  • Do you mean modules (as in the title), or processes (as in the body)? – Michael Homer Jan 9 '17 at 8:40

Check the module name first:

lsmod | less

Then let say loaded module name is my_proc_to_ban

go and create a script such as :

install my_proc_to_ban /bin/false
' >> /etc/modprobe.d/blacklist.conf

That will prevent to boot or run your module

or as in your case, server is yours and no one going to load the module you can simply:

echo '
blacklist my_proc_to_ban
' >> /etc/modprobe.d/my_proc_to_ban.conf

That will prevent your module to load on boot, but you still be able to load it if needed on some stage.

  • lsmod | less is not going to get you process names. Did you want some invocation of ps(1)? – phg Jan 9 '17 at 8:29
  • On the assumption that the question actually is about kernel modules, this is a valid answer, but a little explanation of what's going on would improve it. – Michael Homer Jan 9 '17 at 8:43

A way to be sure is to remove or move the module from /lib/modules

You may also use /etc/modprobe.d/blacklist.conf

On kernel command line you may add




source : https://wiki.archlinux.org/index.php/kernel_modules#Blacklisting

Depending on which distribution you use : debian (and derivatives) may build a initrd which embeds modules that the script thinks are mandatory to boot the the system.

So you may have to rebuild the initrd image by running "update-initramfs -u".