fix(dracut): install items after including modules - #2511
Conversation
|
In my mental model, dracut invocation command line options have higher priority than built-in dracut module logic. In other words, in case of a conflict, command line should overrule dracut module, and not the other way around. This PR appears to make an exception for this mental model for the |
|
Dracut invocation command line options have higher priority than config file settings. In my mental model, |
I think This PR by definition is a compatibility break, probably best to highlight it.
What I meant is that command line arguments like |
Users or distributions might request installing additional binaries (like `cat` or `rm`) via `--install` or `--install-optional`. These binaries could be provided by different projects (like coreutils or busybox). Installing those files before including the modules will enforce specific implementations (e.g. use `cat` from coreutils instead of busybox). Install those files after including the modules to allow the modules (like `busybox`) to pick an implementation. For example: If dracut is called with `--install cat` and busybox includes the `cat` applet, the `inst_multiple -o cat` will become a no-op.
I checked the code and
I created #2513 for tracking what we should mention in the release notes. |
This would then imply that dracut was already inconsistent and there is no good mental model established between dracut module ordering and command line ordering when there is a conflict. One could argue that this PR makes dracut more consistent. I was hoping we could use this PR as a motivation to establish and document a new reasonable mental model if there is not one. Would the following work as a mental model going forward, that we could add to the documentation as well not just to the release notes ? Command line arguments (and corresponding configuration presets) |
|
Based on my experience, @aafeijoo-suse has a great eye for compatibility risk. @aafeijoo-suse can you help review this PR ? Thanks ! |
|
Counterpoint for this PR from Claude
|
|
Yes, this change is very dangerous... it may not affect Ubuntu because it recently adopted dracut, but it will certainly have side effects. |
|
Hm, so we want users to be able to enforce including stuff at the beginning. What does Fedora want to do in dracut.conf.d/fedora/01-dist.conf with: My understanding is that they want to have those binaries, but do not care about the implementation. |
Just recently there is some discussion on this, I hope it is not completly off-topic -
|
pvalena
left a comment
There was a problem hiding this comment.
IMHO this proposed change might not addresses the issue the right way -- I think inst_* should just instead of copying just do a lazy install -- create a 'list' of intems to copy later (and the relevant sources) -- and only after everything is prepared (from modules and other sources), the transaction is made, incl. the dependency chain.
This would avoid the issue by simply rewriting the original source (for install) by a new one for particular destination. The behavior is similar to DRACUT_RESOLVE_LAZY, but for main install item instead.
(And if we want to preserve the original behavior we just skip updating the source for the items in the list; we could even have this as an option.)
But this completely changes the behavior of what gets to be kept in the initrd (currently nothing never get overwritten AFAIU).
In any case this situation is just a variant of a dillema -- users have configs, which should probably have precedence, but it seems in some cases it "might be better" to override it from a module (as this PR intends); but how can we tell which is case is it?
In the same way, I might want to install a specific binary from a specific path, and I'd like the option/arg/config to take precedence over what any module wants to install.
| # FIXME: handle legacy item split | ||
| # shellcheck disable=SC2068 | ||
| ((${#install_items[@]} > 0)) && inst_multiple ${install_items[@]} | ||
| # shellcheck disable=SC2068 | ||
| ((${#install_optional_items[@]} > 0)) && inst_multiple -o ${install_optional_items[@]} |
There was a problem hiding this comment.
It's also moved inside if [[ $kernel_only != yes ]]; then ... so it gets ignored completely on kernel-only?
Users or distributions might request installing additional binaries (like
catorrm) via--installor--install-optional. These binaries could be provided by different projects (like coreutils or busybox). Installing those files before including the modules will enforce specific implementations (e.g. usecatfrom coreutils instead of busybox).Install those files after including the modules to allow the modules (like
busybox) to pick an implementation. For example: If dracut is called with--install catand busybox includes thecatapplet, theinst_multiple -o catwill become a no-op.Checklist