How do I disable loading of unnecessary kernel modules. Kernel 3.2.4
Best Answer
Note: blacklisting will not work for modules which are built into the kernel image (i.e. not loaded via a separate .ko file. The only way to disable such modules is via a kernel parameter (if available) or by recompiling the kernel.
Just open your /etc/modprobe.d/blacklist file and add drivername using following syntax:
blacklist driver-name
EDIT: In later versions since 12.10 (12.04?) the file is /etc/modprobe.d/blacklist.conf
Reboot your box and use lsmod command to show the status of modules in the Linux Kernel
Note: here driver-name is the name of your desired blacklist driver. For example, If you wanted to disable the NIC card driver, you can find the name of kernel driver for your LAN card by using the command lspci -v command in a terminal.
For Example my output was :
........
........
6:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express (rev 02)
Subsystem: Lenovo Device 3861
Flags: bus master, fast devsel, latency 0, IRQ 46
Memory at b8000000 (64-bit, non-prefetchable) [size=64K]
Expansion ROM at [disabled]
Capabilities:
Kernel driver in use: tg3
Kernel modules: tg3
........
........
Here, I see the driver is tg3. so you need to write tg3(or your driver) in the place of driver-name.
On Ubuntu, that would be /usr/src/linux-headers-$(uname -r)/scripts/sign-file.
How did I figure that out? I did a search for sign-file:
dpkg -S sign-file
which told me which package provides this file (currently linux-headers-4.4.0-22-generic) and where it was installed, i.e. in /usr/src/linux-headers-4.4.0-22-generic/scripts/.
The uname -r part is just to keep the command independent from the currently-installed headers-generic package.
Best Answer
Just open your
/etc/modprobe.d/blacklist
file and add drivername using following syntax:EDIT: In later versions since 12.10 (12.04?) the file is
/etc/modprobe.d/blacklist.conf
Reboot your box and use lsmod command to show the status of modules in the Linux Kernel
Note: here
driver-name
is the name of your desired blacklist driver. For example, If you wanted to disable the NIC card driver, you can find the name of kernel driver for your LAN card by using the commandlspci -v
command in a terminal.For Example my output was :
Here, I see the driver is
tg3
. so you need to writetg3
(or your driver) in the place ofdriver-name
.Plenty of info can be found here.