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

Dracut complains that --kmoddir /lib/modules/... doesn't have "/lib/modules" as a parent directory. #1608

Closed
nettyso opened this issue Sep 18, 2021 · 2 comments · Fixed by #2025
Labels
enhancement Issue adding new functionality

Comments

@nettyso
Copy link

nettyso commented Sep 18, 2021

Describe the bug
Dracut doesn't see /lib/modules/ in the kmoddir and complains, but it is infact there in the path.

Distribution used
Arch (updated today)

Dracut version
055

Init system
systemd 249 (249.4-1-arch)

To Reproduce

> sudo dracut --kernel-image /boot/vmlinuz-linux --kmoddir /lib/modules/5.14.5-arch1-1/
dracut: -k/--kmoddir path must contain "lib/modules" as a parent of your kernel module directory,
dracut: or modules may not be placed in the correct location inside the initramfs.
dracut: was given: /lib/modules/5.14.5-arch1-1/
dracut: expected: /lib/modules/lib/modules/5.13.5-arch1-1
dracut: Please move your modules into the correct directory structure and pass the new location,
dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check.

Expected behavior
Typing a kmoddir that includes "lib/modules" should be accepted and not duplicate into "lib/modules/lib/modules"

Additional context
I upgraded to the latest kernel and have not yet rebooted the system. I'd like to gen an initramfs before rebooting. I wonder if dracut is confused because I'm telling it to build an image for 5.14 but am running 5.13...

@nettyso nettyso added the bug Our bugs label Sep 18, 2021
@nettyso
Copy link
Author

nettyso commented Sep 18, 2021

This bug is primarily an issue with the error message. It should say that dracut is explicitly looking for a 5.13 module directory because the active kernel is 5.13, despite being told explicit --kernel-image and --kmoddir flags.

It would be more useful to say:

dracut: The provided kernel image version is 5.14.5 which does not match the actively running 5.13.5 kernel. To build
dracut: an initramfs for this version use `--kver 5.14.5` as an argument.

Or something. This kind of advise could cause other confusion, so I'll defer to those who are more familiar with the nuances of mixing kernel/module versions

@jiayi0118
Copy link

jiayi0118 commented Sep 5, 2022

dracut only recognizes the path to the /lib/modules directory that matches the active kernel version, otherwise it will regard the kmoddir as a subdirectory under /lib/modules/$(uname) and try to find it.

The warning message seems confusing and is expected to be improved.

@LaszloGombos LaszloGombos added enhancement Issue adding new functionality and removed bug Our bugs labels Oct 25, 2022
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Oct 27, 2022
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules" or "lib/modulesxxx".

Fixes issue dracutdevs#1608
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Oct 27, 2022
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules" or "lib/modulesxxx".

Fixes issue dracutdevs#1608
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Oct 27, 2022
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules" or "lib/modulesxxx".

Fixes issue dracutdevs#1608
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Oct 27, 2022
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules".

Fixes issue dracutdevs#1608
johannbg pushed a commit that referenced this issue Dec 21, 2022
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules".

Fixes issue #1608
pvalena pushed a commit to pvalena/dracut that referenced this issue Jul 23, 2023
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules".

Fixes issue dracutdevs#1608
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 a pull request may close this issue.

3 participants