Prevent a driver from being automatically loaded


I have an internal crappy wifi card on a laptop that requires bwn. The OS installed on this laptop is a FreeBSD and I chose to simply not load bwn at start, but another driver for a linux and unix friendly wifi dongle that’s way more efficient anyway.

But when I start NomadBSD, it automatically detects and runs bwn.

Is there any way to prevent it? Like adding a customized configuration file somewhere that would prevent NomadBSD from loading bwn, ever?

You can add this to rc.conf:


Well, I’ve added this line, but it is not enough.

grep bwn /etc/rc.conf returns:


This wlans_bwn0="wlan1" has been added automatically. I tried to comment it out, but it showed up again automatically at next reboot, right at the end of /etc/rc.conf.

This is a little bit annoying because I haven’t done the complete configuration for this driver (it requires some other configuration lines, that I do not want to do because I do not want to use this driver at all) and at each start, it floods the console with error messages.

Is there anything more to do?

Some more details: the problem shows up in a NomadBSD 1.3.1 key. I’ve tried with a 1.3.2, haven’t noticed the error messages flood at start (without any additional line to /etc/rc.conf) but can’t say much more because the graphical session does not start (that’s another problem).

What @lme wrote is basically correct, but the version of dsbdriverd that comes with NomadBSD <= 1.3.2 does not support the dsbdriverd_blacklist rc-variable (and it was renamed to dsbdriverd_exclude). You can instead add if_bwn to the exclude_kmods list in /usr/local/etc/dsbdriverd/config.lua. You can disable automatic network configuration altogether by setting enable_netconfig to false in /usr/local/etc/dsbdriverd/config.lua


Hmm, I have checked “solution” a little bit too quick.
There’s a line in /usr/local/etc/dsbdriverd/config.lua with -- exclude_kmods = {some stuff}. I don’t know lua, but I guess the two dashes start a comment. So I replaced it with: exclude_kmods = { "if_bwn" }, but still, bwn is loaded at start. Did I write it well? Is anything else still missing?

That is correct.

What’s the output of grep bwn /var/log/dsbdriverd.log | tail -10?

It returns:

Mon Sep 21 20:11:22 2020: vendor=14e4 product=4315 Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY: if_bwn excluded from loading
Mon Sep 21 20:11:22 2020: vendor=14e4 product=4315 Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY: Loading bwn_v4_lp_ucode

So I guess this is an hint that I blacklisted the wrong driver. Or maybe only a part of the drivers I should blacklist. I do not know, though, which driver exactly I should blacklist. Just bwn_v4_lp_ucode? (Is it a driver at all?) Or should I keep blacklisting if_bwn and add bwn_v4_lp_ucode? Should I write if_bwn_v4_lp_ucode or simply bwn_v4_lp_ucode?

bwn_v4_lp_ucode is the firmware module, which you can exclude as well. Without if_bwn it is useless anyway. I guess devmatch(8) is loading if_bwn. To prevent that: sysrc devmatch_blacklist+=" if_bwn"