NetBSD Problem Report #41946

From jmcneill@endeavour.invisible.ca  Thu Aug 27 00:34:17 2009
Return-Path: <jmcneill@endeavour.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 5863363B121
	for <gnats-bugs@gnats.netbsd.org>; Thu, 27 Aug 2009 00:34:17 +0000 (UTC)
Message-Id: <20090827003301.40BFB13153@endeavour.invisible.ca>
Date: Wed, 26 Aug 2009 20:33:00 -0400 (EDT)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: rc.d should honour AB_SILENT
X-Send-Pr-Version: 3.95

>Number:         41946
>Category:       bin
>Synopsis:       rc.d should honour AB_SILENT
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    apb
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 27 00:35:00 +0000 2009
>Closed-Date:    Fri Feb 03 09:11:10 +0000 2012
>Last-Modified:  Fri Feb 03 09:11:10 +0000 2012
>Originator:     Jared D. McNeill
>Release:        NetBSD 5.0
>Organization:

>Environment:


System: NetBSD endeavour.invisible.ca 5.0 NetBSD 5.0 (GENERIC) #0: Sun Apr 26 18:50:08 UTC 2009 builds@b6.netbsd.org:/home/builds/ab/netbsd-5-0-RELEASE/i386/200904260229Z-obj/home/builds/ab/netbsd-5-0-RELEASE/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386

>Description:
	Setting AB_SILENT (boot -z) doesn't keep rc.d scripts quiet.
>How-To-Repeat:

>Fix:
	Capture all messages to a log file in /var, and make rc.d twiddle
	like the kernel does when booting with AB_SILENT. If any output on
	stderr is captured, report that at least one system service reported
	an error at startup and to reference the log file for more information.

>Release-Note:

>Audit-Trail:
From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/41946: rc.d should honour AB_SILENT
Date: Mon, 31 Aug 2009 08:59:44 +0200

 On Thu, 27 Aug 2009, jmcneill@invisible.ca wrote:
 > 	Capture all messages to a log file in /var, and make rc.d twiddle
 > 	like the kernel does when booting with AB_SILENT. If any output on
 > 	stderr is captured, report that at least one system service reported
 > 	an error at startup and to reference the log file for more information.

 I am working on this.  My plan is:

   1) expose the kernel's boothowto variable through sysctl kern.boothowto
      (done);
   2) teach rc.subr to parse the sysctl output to set several shell
      variables to record which bits are on or off (done);
   3) add a twiddle function to rc.subr (done);
   4) make rc and/or rc.subr DTRT for the remainder of the problem
      (in progress).

 The last step is tricky because there may be no writable file
 systems early in the boot, both /var/run and /tmp may be erased by
 rc.d scripts during the boot, and /usr/bin/tee is not available
 early in the boot.  Also, I can't easily keep stdout and stderr
 separate, so I am using the script's exit status (not the presence
 or absence of output on stderr) to detect errors.  I have it mostly
 working for the AB_SILENT case, but not for the non-silent case
 (which needs tee-like functionality).

 Here's the tail end of my current /var/run/rc.log:

     [/etc/rc.d/autoswc]
     make: cannot open /usr/pkg/share/autoswc/autoswc.mk.
     [/etc/rc.d/asterisk]
     [/etc/rc.d/apache]
     The following scripts returned error status:
 	/etc/rc.d/mountcritremote /etc/rc.d/chronyd /etc/rc.d/bacula-sd
     /etc/rc finished at Mon Aug 31 06:21:56 UTC 2009

 The things in square brackets appear only in the log file.  The
 normal text appears on the console as well as in the log file in
 normal mode, but in silent mode the console gets a twiddle instead
 of the normal text.  The error summary at the end appears on the
 console even in silent mode.

 --apb (Alan Barrett)

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	jmcneill@invisible.ca
Cc: 
Subject: Re: bin/41946: rc.d should honour AB_SILENT
Date: Mon, 31 Aug 2009 10:18:18 -0400

 On Aug 31,  7:00am, apb@cequrux.com (Alan Barrett) wrote:
 -- Subject: Re: bin/41946: rc.d should honour AB_SILENT

 |  The last step is tricky because there may be no writable file
 |  systems early in the boot, both /var/run and /tmp may be erased by
 |  rc.d scripts during the boot, and /usr/bin/tee is not available
 |  early in the boot.  Also, I can't easily keep stdout and stderr
 |  separate, so I am using the script's exit status (not the presence
 |  or absence of output on stderr) to detect errors.  I have it mostly
 |  working for the AB_SILENT case, but not for the non-silent case
 |  (which needs tee-like functionality).

 Andrew [@@@] was talking about using sysctl variable space as scratch
 space during boot.

 christos

Responsible-Changed-From-To: bin-bug-people->apb
Responsible-Changed-By: apb@NetBSD.org
Responsible-Changed-When: Sun, 06 Sep 2009 07:31:16 +0000
Responsible-Changed-Why:
I posted a patch, waiting for comments on tech-userlevel.


From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41946 CVS commit: src
Date: Fri, 11 Sep 2009 18:14:58 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Sep 11 18:14:58 UTC 2009

 Modified Files:
 	src/doc: CHANGES
 	src/share/man/man7: sysctl.7
 	src/share/man/man9: boothowto.9
 	src/sys/kern: init_sysctl.c

 Log Message:
 Expose the kernel's boothowto(9) variable through the sysctl
 kern.boothowto variable.

 Part of the /etc/rc silent changes requested in PR 41946
 and proposed in tech-userlevel.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1286 -r1.1287 src/doc/CHANGES
 cvs rdiff -u -r1.22 -r1.23 src/share/man/man7/sysctl.7
 cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/boothowto.9
 cvs rdiff -u -r1.165 -r1.166 src/sys/kern/init_sysctl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41946 CVS commit: src
Date: Fri, 11 Sep 2009 18:17:05 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Sep 11 18:17:04 UTC 2009

 Modified Files:
 	src/doc: CHANGES
 	src/etc: rc rc.subr
 	src/etc/defaults: rc.conf
 	src/share/man/man5: rc.conf.5
 	src/share/man/man8: rc.8 rc.subr.8

 Log Message:
 Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
 and which can suppress output in silent mode.  Silent mode is enabled
 via the new rc_silent variable, which defaults to a value that depends
 on the kern.boothowto sysctl.

 Part of the /etc/rc silent changes requested in PR 41946
 and proposed in tech-userlevel.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1287 -r1.1288 src/doc/CHANGES
 cvs rdiff -u -r1.163 -r1.164 src/etc/rc
 cvs rdiff -u -r1.77 -r1.78 src/etc/rc.subr
 cvs rdiff -u -r1.104 -r1.105 src/etc/defaults/rc.conf
 cvs rdiff -u -r1.132 -r1.133 src/share/man/man5/rc.conf.5
 cvs rdiff -u -r1.31 -r1.32 src/share/man/man8/rc.8
 cvs rdiff -u -r1.22 -r1.23 src/share/man/man8/rc.subr.8

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41946 CVS commit: src/etc/rc.d
Date: Fri, 11 Sep 2009 18:17:43 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Sep 11 18:17:43 UTC 2009

 Modified Files:
 	src/etc/rc.d: bootconf.sh

 Log Message:
 Adapt /etc/rc.d/bootconf.sh script to the new /etc/rc:
 Add "KEYWORD: interactive" so that the script's prompts work,
 and use rc_print_metadata to add a message to the log.

 Part of the /etc/rc silent changes requested in PR 41946
 and proposed in tech-userlevel.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/etc/rc.d/bootconf.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41946 CVS commit: src/etc/rc.d
Date: Fri, 11 Sep 2009 18:18:03 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Sep 11 18:18:03 UTC 2009

 Modified Files:
 	src/etc/rc.d: cgd

 Log Message:
 Adapt /etc/rc.d/cgd script to the new /etc/rc:
 Add "KEYWORD: interactive" so that prompting for passwords work, and
 use print_rc_normal to print a message that could safely be suppressed.

 Part of the /etc/rc silent changes requested in PR 41946
 and proposed in tech-userlevel.


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/etc/rc.d/cgd

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: apb@NetBSD.org
State-Changed-When: Fri, 03 Feb 2012 09:11:10 +0000
State-Changed-Why:
New feature was committed on 2009-09-11


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.