Skip to content

How to Modify Initramfs and Dracut

If you just plan to add options to a module, you should consider using a karg!

Touching the initramfs system and modprobe will slow down your updates so all your updates will take several minutes longer. In most cases what you want to do in modprobe can be done with simple kernel arguments,

In this example lets change the below modprobe options into a karg (kernel argument)

options hid_apple fnmode=2

This would translate to the karg:
hid_apple.fnmode=2

To add this to grub we issue the command.
rpm-ostree kargs --append-if-missing="hid_apple.fnmode=2"

This lets you change the module option without editing the initramfs system and is a lot faster whenever you update the system as the kernel arguments are not regenerated on each update.

However if you want to or must use modprobe files instead at the sacrifice of slowing down your update speed a lot, then proceed with the reading.


Adding modprobe files to initramfs (this will slow down updates)

Should you need to add files to initramfs (lets say a modprobe file) then you will need to add that as a dracut.conf file.

For this example we will use /etc/modprobe.d/hid_apple.conf as the modprobe file we want to add, this contains

options hid_apple fnmode=2

To get this to work, we need it included in initramfs so we will make a dracut config file for it /etc/dracut.conf.d/hid_apple.conf
This file has the content

install_items+=" /etc/modprobe.d/hid_apple.conf "

Once both those files are made we can now issue a rebuild with
rpm-ostree initramfs --enable
and reboot

Enabling kernel modules through dracut (this will slow down updates)

NOTE: If you need to add a new driver to the system, then you will need to make a custom image, this is about enabling drivers/modules that are disabled by default

Enabling kernel modules that exists on the system image, you will need to make a dracut.conf file in /etc/dracut.conf.d/.
For this example we will use our /etc/dracut.conf.d/vfio.conf file generated by
ujust setup-virtualization vfio-on on bazzite

add_drivers+=" vfio vfio_iommu_type1 vfio-pci "

Once we save that file, you can issue an initramfs rebuild with
rpm-ostree initramfs --enable

Do not rebuild using the dracut command directly when using a Fedora Atomic OS!