public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schlemmer <azarah@gentoo.org>
To: Ivan Gyurdiev <ivg2@cornell.edu>
Cc: "Robert L. Harris" <Robert.L.Harris@rdlg.net>,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.6-test1 startup messages?
Date: 21 Jul 2003 14:40:58 +0200	[thread overview]
Message-ID: <1058791258.5737.36.camel@workshop.saharacpt.lan> (raw)
In-Reply-To: <3F1AD2AA.9010603@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

On Sun, 2003-07-20 at 19:34, Ivan Gyurdiev wrote:
> Robert L. Harris wrote:
> > 
> >   I just converted a box to 2.6-test1.  I've installed the module-init-tools
> > per another thread on the list.  Spread throughout the startup messages
> > of the system (Debian Unstable) are messages that read:
> > 
> > FATAL: Module /dev/tts not found
> > FATAL: Module /dev/tts not found
> > FATAL: Module /dev/ttsS?? not found
> > FATAL: Module /dev/ttsS?? not found
> > 
> > looking at /dev/tty* I have /dev/tty, /dev/tty0-tty63.  There is no
> > /dev/ttyS0 (serial console) or tts*.
> >
> 
> Are you using devfs?
> I get the same messages with devfs.
> Looking up a /dev file that does not presently exist
> or have a corresponding module results in the above warnings.
> At boot time, on a redhat distro pam_console_apply tries to lookup
> the devices specified in /etc/security/console.perms, which causes a 
> zillion warnings for me. The question is - are those warnings to correct 
> way to handle a devfs lookup of a nonexisting device. I don't remember 
> getting warnings under 2.4. Maybe I did, and just didn't notice (but I 
> doubt it). They're certainly annoying and I don't like them.
> 

You could try the attached patch.  Rusty do not like it though =)


Regards,

-- 
Martin Schlemmer


[-- Attachment #2: module-init-tools-0.9.11-be-quiet-for-devfsd.patch --]
[-- Type: text/plain, Size: 4208 bytes --]

--- module-init-tools-0.9.11-pre/modprobe.c.orig	2003-03-16 22:32:46.000000000 +0200
+++ module-init-tools-0.9.11-pre/modprobe.c	2003-03-18 03:43:52.000000000 +0200
@@ -52,6 +52,8 @@ struct module {
 
 /* Do we use syslog or stderr for messages? */
 static int log;
+/* Should we be totally quiet? */
+static int quiet = 0;
 
 static int getlen(const char *fmt, va_list ap)
 {
@@ -70,6 +72,9 @@ static void message(const char *prefix, 
 	va_list arglist;
 	int len;
 
+	if (quiet)
+		return;
+
 	va_start(arglist, fmt);
 	len = strlen(prefix) + getlen(fmt, arglist) + 1;
 	buf = malloc(len);
@@ -87,7 +92,7 @@ static void message(const char *prefix, 
 
 #define warn(fmt, ...) message("WARNING: ", fmt , ## __VA_ARGS__)
 #define fatal(fmt, ...) \
-	do { message("FATAL: ", fmt , ## __VA_ARGS__); exit(1); } while(0)
+	do { message("FATAL: ", fmt , ## __VA_ARGS__);  if (quiet) exit(0); else exit(1); } while(0)
 
 static void grammar(const char *cmd, const char *filename, unsigned int line)
 {
@@ -1093,6 +1098,7 @@ static struct option options[] = { { "ve
 				   { "showconfig", 0, NULL, 'c' },
 				   { "autoclean", 0, NULL, 'k' },
 				   { "quiet", 0, NULL, 'q' },
+				   { "really-quiet", 0, NULL, 'Q' },
 				   { "show", 0, NULL, 'n' },
 				   { "dry-run", 0, NULL, 'n' },
 				   { "syslog", 0, NULL, 's' },
@@ -1108,6 +1114,7 @@ static struct option options[] = { { "ve
 				   { NULL, 0, NULL, 0 } };
 
 #define DEFAULT_CONFIG "/etc/modprobe.conf"
+#define MODPROBE_DEVFSD_CONF "/etc/modprobe.devfs"
 
 int main(int argc, char *argv[])
 {
@@ -1146,7 +1153,7 @@ int main(int argc, char *argv[])
 		try_old_version("modprobe", argv);
 
 	uname(&buf);
-	while ((opt = getopt_long(argc, argv, "vVC:o:rknqsclt:aif", options, NULL)) != -1){
+	while ((opt = getopt_long(argc, argv, "vVC:o:rknqQsclt:aif", options, NULL)) != -1){
 		switch (opt) {
 		case 'v':
 			add_to_env_var("-v");
@@ -1193,6 +1200,10 @@ int main(int argc, char *argv[])
 			add_to_env_var("-q");
 			fail_if_already = 0;
 			break;
+		case 'Q':
+			add_to_env_var("-Q");
+			quiet = 1;
+			break;
 		case 's':
 			add_to_env_var("-s");
 			log = 1;
@@ -1215,8 +1226,51 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	/* A hack to have absolutely no output if:
+	 *
+	 *   1) we have no logging enabled
+	 * 
+	 *   2) our config file is /etc/modprobe.devfs or /etc/modules.devfs
+	 *   
+	 *   3) with the module name starting with '/dev/'.
+	 *
+	 * Rasionale:  This is what modprobe from modutils-2.4.22 does:
+	 *
+	 *   gateway root # modprobe /dev/sd1   
+	 *   modprobe: Can't locate module /dev/sd1
+	 *   gateway root # modprobe -C /etc/modules.conf /dev/sd1
+	 *   modprobe: Can't locate module /dev/sd1
+	 *   gateway root # modprobe -C /etc/modules.devfs /dev/sd1
+	 *   gateway root #
+	 *   
+	 *   gateway root # modprobe foo     
+	 *   modprobe: Can't locate module foo
+	 *   gateway root # modprobe -C /etc/modules.conf foo     
+	 *   modprobe: Can't locate module foo
+	 *   gateway root # modprobe -C /etc/modules.devfs foo     
+	 *   modprobe: Can't locate module foo
+	 *   gateway root #
+	 *   
+	 *   gateway root # modprobe -C /etc/modules.devfs /dev/sd1 && echo yes
+	 *   yes
+	 *   gateway root # modprobe -C /etc/modules.devfs foo && echo yes
+	 *   modprobe: Can't locate module foo
+	 *   gateway root # 
+	 *   
+	 */
+	if (!log && !quiet && !dump_only && config) {
+		if (strncmp(argv[optind], "/dev/", 5) == 0
+				/* Handle recursive calls */
+			&& ((strcmp(MODPROBE_DEVFSD_CONF, config) == 0)
+				/* devfsd calls modprobe with '-C /etc/modules.devfs' */
+				|| (strcmp("/etc/modules.devfs", config) == 0))) {
+			add_to_env_var("-Q");
+			quiet = 1;
+		}
+	}
+
 	/* If stderr not open, go to syslog */
-	if (log || fstat(STDERR_FILENO, &statbuf) != 0) {
+	if (log || (!quiet && fstat(STDERR_FILENO, &statbuf) != 0)) {
 		openlog("modprobe", LOG_CONS, LOG_DAEMON);
 		log = 1;
 	}
@@ -1253,7 +1307,7 @@ int main(int argc, char *argv[])
 		if (strcmp("/etc/modules.conf", config) == 0)
 			config = NULL;
 		else if (strcmp("/etc/modules.devfs", config) == 0)
-			config = "/etc/modprobe.devfs";
+			config = MODPROBE_DEVFSD_CONF;
 	}
 
 	/* -r only allows certain restricted options */

      parent reply	other threads:[~2003-07-21 12:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-20 14:00 2.6-test1 startup messages? Robert L. Harris
2003-07-20 17:34 ` Ivan Gyurdiev
2003-07-20 20:01   ` Robert L. Harris
2003-07-20 20:22   ` Måns Rullgård
2003-07-21  2:42     ` Charles Lepple
2003-07-21  1:49       ` Ivan Gyurdiev
2003-07-21 12:40   ` Martin Schlemmer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1058791258.5737.36.camel@workshop.saharacpt.lan \
    --to=azarah@gentoo.org \
    --cc=Robert.L.Harris@rdlg.net \
    --cc=ivg2@cornell.edu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox