RHEL 7: how to add vfat and fat kernel module to initramfs from dracut prompt [solved]

Latest response

Hello fellow forum members,

Due to CIS benchmark hardening our automation tools has blacklisted the installation of vfat and fat kernel modules.

This has caused a reboot failure on an Azure VM that uses a vfat filesystem for the luks vault.

Has anyone been able to add the 2 missing kernel modules to the initramfs to be able to boot.

Solution: unpack the current initramfs, add the missing modules and run depmod -a, repack.

always make a backup copy of the initramfs you manually try to fix

Regards,

Jan Gerrit Kootstra

Responses

You can create a custom conf for dracut and add the modules you like to have in initramfs. For example,

In /etc/dracut.conf.d/myown.conf, add a line:

add_drivers+=" fat vfat "

Hi Akemi,

Does this work while the server is down?

I mean by dracut prompt, the prompt you get when a boot fails. Kind of like "emergence mode"

Regards,

Jan Gerrit Kootstra

Hi Jan,

Most important is that you are able to access the system as the root user. An alternative would be to boot from the
installation medium and chroot into the system. More interesting will be : Is the specific way these automation tools
prevent the drivers installation configured to also prevent loading the drivers when being included in the initramfs ?
Let's hope not ... :)

Regards,
Christian

Hi Jan,

From how I'm understanding what is being provided in the Knowledgebase article "How can I ensure certain kernel modules are
included in the initrd or initramfs in RHEL?
" ... you have to add the driver (without file extensions such as .ko) to the add_drivers
directive in /etc/dracut.conf or /etc/dracut.conf.d/"my_conf".conf configuration file - and then execute the following command.

sudo dracut --force --add-drivers fat --add-drivers vfat /boot/initramfs-$(uname -r).img $(uname -r)

And this is the file that has to be created beforehand :

sudo vi /etc/dracut.conf.d/add-drivers.conf

add_drivers+="fat"
add_drivers+="vfat"

Hope it helps - and more importantly : I hope it works and that you can achieve the results that you want with this solution. :)

Regards,
Christian

Hi Akemi and Christian,

Thanks, I forwarded the suggestions to the colleagues who have to solve this issue.

Will let you know after the weekend if it worked.

Regards,

Jan Gerrit

You're welcome, Jan ! I wish you and your colleagues success. :)

Regards,
Christian

Hi Christian and Akemi,

Unfortunately the dracut method failed, so we are will try the "traditional" unpack and repack using an Azure disk copy method.

Regards,

Jan Gerrit

Thanks for the updated information, Jan ! Let's hope the "traditional" method works as expected. :)

Regards,
Christian

All,

Eize Speerstra managed to solve the issue The "traditional way", as stated in the introduction.

Regards,

Jan Gerrit

Thanks for conforming that it worked, Jan ... great job, Eize - well done ! :)

Regards,
Christian