dracut icon indicating copy to clipboard operation
dracut copied to clipboard

I want to maintain two different types of initramfs on the same system

Open ericcurtin opened this issue 2 years ago • 3 comments

Describe the enhancement

I would like to build two different types of initramfs's on a Linux distribution. One "fat" version built simply via "dracut -f" and another slimmed down version, that removes unused modules for performance and that also removes GPLv3 content. Preferably I would not have to duplicate dracut config files to achieve this.

I was able to partially achieve this goal via:

dracut -v -m "systemd kernel-modules udev-rules dracut-systemd pre-initramfs rootfs-block" -f --strip $initramfs -M -o nss-softokn

Then using some rpm tooling, I identified that there was still some software with GPLv3 traces in the initramfs:

https://github.com/ericcurtin/initoverlayfs/blob/main/gplv3-files-to-rm.txt

I would like to specifically remove these files and all traces of these packages.

Should I look to contribute an option like:

--omit-files [LIST] Omit a space-separated list of files and directories from initramfs.

?

Or are there other options I should consider?

ericcurtin avatar Sep 06 '23 11:09 ericcurtin

I get your point, but if you explicitly remove some of the binaries required by the dracut modules you install, the resulting initrd should not be bootable...

aafeijoo-suse avatar Sep 07 '23 06:09 aafeijoo-suse

@aafeijoo-suse I will test this initrd extensively. An initrd may not be bootable if you remove certain files, it depends on your initrd, your use-case and how you define your modules. In my case I am not using any of these files, they are just dragged in as dependencies. A lot of these are also lying around for the scenario where you need to interactively debug, just in case.

ericcurtin avatar Sep 07 '23 09:09 ericcurtin

  • the generated initramfs is easily modifiable with cpio for some kind of "post processing"
  • you could call dracut with --no-compress --keep --tmpdir /tmp/dracut do the post processing and compress it yourself

Some of the files you want to exclude are already marked optional - e.g. https://github.com/dracutdevs/dracut/blob/master/modules.d/99base/module-setup.sh#L20 . I do wonder if dracut should have an option not to install optional files even if they are present in the host. The default should however stay as it is and continue to install optional dependencies. This option would also allow as us to pay closer attention to what is optional and what is not here upstream as well. As for this specific bug, it is a better plan to not include these files to begin with instead of removing them later.

Removing coreutils files will likely break initramfs. If this is really important for you, you can perhaps consider busybox dracut module as a replacement.

LaszloGombos avatar Sep 07 '23 12:09 LaszloGombos

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

stale[bot] avatar Jun 26 '25 19:06 stale[bot]