Blacklist kernel module ?

Hello,

I've some troubles with Bluetooth module ng_ubt on FreeBSD 10.3 .
It is automatically loaded at boot, despite ng_ubt_load="NO" put in /boot/loader.conf. Even if I manually unload with kldunload ng_ubt it reloads itself back(?!), as shown by kldstat.

This module turns on bluetooth device which is an unwanted behavior, as it consumes additional power causing faster battery depletion and it may also be the cause of issues with resuming from suspend.

Is there some way how tell kernel to not load this module, ie. some blacklist of modules with quirks and prevent their loading ?
 
Modules generally aren't loaded on boot unless you specifically enable them in /boot/loader.conf, so I wouldn't expect {some_module}_load="NO" to do anything.

I suspect one of the devfs rules is loading it. There are quite a few rules in /etc/devd/usb.conf that appear to load the ng_ubt module when they detect a bluetooth device. I don't know if a module can be forced to stop loading but you could try and comment out the devfs rule that is loading it (if it is devfs).
 
Modules generally aren't loaded on boot unless you specifically enable them in /boot/loader.conf, so I wouldn't expect {some_module}_load="NO" to do anything.

I suspect one of the devfs rules is loading it. There are quite a few rules in /etc/devd/usb.conf that appear to load the ng_ubt module when they detect a bluetooth device. I don't know if a module can be forced to stop loading but you could try and comment out the devfs rule that is loading it (if it is devfs).
To find your device in there you might need its vendor and product ids which can be obtained with usbconfig dump_device_desc.

You could also "blacklist" by mv /boot/kernel/ng_ubt.ko /boot/kernel/ng_ubt.ko.blacklisted ;).
 
I think the best way is to use device hints in loader.conf(5) to disable the device even if the module gets loaded. This should do it:

Code:
hint.ng_ubt.0.disabled="1"

If there are more than one of the same device you need do the same with the unit number set to 1, 2 and so on.
 
too late.... just for indexing into google ))
it could be done like below, major point in priority value

Code:
cat /usr/local/etc/devd/black_list_bluetooth.conf
# try to don't load bluetooth module
# bluetooth on lenovo T410
nomatch 50 {
        match "bus" "uhub[0-9]+";
        match "mode" "host";
        match "vendor" "0x0a5c";
        match "product" "0x217f";
        #action "kldload -n ng_ubt";
        action "logger blocked bluetooth module";
};
 
Today I tried victron suggestion in 11.2-RELEASE and it worked :D
However /boot/kernel/if_run.ko doesn't automatically load when USB wireless adapter is attached liked it used to.
Is this behavior expected?
Thanks in advance :)
 
I am facing same kind of issue. I have storage driver which is inbox, i want to blacklist the driver and load the same module with some modification in source. Can anyone please help me on this.
Thanks in advance !!
 
Back
Top