dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
597 stars 396 forks source link

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

Open ericcurtin opened 12 months ago

ericcurtin commented 12 months ago

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?

aafeijoo-suse commented 11 months ago

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...

ericcurtin commented 11 months ago

@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.

LaszloGombos commented 11 months ago

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.