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-install: sane default --kerneldir #1505

Closed
marcosfrm opened this issue May 19, 2021 · 1 comment · Fixed by #1507
Closed

dracut-install: sane default --kerneldir #1505

marcosfrm opened this issue May 19, 2021 · 1 comment · Fixed by #1507
Labels
bug Our bugs

Comments

@marcosfrm
Copy link
Contributor

marcosfrm commented May 19, 2021

If --kerneldir is not specified, dracut-install will use kernel version (from uname -v) in the current directory (for example /root/#1 SMP PREEMPT Wed, 12 May 2021 17:54:18 +0000). Will never work...

If a patch like this is acceptable, I can make a PR:

diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c
index 9f044ae0..3fd70fc8 100644
--- a/src/install/dracut-install.c
+++ b/src/install/dracut-install.c
@@ -1167,7 +1167,10 @@ static int parse_argv(int argc, char *argv[])
         if (!kerneldir) {
                 struct utsname buf;
                 uname(&buf);
-                kerneldir = strdup(buf.version);
+                if (asprintf(&kerneldir, "%s%s", "/lib/modules/", buf.release) < 0) {
+                        log_error("Out of memory!");
+                        exit(EXIT_FAILURE);
+                }
         }

         if (arg_modalias) {

The default will be /lib/modules/$(uname -r).

@marcosfrm marcosfrm added the bug Our bugs label May 19, 2021
@haraldh
Copy link
Collaborator

haraldh commented May 20, 2021

Yes, open a PR :) Thanks!

johannbg pushed a commit that referenced this issue May 20, 2021
If --kerneldir is not specified, use /lib/modules/$(uname -r).

Fixes #1505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Our bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants