12

I'm trying to figure out how to blacklist modules, and I'm trying it on the USB storage. Unfortunately it seems to have no effect, and I get the module in even if it's not used (apparently).

My experiment is taking place on an Ubuntu 12.04.3 LTS.

raptor@raptor-VirtualBox:/etc/modprobe.d$ lsmod | grep usb
usb_storage            39720  0 
usbhid                 46054  0 
hid                    82511  2 hid_generic,usbhid
raptor@raptor-VirtualBox:/etc/modprobe.d$ cat blacklist.conf | grep usb
blacklist usb_storage
blacklist usbmouse
blacklist usbkbd
Reinderien
  • 175
  • 2
  • 11
bogdan.mustiata
  • 231
  • 1
  • 2
  • 6

4 Answers4

15

Your problem probably results from the fact that a copy of /etc/modprobe.d/blacklist.conf is located in the initramfs. When you reboot your computer, it is still using the old copy that doesn't contain your change. Try to rebuild the initramfs with the following command and then reboot:

sudo update-initramfs -u
Martin von Wittich
  • 13,857
  • 6
  • 51
  • 74
0

If update-initframfs doesn't exist, look for /bin/kernel-install. If that exists, you'll need to use that. On my Fedora system I did rpm -q --scripts kernel-core to find the post transaction (posttrans) scriptlet and ran it manually:

/bin/kernel-install add 5.5.5-200.fc31.x86_64 /lib/modules/5.5.5-200.fc31.x86_64/vmlinuz
Matthew Cline
  • 3,265
  • 4
  • 24
  • 38
0

For system based on RHEL (suse/opensuse/etc.) to update the initramfs the command is

mkinitrd
intika
  • 13,920
  • 7
  • 41
  • 79
0

The correct way to regenerate your initrd for your currently active kernel on any Fedora/RHEL/CentOS/Rocky/Alma Linux distro is to simply run:

dracut -f

No need to mess with mkinitrd.

Rob
  • 1
  • 1