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

Add kdump dracut config #31

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Add kdump dracut config #31

merged 1 commit into from
Nov 26, 2024

Conversation

licliu
Copy link
Collaborator

@licliu licliu commented Aug 6, 2024

In some cases, we need to change dracut [omit_]dracutmodules to customize the first kernel's initrd to meet the needs, such as bootc and CoreOS.

In most cases kdump does not use these modules, but the change of [omit]_dracutmodules may break existing functionality. For example, if we set omit_dracutmodules='nfs', the nfs module cannot be added even if we use "dracut_args --force-add 'nfs'".

It is better to maintain its own dracut config for kdump. As the first try, we start by keeping [omit_]dracutmodules empty.

As a side effect, the default confdir "/etc/dracut.conf.d" will not work while generating kdump initrd.

And dracut can only use --confdir once, so "dracut_args --confidr" in /etc/kdump.conf will no longer work. This may be avoided in the future by adding something like "--extra-confdir" to dracut.

@licliu
Copy link
Collaborator Author

licliu commented Aug 6, 2024

related #29,#11

@daveyoung
Copy link
Contributor

daveyoung commented Aug 7, 2024

Hi Lichen, thanks for the patch, overall looks good to me. Since bootc will workaround the issue by itself. Maybe you can send a dracut patch about --extra-confdir? If dracut can merge it soon, we can go with a right solution once and for all instead of using --confdir temporarily

licliu added a commit to licliu/dracut-ng that referenced this pull request Aug 7, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from.

After that, kdump will use --extra-confdir /usr/lib/kdump/dracut.conf.d
to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
licliu added a commit to licliu/dracut-ng that referenced this pull request Aug 7, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from.

After that, kdump will use --extra-confdir /usr/lib/kdump/dracut.conf.d
to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
licliu added a commit to licliu/dracut-ng that referenced this pull request Aug 7, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from.

After that, kdump will use --extra-confdir /usr/lib/kdump/dracut.conf.d
to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
licliu added a commit to licliu/dracut-ng that referenced this pull request Aug 7, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from.

After that, kdump will use --extra-confdir /usr/lib/kdump/dracut.conf.d
to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
@licliu
Copy link
Collaborator Author

licliu commented Aug 7, 2024

@daveyoung I created a PR for dracut.
dracut-ng/dracut-ng#569

licliu added a commit to licliu/dracut-ng that referenced this pull request Sep 11, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from. If the dir not exists, will look for
confdir's subdir.

After that, kdump can use "--add-confdir kdump" if
/usr/lib/dracut/dracut.conf.d/kdump exists, to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
LaszloGombos pushed a commit to licliu/dracut-ng that referenced this pull request Sep 11, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from. If the dir not exists, will look for
confdir's subdir.

After that, kdump can use "--add-confdir kdump" if
/usr/lib/dracut/dracut.conf.d/kdump exists, to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
LaszloGombos pushed a commit to dracut-ng/dracut-ng that referenced this pull request Sep 11, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from. If the dir not exists, will look for
confdir's subdir.

After that, kdump can use "--add-confdir kdump" if
/usr/lib/dracut/dracut.conf.d/kdump exists, to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
Copy link
Contributor

@daveyoung daveyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Lichen, dracut merged the pr already, can you update this one?

@licliu
Copy link
Collaborator Author

licliu commented Sep 27, 2024

@daveyoung I think we need to update this patch after dracut-104 is released, otherwise it won't work because the current version of dracut doesn't recognize the --add-confdir option.

@daveyoung
Copy link
Contributor

@licliu good point, I thought that this is upstream instead of Fedora we can just assume using upstream latest dracut. But rethinking about it, dependencies need to be added in kdump-utils. For example, if dracut --help|grep "add-confdir" tell us it is supported then we can use the extra confdir, otherwise still use the old way. Otherwise it could be Fedora only in spec file to depend on dracut 104 and later. Thoughts?

BTW, maybe you can check with dracut team about the dracut 104 schedule plan.

@cgwalters
Copy link
Contributor

For example, if dracut --help|grep "add-confdir" tell us it is supported then we can use the extra confdir, otherwise still use the old way.

Dynamic detection sounds good to me.

Copy link
Contributor

@daveyoung daveyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Lichen,
" If --add-confdir is not
available in your system, kdump will use --confdir, in this case,
the default confdir "/etc/dracut.conf.d" will not work while
generating kdump initrd.", No, I think that we do not need to use --confdir here. The thing can be done like this:

if dracut support --add-confdir, then
use --add-confdir ;
modify mkdumprd:
dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' --aggressive-strip -o "plymouth resume ifcfg earlykdump")
move the args hardcode above to the 99-kdump.conf.
else
still keep the args in the mkdumprd code like before.

@licliu
Copy link
Collaborator Author

licliu commented Sep 29, 2024

@daveyoung Thanks, I will try that in the next version.

@licliu
Copy link
Collaborator Author

licliu commented Oct 11, 2024

This version I pushed was just a rebase with conflicts resolved, and is not ready for review yet.
GitHub seems unable to change PR status back to draft, sorry for the inconvenience. Please look forward to my next push.

@licliu
Copy link
Collaborator Author

licliu commented Oct 14, 2024

Hi @daveyoung, I pushed my latest changes just now. I found that dracutmodules variable cannot be override by dracut command line options, so I still use --confdir here.

@licliu licliu requested a review from daveyoung October 14, 2024 02:55
Copy link
Contributor

@daveyoung daveyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Lichen, it seems this new version still does not cover the previous suggestions. Also the patch description is not aligned with the code, eg. the omit module list is not empy according to the code. Anyway there might be some misunderstandings. I will try to ping you offline to explain about my suggestions. Thanks for reworking on this!

@pvalena
Copy link

pvalena commented Nov 20, 2024

FTR --force-add nfs should do what you want since redhat-plumbers/dracut-rhel10#18

@licliu
Copy link
Collaborator Author

licliu commented Nov 21, 2024

FTR --force-add nfs should do what you want since redhat-plumbers/dracut-rhel10#18

Thanks! Good to know that.

In some cases, customizing the first kernel's initrd is necessary by
modifying the dracut `omit_dracutmodules` options, such as in Bootc
or CoreOS scenarios [1]. However, these changes can unintentionally
break existing functionality in kdump. For instance, setting
`omit_dracutmodules='nfs'` prevents the `nfs` module from being added.

Additionally, some dracut configurations [2] use
`dracutmodules+='some modules'` instead of
`add_dracutmodules+='some modules'`. When `dracutmodules` is non-empty,
dracut includes only the specified modules, which can result in an
initrd that lacks necessary modules, causing kdump to fail.

Dracut upstream support --add-confdir now, kdump can use this
option when building kdump initramfs.

This patch moved the hardcoded dracutmodules from mkdumprd to the new
conf file /lib/kdump/dracut.conf.d/99-kdump.conf, it is easier to check
and modify to omit or add certain modules. This patch also initialize
dracutmodules to empty to avoid the influence of other configurations.

See also:
[1] rhkdump#11
[2] https://issues.redhat.com/browse/RHEL-49590?focusedId=25197134&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-25197134

Suggested-by: Dave Young <[email protected]>
Suggested-by: Colin Walters <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>
mkdumprd Outdated Show resolved Hide resolved
mkdumprd Outdated Show resolved Hide resolved
@daveyoung
Copy link
Contributor

daveyoung commented Nov 21, 2024

FTR --force-add nfs should do what you want since redhat-plumbers/dracut-rhel10#18

Hi Pavel, thanks for the info! This should be used as a workaround, eg. users can use this in kdump.conf dracut_args to force nfs working. But it is not good to use this in kdump scripts, because there might be other cases not only for nfs, also may need overwrite other things eg. omit modules etc. So I think we should still wait for the --add-confdir in dracut. Anyway it is fine that we suggest people to workaround the issue before dracut backport is ready.

@coiby coiby merged commit dacb343 into rhkdump:main Nov 26, 2024
4 of 5 checks passed
pvalena pushed a commit to pvalena/dracut-rhel9 that referenced this pull request Nov 27, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from. If the dir not exists, will look for
confdir's subdir.

After that, kdump can use "--add-confdir kdump" if
/usr/lib/dracut/dracut.conf.d/kdump exists, to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>

(cherry picked from commit ae81535037c42b716d8cbb9dc18942b5c6f16fed)

Resolves: RHEL-66582
pvalena pushed a commit to redhat-plumbers/dracut-rhel9 that referenced this pull request Nov 27, 2024
When generating kdump's initrd, we want to keep [omit_]dracutmodules
empty and let kdump to handle the modules. And we don't want to
affect the first kernel's initrd, so we cannot place our conf file
to /etc/dracut.conf.d or /usr/lib/dracut/dracut.conf.d.

This patch adds a new option to allow user to add an extra configuration
directory to use *.conf files from. If the dir not exists, will look for
confdir's subdir.

After that, kdump can use "--add-confdir kdump" if
/usr/lib/dracut/dracut.conf.d/kdump exists, to apply its own dracut conf.

See also:
rhkdump/kdump-utils#11
rhkdump/kdump-utils#31

Suggested-by: Dave Young <[email protected]>
Signed-off-by: Lichen Liu <[email protected]>

(cherry picked from commit ae81535037c42b716d8cbb9dc18942b5c6f16fed)

Resolves: RHEL-66582
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kdump should auto-add required modules if they are missing from host initrd
5 participants