Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2002 18:22:00 -0800
From:      "Crist J. Clark" <crist.clark@attbi.com>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/etc rc src/share/man/man5 rc.conf.5
Message-ID:  <20020311182200.D29705@blossom.cjclark.org>
In-Reply-To: <xzpeliq4x6e.fsf@flood.ping.uio.no>; from des@ofug.org on Mon, Mar 11, 2002 at 10:22:17PM %2B0100
References:  <200203110847.g2B8l4714026@freefall.freebsd.org> <xzpeliq4x6e.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 11, 2002 at 10:22:17PM +0100, Dag-Erling Smorgrav wrote:
> "Crist J. Clark" <cjc@FreeBSD.org> writes:
> >   At the same time, allow the administrator to have dumpdev enabled
> >   while dumpdir (savecore(8)) is disabled and document how to do it.
> 
> Speaking of dumpdev, 'dumpon ${dumpdev}' should be one of the very
> very first things we do in /etc/rc, before even fsck - it's not
> uncommon for kernel bugs to cause panics during the boot process, and
> it's a PITA not to have a dump device configured in time.

Makes sense. How about doing it first thing after we load the rc.conf
files? In addition, take out the checks on the $dumpdev. dumpon(8)
behaves well if given a non-existent filename. It gives a nice error
message which is better rather than the current silent failure.
Likewise, we can take out the remaining safety net for the savecore(8)
run; it doesn't need hand-holding. Let misconfigured setups produce
error messages.

Index: etc/rc
===================================================================
RCS file: /export/freebsd/ncvs/src/etc/rc,v
retrieving revision 1.296
diff -u -r1.296 rc
--- etc/rc	17 Feb 2002 22:19:14 -0000	1.296
+++ etc/rc	12 Mar 2002 02:12:02 -0000
@@ -108,6 +108,15 @@
 chkdepend NIS nis_server_enable portmap portmap_enable
 chkdepend NIS nis_client_enable portmap portmap_enable
 
+# Enable dumpdev early so that a crash during the boot process can be caught.
+#
+case ${dumpdev} in
+[Nn][Oo] | '')
+	;;
+*)
+	/sbin/dumpon -v ${dumpdev}
+esac
+
 # Enable harvesting of entropy via devices.  The sooner this happens the
 # better so that we can take advantage of the boot process.
 #
@@ -540,27 +549,23 @@
 	dev_mkdb
 fi
 
-# Enable dumpdev so that savecore can see it.
-# /var/crash should be a directory or a symbolic link
+# $dumpdir should be a directory or a symbolic link
 # to the crash directory if core dumps are to be saved.
 #
-case ${dumpdev} in
-[Nn][Oo] | '')
+case ${dumpdir} in
+'')
+	dumpdir='/var/crash'
 	;;
-*)
-	case ${dumpdir} in
-	'')
-		dumpdir='/var/crash'
-		;;
-	esac
-
-	if [ -e "${dumpdev}" -a -d "${dumpdir}" ]; then
-		/sbin/dumpon -v ${dumpdev}
-		echo -n 'Checking for core dump: '
-		/sbin/savecore ${savecore_flags} "${dumpdir}"
-	fi
+[Nn][Oo])
+	dumpdir='NO'
 	;;
 esac
+
+if [ "$dumpdir" != 'NO' ]; then
+	echo -n 'Checking for core dump: '
+	/sbin/savecore ${savecore_flags} "${dumpdir}"
+fi
+
 
 if [ -n "${network_pass1_done}" ]; then
 	network_pass2

-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020311182200.D29705>