The only purpose of an initramfs is to mount the root filesystem. The initramfs is a complete set of directories that you would find on a normal root filesystem. It is bundled into a single cpio archive and compressed with one of several compression algorithms.
At boot time, the boot loader loads the kernel and the initramfs image into memory and starts the kernel. The kernel checks for the presence of the initramfs and, if found, mounts it as / and runs /init. The init program is typically a shell script. Note that the boot process takes longer, possibly significantly longer, if an initramfs is used.
https://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html
In order to prevent kernel modules loading during boot, the module name must be added to a configuration file for the “modprobe” utility. This file must reside in
/etc/modprobe.decho "blacklist module_name" >> /etc/modprobe.d/local-dontload.confunload the module from the running system if it is loaded.
modprobe -r module_nameIf the kernel module is part of the initramfs (use “lsinitrd /boot/initramfs-$(uname -r).img|grep module-name.ko” to verify), then you should rebuild your initial ramdisk image, omitting the module to be avoided
If the kernel module is part of the initramfs (boot configuration), rebuild your initial ramdisk image, omitting the module to be avoided
https://access.redhat.com/solutions/41278
# dracut --omit-drivers module_name -f
Initramfs stands for Initial Random-Access Memory File System. On modern Linux systems, it is typically stored in a file under the /boot directory. The kernel version for which it was built will be included in the file name. A new initramfs is generated every time a new kernel is installed.
You can use the lsinitrd command to list the contents of your initramfs archive.
The dracut command can be used to modify the contents of your initramfs […] you can re-run the dracut command to regenerate the initramfs with only the drivers that are needed.
# dracut –force
https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/
There might be multiple [modules] lists: one for kernel modules loaded within initramfs (i.e. modules necessary for basic I/O and accessing the root filesystem) and another list loaded once the root filesystem has been mounted.
For Debian and related Linux distributions like Ubuntu, there’s
/etc/initramfs-tools/modulesfor modules to be loaded in initramfsFor any distribution using the
https://unix.stackexchange.com/questions/527168/kernel-modules-loaded-when-bootdracutinitramfs creator, you might want to look into/etc/dracut.confand/or/etc/dracut.conf.d/*.conffiles foradd_drivers,force_driversand/orfilesystemslines: these will cause the specified modules to be added into initramfs, and in case offorce_drivers, explicitly loaded regardless of hardware detection.
Make a backup of your existing initial ramdisk.
https://www.lightnetics.com/topic/25016/how-do-i-prevent-a-redhat-kernel-module-loading-at-boot-time-of-after
$ sudo cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).bak.$(date +%m-%d-%H%M%S).img
Blacklisting doesn’t prevent the modules from being added to the initramfs, it only prevents the modules from being loaded.
https://bbs.archlinux.org/viewtopic.php?id=157241
To blacklist a kernel module permanently via GRUB, open the /etc/default/grub file for editing, and add the modprobe.blacklist=MODULE_NAME option to the GRUB_CMD_LINUX command. Then run the sudo grub2-mkconfig -o /boot/grub2/grub. cfg command to enable the changes.
https://documentation.suse.com/sles/12-SP4/html/SLES-all/cha-mod.html
[To] prevent a module being loaded if it is a required or optional dependency of another module […] this can be achieved by configuring the following setting in /etc/modprobe.d/local-blacklist.conf:
# vi /etc/modprobe.d/local-blacklist.conf install [module name] /bin/false
The above install line simply causes /bin/false to be run instead of installing a module. Same can be achieved by using the /bin/true.
https://www.thegeekdiary.com/centos-rhel-how-to-disable-and-blacklist-linux-kernel-module-to-prevent-it-from-loading-automatically/