Persisting initramfs via rpm-ostree


I want to use my bluetooth keyboard when decrypting my root partition so was looking for ways to make this a reality. Until now, I wasn’t succesful. Today I generated a host only initramfs image and replaced the image generated by rpm-ostree and it worked.

I placed the following file:

# cat /etc/dracut.conf.d/ble.conf
add_dracutmodules+=" bluetooth "

Then generated the image with the following command:

# dracut --add ostree path/to/image.img

And this is it! I’m now able to use my bluetooth keyboard at boot, while decrypting my root partition.

The thing is that this is not a permanent change. I see that when I enable locally generated initramfs support, there are some files in the initramfs image that are bluetooth related but not the ones inside /var/lib/bluetooth.

I tried adding them with the following commands:

dracut -i /var/lib/bluetooth /var/lib/bluetooth \
    --rebuild initramfs-6.0.11-300.fc37.x86_64_backup.img \
    -f initramfs-6.0.11-300.fc37.x86_64.img

I verify that the files are there but I cannot use my keyboard with this setup as it complains about something related to dbus. The real difference seems to come from the files in /var/lib/bluetooth & the --host-only flag.

I’ve seen bug reports that mentions about directories like /var aren’t available during image generation but I’m not sure if it’s still the case or whether we have a workaround.

Is it possible to achieve this without manually overwriting the initramfs image, persisting between rpm-ostree updates?

1 Like

I’m curious if it works if you add this via /etc/modules-load.d/ instead of dracut? I’m guessing probably not since you haven’t decrypted the drive yet where that file exists…

It’s confusing, but dracut modules are not the same as kernel modules.

$ man dracut.conf | grep -m 1 -A 3 add_dracutmodules
       add_dracutmodules+=" <dracut modules> "
           Add a space-separated list of dracut modules to call when building the initramfs.
           Modules are located in /usr/lib/dracut/modules.d.

$ man modules-load.d | grep -A 1 '^NAME'
       modules-load.d - Configure kernel modules to load at boot

/etc/modules-load.d won’t work for dracut modules.

1 Like

It looks like there might be a way to do this with rpm-ostree initramfs

1 Like

Thanks for the suggestion! We created this ticket to follow: InitramFS Generation with Paired Bluetooth Device Metadata · Issue #4214 · coreos/rpm-ostree · GitHub

1 Like