Blacklisting a Module in the Linux Kernel (in 2026) (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Mon, 06 Apr 2026

Blacklisting a Module in the Linux Kernel (in 2026)

As part of a quest to disable the HDMI audio devices that Linux's audio system pipewire is so fond of (about which, more in a separate article), I got the bright idea of blacklisting the snd_hda_codec_hdmi kernel module. (Don't do that; it isn't a good solution because it breaks other things.)

But at least along the way I learned how to blacklist kernel modules, which isn't as simple as the net might make you think.

Pages all over the net say blacklisting is easy: just edit /etc/modprobe.d/blacklist.conf (creating it if it doesn't already exist) and add blacklist snd_hda_codec_hdmi.

That doesn't work: after rebooting, lsmod | grep snd_hda_codec_hdmi showed that it and a slew of dependencies were still loaded.

That's because modules in your kernel aren't loaded from your filesystem; they're loaded from the initramfs in /boot. So after editing blacklist.conf, you need to regenerate the initrd:

sudo update-initramfs -u

update-initramfs will copy the blacklist.conf into the new initrd.

However, it's not enough: just the blacklist line doesn't actually prevent the module from being loaded. I actually needed two lines:

blacklist snd_hda_codec_hdmi
install snd_hda_codec_hdmi /bin/true

The second line says that any time anyone tries to load that module, instead, run the program /bin/true, which does nothing.

(I'm not sure if the first, blacklist, line is actually needed, since it doesn't seem to do anything. I suspect not, but it doesn't hurt to keep it.)

Then run sudo update-initramfs -u.

Thanks to ayecee for that tip!

A couple of related tips: update-initramfs -u -v will give you a list of what it's doing, so you can verify that a particular file is being copied. Also, you can use lsinitramfs to check what files are inside an initrd file. For instance, lsinitramfs /boot/initrd.img-6.12.74+deb13+1-amd64 | grep blacklist

Tags: ,
[ 11:40 Apr 06, 2026    More linux/kernel | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus