Guide to Disable Hardware in Linux

Guide to Disable Hardware in Linux
Page content

Determine Which Module to Disable

You should always be extremely careful, and double check what each module is used for, before making any changes. If you accidentally remove the module that manages your ide bus and your harddrive is ide, your system will become unresponsive immediately.

The first thing you need to do is figure out the name of the module. If your kernel is in the 2.6.x series, you can figure it out pretty easily with the command: “sudo lspci -k”. On my laptop the output looks like this:

With the “-k” option, you can easily see which modules and drivers are used by each hardware device. However, if you are using an older kernel, the “-k” option does not work. Instead, you have to figure it out from the command “lsmod”.

lsmod

As you can see, the lsmod command gives you a list of all the kernel modules loaded, but it does not have a “plain English” way of telling you what device uses which module. If you are unsure, do some research before removing or blacklisting a module.

Disabling the Hardware

Once you have figured out the correct module, you will edit the /etc/modprobe.d/blacklist.conf file. This file may also be called /etc/modprobe.d/blacklist depending on your distribution. The blacklist.conf file is owned by root, so either su to root, or use “sudo gedit” to make any changes. The format for blacklisting a module is “blacklist ”. For example if I wanted to blacklist the “berry_charge” module, I would add the following two lines to my blacklist.conf file:

#No longer own my blackberry

blacklist berry_charge

Once you add an entry to the blacklist.conf file, you must reboot your system for the changes to take effect.

You can also permanently remove the module by using the “rmmod” command. Using the berry_charge example, if I wanted to permanently remove the module I would use the command:

sudo rmmod berry_charge

Some modules depend on other modules, so you may have to follow a dependency trail to actually get the results that you want.

Finally, if the driver is actually compiled into the kernel, you may have some difficulty actually disabling it. Sometimes you can use the /proc and /sys filesystems to disable the hardware. For example, if you want to disable a cpu you would use the following command:

echo 0 » /sys/devices/system/cpu/cpu1/online

Other times, you will have to use kernel command line arguments.

As you can see, disabling hardware is not a simple “point and click” process in Linux. There may be a time, possibly in the near future, when there will be graphical system. Until then your best bet is to hope your hardware uses a kernel module, and blacklist it.