Monday, July 2, 2018

Driver Blacklisting

To prevent a specific driver from loading during the boot sequence, you will need to create a blacklist configuration file for the system to read and obey. Obviously you will need the name of the driver first. For instance, if you wanted the name of the Bluetooth driver, you could use the following command.
lspci -vv
This command will likely return a rather long list of items and you would need to look through them to find the Bluetooth driver. Below is the response of one of my computers.
04:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)
        Subsystem: Dell AR9485 Wireless Network Adapter
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
        Kernel driver in use: ath9k
        Kernel modules: ath9k
This is a Bluetooth controller and there at the end is the driver name in question, ath9k. To make sure, this is the only device using this driver, you can use the following command (wouldn't want to nerf something else in the process).
lspci -vv | grep ath9k
With this information, you can now proceed with the blacklisting of ath9k. You will create a file in /etc/modprobe.d/. This can have any filename you want, including the simple name of just blacklist.conf.
nano /etc/modprobe.d/blacklist.conf
Within this configuration file, we put what we want to blacklist.
# Do not load the Bluetooth driver during boot. 
blacklist ath9k
install ath9k /bin/false 
The first line prevents the driver from being loaded directly, but it won't prevent a secondary item from loading it. The second line will prevent a secondary item from loading the driver.

Once you have saved this file, you can reboot, and the driver will no longer be loaded during the boot sequence.

No comments: