Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple source for dracut configuration directory #2210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sshedi
Copy link
Contributor

@sshedi sshedi commented Feb 18, 2023

This pull request changes...

Changes

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

Fixes #

@sshedi sshedi changed the title Multiple confs Multiple source for dracut configuration directory and conf files Feb 18, 2023
@dtardon
Copy link
Contributor

dtardon commented Feb 20, 2023

Out of curiosity: what's the use case for this?

@sshedi
Copy link
Contributor Author

sshedi commented Feb 20, 2023

Let's say we have a config file fips.conf which is at /etc/dracut.conf.d and kernel has it's own set of configs unde /lib/modules/<version>/dracut.conf.d/kernel.conf

And it is possible to have more than one flavor of kernel, like realtime, generic, secure etc.

While creating initrd I need a way to include kernel's own custom config from modules directory and fips.conf from default location. Meaning, I want fips configs to be included in all flavors along with kernel's own custom configs.

With this change I can do:

dracut --confdir "/etc/dracut.conf.d /lib/modules/<ver>/dracut.conf.d" ...

Now dracut consumes configs from both locations, fips.conf is a common config for all kernel flavors in this example, so I want to maintain a single copy of it.

Same applies for config files.

So, thought of making this change and keeping it generic, users can specify any number of config files and locations to consume configs from. Hope this is a valid case. If there is any other way to do it, please let me know.

@johannbg
Copy link
Collaborator

I dont see a valid usecase to support this

@sshedi
Copy link
Contributor Author

sshedi commented Feb 22, 2023

I dont see a valid usecase to support this

I will try to explain it wrt to our system (Photon OS 3.0)

We have a fipsify package https://github.com/vmware/photon/blob/3.0/SPECS/fipsify/fipsify.spec#L37

This creates a conf file under /etc/dracut.conf.d and the fips modules should be a part of all kernel flavors present in the system.

And each kernel provides it's own drivers list and the list is unique.
https://github.com/vmware/photon/blob/3.0/SPECS/linux/linux.spec#L927
https://github.com/vmware/photon/blob/3.0/SPECS/linux/linux-secure.spec#L433

Currently we are using a work around to get this done.

Now I'm trying to create a conf file for each kernel under <modules-dir>/dracut.conf.d and trying to include both fips conf (common to all flavors) and kernel conf of individual kernel from modules dir while creating initrd of the specific kernel.

If I keep everything under /etc/dracut.conf.d all the configs will be included at once and will result in wrong driver list.

So, it should be possible to use multiple config dirs while creating initrd. Please let me know if there is any other way to achieve this.

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Feb 22, 2023

Strictly speaking, it seems to me that your use case does not need changes to--conf, it only needs changes to --confdir . Can you please confirm ? Did you change --conf just for completeness ?

@sshedi
Copy link
Contributor Author

sshedi commented Feb 22, 2023

Strictly speaking, it seems to me that your use case does not need changes to--conf, it only needs changes to --confdir . Can you please confirm ? Did you change --conf just for completeness ?

Yes

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Feb 22, 2023

I am open to consider this change, but only for directory argument and not for conf files.

I think conf file argument is somewhat confusing and we should not improve it or add complexity to it. See also #1974

We already have 10+ arguments that take a list instead of a single entry. This is a niche use case but it is also a low risk, low maintenance and small change.

I think having support for conf dir under /etc and /usr and /run is reasonable - which would require supporting more than one dir for config.

@LaszloGombos LaszloGombos added the enhancement Issue adding new functionality label Feb 22, 2023
@aafeijoo-suse
Copy link
Member

I don't see the need for this change either. If a package wants to add its own custom dracut configuration, it can create the .conf files under /etc/dracut.conf.d, as many packages are doing nowadays.

@sshedi
Copy link
Contributor Author

sshedi commented Mar 8, 2023

I am open to consider this change, but only for directory argument and not for conf files.

I think conf file argument is somewhat confusing and we should not improve it or add complexity to it. See also #1974

We already have 10+ arguments that take a list instead of a single entry. This is a niche use case but it is also a low risk, low maintenance and small change.

I think having support for conf dir under /etc and /usr and /run is reasonable - which would require supporting more than one dir for config.

Agreed. Having support for multiple conf dirs & files is redundant. Dropped the multiple conf file change. Thanks.

Configuration can come from many places, users should not be restricted
to keep all configuration files in one directory.

Signed-off-by: Shreenidhi Shedi <[email protected]>
@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Apr 3, 2023

While creating initrd I need a way to include kernel's own custom config from modules directory and fips.conf from default location.

I have not tried this, but can you just symlink /usr/lib/dracut/dracut.conf.d to /lib/modules//dracut.conf.d for your use case (for the current kernel) ? Before considering this PR, we should understand if there is a possibility to work around it (even if not convenient) .

@sshedi
Copy link
Contributor Author

sshedi commented Apr 4, 2023

What if user already has some conf files under /usr/lib/dracut/dracut.conf.d and want's those configs to take effect during initrd creation?

@sshedi sshedi changed the title Multiple source for dracut configuration directory and conf files Multiple source for dracut configuration directories Apr 14, 2023
@sshedi sshedi changed the title Multiple source for dracut configuration directories Multiple source for dracut configuration directory Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue adding new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants