Stop the kernel from auto-loading modules you never asked for

Kernel News & Module Management

Stop the kernel from auto-loading modules you never asked for

Technical Briefing | 12/2/2026

You probably think your kernel only loads the drivers it actually needs to talk to your hardware. Most of the time that is true, but modprobe is far more aggressive than you realize. I once spent an entire afternoon tracking down a weird network glitch only to find the kernel had auto-loaded an obscure protocol module I hadn’t touched in years, all because a stray packet hit a socket that triggered a request for a module alias.

Why modprobe is too helpful for its own good

The mechanism relies on modprobe.conf and /etc/modprobe.d/ to map aliases to actual module files. When a process tries to open a socket or device, the kernel checks these aliases and reaches out to the filesystem to load code into ring 0. If you have a driver that is slightly buggy or just unnecessary for your specific workload, it keeps sitting there waiting to be invoked. Blacklisting is the standard fix, but doing it correctly requires more than just dropping a file in /etc/modprobe.d/.

echo 'install usb-storage /bin/true' > /etc/modprobe.d/no-usb-storage.conf

  • The install directive overrides the default modprobe behavior by running /bin/true instead of the actual module
  • Just blacklisting isn’t always enough because modprobe can still load the module if another module requests it as a dependency
  • Using the install override ensures the module never actually makes it into the kernel memory space

Verifying the fix in your own environment

After you add an override, don’t just trust that it worked. Verify that your system isn’t trying to resolve those aliases behind your back. Check lsmod output after a reboot and keep an eye on dmesg. If you see the module popping up anyway, double-check that you haven’t defined a conflicting config in /etc/modules or through a package manager that explicitly forces the load. If you are doing this on a high-availability node, do it during maintenance—nuking a module from a live running kernel can be messy, even if the kernel is technically smart enough to handle it.

Linux Admin Automation  |  © www.ngelinux.com  |  12/2/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted

Stop the kernel from auto-loading modules you never asked for

Kernel News & Module Management

Stop the kernel from auto-loading modules you never asked for

Technical Briefing | 12/2/2026

You probably think your kernel only loads the drivers it actually needs to talk to your hardware. Most of the time that is true, but modprobe is far more aggressive than you realize. I once spent an entire afternoon tracking down a weird network glitch only to find the kernel had auto-loaded an obscure protocol module I hadn’t touched in years, all because a stray packet hit a socket that triggered a request for a module alias.

Why modprobe is too helpful for its own good

The mechanism relies on modprobe.conf and /etc/modprobe.d/ to map aliases to actual module files. When a process tries to open a socket or device, the kernel checks these aliases and reaches out to the filesystem to load code into ring 0. If you have a driver that is slightly buggy or just unnecessary for your specific workload, it keeps sitting there waiting to be invoked. Blacklisting is the standard fix, but doing it correctly requires more than just dropping a file in /etc/modprobe.d/.

echo 'install usb-storage /bin/true' > /etc/modprobe.d/no-usb-storage.conf

  • The install directive overrides the default modprobe behavior by running /bin/true instead of the actual module
  • Just blacklisting isn’t always enough because modprobe can still load the module if another module requests it as a dependency
  • Using the install override ensures the module never actually makes it into the kernel memory space

Verifying the fix in your own environment

After you add an override, don’t just trust that it worked. Verify that your system isn’t trying to resolve those aliases behind your back. Check lsmod output after a reboot and keep an eye on dmesg. If you see the module popping up anyway, double-check that you haven’t defined a conflicting config in /etc/modules or through a package manager that explicitly forces the load. If you are doing this on a high-availability node, do it during maintenance—nuking a module from a live running kernel can be messy, even if the kernel is technically smart enough to handle it.

Linux Admin Automation  |  © www.ngelinux.com  |  12/2/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted