Disabling Linux Device

From nadeko.net Wiki
Revision as of 23:06, 29 January 2025 by Fijxu (talk | contribs) (Created page with "There is two ways to disable a device on Linux, at boot time and at runtime: # Execute: <code>sudo lspci -k</code> # Find the device you are trying to disable and search for the <code>Kernel modules:</code> line. Both of this steps work for Boot time and runtime == At Boot Time == # Use the command: <code>lsmod | grep <kernel_module></code> to see if the module is enabled first. # Blacklist the kernel module creating a <code>/etc/modprobe.d/blacklist.conf</code> file...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There is two ways to disable a device on Linux, at boot time and at runtime:

  1. Execute: sudo lspci -k
  2. Find the device you are trying to disable and search for the Kernel modules: line.

Both of this steps work for Boot time and runtime

At Boot Time

  1. Use the command: lsmod | grep <kernel_module> to see if the module is enabled first.
  2. Blacklist the kernel module creating a /etc/modprobe.d/blacklist.conf file.
  3. Inside the file, write one line containing blacklist <kernel_module>, replacing <kernel_module> by the kernel module you want to disable.
  4. Regenerate the initramfs using the following command:
    • In Arch Linux:
    sudo mkinitcpio -P
    • In Debian:
    sudo depmod -ae
    update-initramfs -u
  5. Reboot
  6. Verify that the module has been removed by running: lsmod | grep <kernel_module>. If the module is no longer listed, the module has been disabled and the device will be ignored by the Linux kernel.

At Runtime

  1. Use the command: lsmod | grep <kernel_module> to see if the module is enabled first.
  2. Use the command: sudo modprobe -r <kernel_module> to disable the module.
  3. Verify that the module has been removed by running: lsmod | grep <kernel_module>. If the module is no longer listed, the module has been disabled and the device will be ignored by the Linux kernel.

See also