[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#679571: "modprobe: no module unix found in modules.dep"



On Sun, 2012-07-22 at 11:15 +0400, Michael Tokarev wrote:
> forwarded 679571 https://bugs.busybox.net/show_bug.cgi?id=5270
> thanks
> 
> On 22.07.2012 10:11, Ben Hutchings wrote:
> []
> > I've been meaning to fix this for a while.  It seems to be a bug in the
> > minimal implementation of modprobe used in the initramfs, part of
> > 'busybox'.  I'm attaching a patch that seems to do the right thing,
> > which I hope the busybox maintainer will apply.
> 
> Thank you Ben for the patch.  I've been, well, waiting for the upstream
> to show any reaction for https://bugs.busybox.net/show_bug.cgi?id=5270
> (for which I forgot to set "forwarded", doing it now), and basically
> forgot about this stuff (since I still can't use debian initramfs I
> don't see this message on every boot myself).
> 
> Your patch isn't exactly sufficient, -- well, the behavour should now
> match m-i-t/kmod as modprobe wont return error when asked to load a
> built-in module anymore, but it will still error out with --first-time

The --first-time option isn't implemented in busybox 1.20.0.

> (which should ignore loaded modules but not built-ins), and it will
> emit somewhat unclear error message when asked to _remove_ a built-in
> module.  Maybe that's all just cosmetics, but these cosmetics are so
> easy to fix already... :)

OK, attaching a new patch that does that as well.

> But anyway.  I agree this needs to be fixed in busybox for sure.  But
> do we really need this `modprobe unix' in the first place?  It's been
> many years since this isn't needed for debian kernels, and it is
> difficult to imagine a custom kernel with unix.ko as a module.  I
> had such a config for a while, but it gave me quite a few headaches
> already, so I changed from unix=m to unix=y.  And 3rd, I'm not sure
> AF_UNIX is really needed for initramfs itself anymore - the module
> autoloads just fine on first access, when udev creates its first
> unix socket.
> 
> So I'd say this 'modprobe unix' should be removed from udev hook.
> (Cc'ing Md for this).

It could and should, but that's kind of a workaround for the deficiency
in busybox.  The same problem will occur for other potential modules
that are built-in in a custom kernel but explicitly loaded by userland.

Ben.

-- 
Ben Hutchings
73.46% of all statistics are made up.
From: Ben Hutchings <ben@decadent.org.uk>
Subject: modprobe: Read modules.builtin
Bug-Debian: http://bugs.debian.org/679571

This allows explicit probing to succeed when the requested module
is actually built-in, and corrects the error message for removal.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -146,6 +146,7 @@ static const char modprobe_longopts[] AL
 /* "was seen in modules.dep": */
 #define MODULE_FLAG_FOUND_IN_MODDEP     0x0004
 #define MODULE_FLAG_BLACKLISTED         0x0008
+#define MODULE_FLAG_BUILTIN             0x0010
 
 struct module_entry { /* I'll call it ME. */
 	unsigned flags;
@@ -240,7 +241,7 @@ static void add_probe(const char *name)
 
 	m = get_or_add_modentry(name);
 	if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS))
-	 && (m->flags & MODULE_FLAG_LOADED)
+	 && (m->flags & (MODULE_FLAG_LOADED | MODULE_FLAG_BUILTIN))
 	) {
 		DBG("skipping %s, it is already loaded", name);
 		return;
@@ -394,8 +395,10 @@ static int do_modprobe(struct module_ent
 
 	if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
 		if (!(option_mask32 & INSMOD_OPT_SILENT))
-			bb_error_msg("module %s not found in modules.dep",
-				humanly_readable_name(m));
+			bb_error_msg((m->flags & MODULE_FLAG_BUILTIN) ?
+				     "module %s is builtin" :
+				     "module %s not found in modules.dep",
+				     humanly_readable_name(m));
 		return -ENOENT;
 	}
 	DBG("do_modprob'ing %s", m->modname);
@@ -595,6 +598,11 @@ int modprobe_main(int argc UNUSED_PARAM,
 		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY))
 			get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED;
 		config_close(parser);
+
+		parser = config_open2("modules.builtin", fopen_for_read);
+		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
+			get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
+		config_close(parser);
 	}
 
 	if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) {

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: