[PATCH 2/4] modprobe: Add appropriate error message when path is missing
From: Laura Abbott <hidden>
Date: 2015-09-11 20:55:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Laura Abbott <hidden>
Date: 2015-09-11 20:55:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
Currently, modprobe fails with no output by default if the search paths it tries are missing: $ modprobe -S notakernel dm-crypt $ $ modprobe -S notakernel lkjjweiojo $ This is fairly cryptic and not at all obvious there is a problem unless the error code is checked or verbose flags are used. Add a message to give a better idea that something went wrong. --- tools/modprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 3ba8f52..b50a385 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c@@ -489,8 +489,11 @@ static int insmod(struct kmod_ctx *ctx, const char *alias, const char *options) = NULL; err = kmod_module_new_from_lookup(ctx, alias, &list); - if (err < 0) + if (err < 0) { + ERR("Could not generate list of modules from context\n"); + ERR("(Is your version correct)?)\n"); return err; + } if (list == NULL) { LOG("Module %s not found.\n", alias);
--
2.4.3