Sample Header Ad - 728x90

How to add a custom init process to initramfs image built with Dracut?

1 vote
0 answers
273 views
I want to use Dracut for initramfs image creation. This image should be able to shrink a root filesystem on a Fedora machine. I would like to test partition shrinking flow manually first. If everything is okay, I will replace these commands with a script to do shrinking automatically in non-interactive mode on a remote machine. I was able to add the 'parted' and 'resize2fs' tools that I needed for this task. However, the image still uses 'systemd' as the init process and just boots the main Fedora installation. So I need to boot into some kind of shell and run the 'parted' and 'resize2fs' commands by hand. My attempt to add a simple 'init' script to the initramfs image failed (I put it as '/sbin/init' and turned the execution bit on. But the kernel complains that it can't find a runnable init process). So my question my question is: how to add your own init process to an initramfs image with Dracut?
Asked by Zzaponka (111 rep)
Nov 7, 2024, 05:36 PM