Hi all,

I think the problem is that modprobe looks for the module (which in this
case is aliased as "off") in /sys and raises an error if it doesn't find
it (there's no such thing as an "off" module in /sys).

In the attached patch I check that the module name is not "off" or
"null" before doing assert(kmod_module_get_initstate(m) ==
KMOD_MODULE_BUILTIN).

This solves the problem on my systems.

Please review my patch and let me know if there's anything you'd like me
to change.

Thanks,

-- 
Alberto Milone
Software Engineer
Hardware Enablement Team
Professional and Engineering Services
>From d5d78c148ffabd9751caa06054612cf29e5d284c Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.mil...@canonical.com>
Date: Wed, 13 Mar 2013 14:11:03 +0100
Subject: [PATCH 1/1] tools/modprobe.c: look for the modules in /sys only if
 they are not null

This makes sure that we don't raise an error if we deal with the
following entries:

alias $module_name off
alias $module_name null

Signed-off-by: Alberto Milone <alberto.mil...@canonical.com>
---
 tools/modprobe.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/modprobe.c b/tools/modprobe.c
index b108112..3509d67 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -34,6 +34,7 @@
 
 #include "libkmod.h"
 #include "libkmod-array.h"
+#include "libkmod-util.h"
 #include "macro.h"
 
 static int log_priority = LOG_CRIT;
@@ -537,6 +538,7 @@ static void print_action(struct kmod_module *m, bool install,
 							const char *options)
 {
 	const char *path;
+	const char *name;
 
 	if (install) {
 		printf("install %s %s\n", kmod_module_get_install_commands(m),
@@ -545,10 +547,14 @@ static void print_action(struct kmod_module *m, bool install,
 	}
 
 	path = kmod_module_get_path(m);
+	name = kmod_module_get_name(m);
 
 	if (path == NULL) {
-		assert(kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN);
-		printf("builtin %s\n", kmod_module_get_name(m));
+		/* Look for the modules in /sys only if they are not null */
+		if (name && !streq(name, "off") && !streq(name, "null")) {
+			assert(kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN);
+		}
+		printf("builtin %s\n", name);
 	} else
 		printf("insmod %s %s\n", kmod_module_get_path(m), options);
 }
-- 
1.7.9.5

Reply via email to