13

I configured and compiled Linux kernel with nouveau driver built-into kernel, i.e. with <*> as opposed to <M> when doing make menuconfig inside Linux kernel source directory.

Now, I intend to use another driver rather than nouveau. If nouveau was a module, I would add a line like blacklist nouveau inside /etc/modprobe.d/blacklist.conf

What should I do now.

2 Answers 2

20

Not many people know about this, but there absolutely is a way to blacklist a driver built into the kernel.

First and foremost, you should run lsmod | grep <driver_name>. If you don't see any results, congratulations - your driver is built directly into the kernel and the normal way of blacklisting it isn't going to work. Instead, you'll need to blacklist your driver's initialization function instead. To do this, you'll need to add initcall_blacklist=<driver_init> as a kernel boot option where driver_init is the driver initialization function - you'll have to look through your kernel's sources to figure out what name needs to be used. As a concrete example, initcall_blacklist=vmd_drv_init used as a boot option prevents Intel's Volume Management Device driver from loading and binding to an active Volume Management Device controller.

4
  • 2
    One can also look for the function names in System.map. I did it like this fgrep elants /boot/System.map-5.8.0-23-generic | fgrep init for solving bugs.launchpad.net/ubuntu/+source/linux-oem-5.6/+bug/1900254/… Commented Oct 17, 2020 at 18:32
  • 2
    This should be the accepted answer. FWIW, another example, for the compiled-in rtc_cmos driver, blocking it with initcall_blacklist=add_rtc_cmos works great while rtc_cmos.blacklist=yes is ignored. Commented Jul 18, 2021 at 17:38
  • 1
    This answer helped me prevent a stubborn built-in driver from loading. Usually I would go with the "unbind" sysfs property to unload the driver, but it's been disabled in the driver's code. Commented Sep 22, 2024 at 18:00
  • @dave thanks I come back to this every few years. Commented Jul 23 at 12:28
8

You can also temporarily blacklist them on the grub command line (linux line) when you boot with the syntax

module_to_blacklist.blacklist=yes 

OR

modprobe.blacklist=module_to_blacklist 

You need to modify the grub,cfg to make the changes permanent.

Mind you, this solution will not work for few modules

2
  • Which modules does it not work for, for example? What is the reason? E.g. in particular does not seem to work for i8042. Commented Dec 30, 2017 at 22:57
  • 1
    @CiroSantilli新疆改造中心法轮功六四事件 it seems xhci_hcd is hard to get rid of this way. Commented Oct 24, 2019 at 16:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.