Blacklist kernel module ?

JBlake

New Member


Messages: 1

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 ?
 

usdmatt

Daemon

Reaction score: 521
Messages: 1,399

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).
 

tobik@

Daemon
Developer

Reaction score: 1,378
Messages: 1,909

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 ;).
 

kpa

Beastie's Twin

Reaction score: 1,807
Messages: 6,318

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.
 

victron

New Member


Messages: 13

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";
};
 

ldgc

Active Member

Reaction score: 46
Messages: 194

I have the same issue that the OP mentioned, except that in my case is on FreeBSD 11.1.
Is victron's answer a reliable solution?
 

ldgc

Active Member

Reaction score: 46
Messages: 194

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 :)
 

Deepak Ukey

New Member


Messages: 2

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 !!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,676
Messages: 30,585

The smartpqi(4) driver is loaded by default in GENERIC. What exactly do you want to change? The easiest way is to build a custom kernel with this driver excluded. Then you can kldload(8)/kldunload(8) it.
 
Top