Subject: bin/4546: rc.conf's critical_filesystems is overly restrictive.
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@sometimes.weird.com>
List: netbsd-bugs
Date: 11/19/1997 20:33:00
>Number:         4546
>Category:       bin
>Synopsis:       rc.conf's critical_filesystems is overly restrictive.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 19 17:35:00 1997
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        1997/11/12
>Environment:

System: NetBSD sometimes 1.3_ALPHA NetBSD 1.3_ALPHA (WEIGHT) #0: Mon Nov 17 23:09:01 EST 1997 root@weight:/local1/src/netbsd-current/src/sys/arch/sun3/compile/WEIGHT sun3

>Description:
The critical_filesystems setting in /etc/rc.conf should not hide the
inclusion of /usr and /var from the administrator but should include
them explicitly if and only if they are required.

In addition the standard output and error streams from mount commands
should not be thrown away in /etc/rc.

Even though it seems safe to ignore errors from mount for these instances
it can be confusing and misleading to do so.

I personally also believe the '-v' flag should be used in all boot-time
mount and umount commands, though with the recent excessive verbiage of
'mount -v' this may annoy more people than it helps....

>How-To-Repeat:
Build a system with only one filesystem and take away the i/o redirection
on the mount commands in /etc/rc to debug some NFS problems, and get
annoyed by the misleading error messages.
>Fix:

Index: src/etc/rc
*** rc-1.3A	Thu Nov 13 02:56:17 1997
--- rc	Wed Nov 19 20:16:48 1997
***************
*** 63,70 ****
  
  trap "echo 'Boot interrupted.'; exit 1" 3
  
! umount -a >/dev/null 2>&1
! mount /
  rm -f /fastboot		# XXX (root now writeable)
  
  if [ -f /etc/rc.subr ]; then
--- 63,70 ----
  
  trap "echo 'Boot interrupted.'; exit 1" 3
  
! umount -a >/dev/null 2>&1
! mount /
  rm -f /fastboot		# XXX (root now writeable)
  
  if [ -f /etc/rc.subr ]; then
***************
*** 90,96 ****
  # load kernel modules specified in /etc/lkm.conf if the /usr filesystem
  # is already present with "/" or can be mounted now
  if checkyesno lkm && [ -f /etc/rc.lkm ]; then
! 	mount /usr >/dev/null 2>&1
  	if [ -x /usr/bin/ld ]; then
  		lkmstage=BEFORENET
  		. /etc/rc.lkm
--- 90,96 ----
  # load kernel modules specified in /etc/lkm.conf if the /usr filesystem
  # is already present with "/" or can be mounted now
  if checkyesno lkm && [ -f /etc/rc.lkm ]; then
! 	mount /usr
  	if [ -x /usr/bin/ld ]; then
  		lkmstage=BEFORENET
  		. /etc/rc.lkm
***************
*** 104,110 ****
  	exit 1
  fi
  
! for fs in /usr /var $critical_filesystems; do
  	mount | (
          		ismounted=no
          		while read what _on on _type type; do
--- 104,110 ----
  	exit 1
  fi
  
! for fs in $critical_filesystems; do
  	mount | (
          		ismounted=no
          		while read what _on on _type type; do
***************
*** 113,119 ****
                 		 fi
          		done
         		if [ $ismounted = no ]; then
! 			mount $fs >/dev/null 2>&1
  		fi
  	)
  done
--- 113,119 ----
                 		 fi
          		done
         		if [ $ismounted = no ]; then
! 			mount $fs
  		fi
  	)
  done
***************
*** 214,220 ****
  	fi
  fi
  
! mount -a
  
  # now start the rpc servers, for NFS server/client.
  echo -n 'starting nfs daemons:'
--- 214,220 ----
  	fi
  fi
  
! mount -a
  
  # now start the rpc servers, for NFS server/client.
  echo -n 'starting nfs daemons:'

Index: src/etc/rc.conf
*** rc.conf-1.3A	Thu Nov 13 02:56:17 1997
--- rc.conf-fix	Wed Nov 19 20:29:26 1997
***************
*** 16,23 ****
  domainname=""					# if blank, use /etc/defaultdomain
  defaultroute=""					# if blank, use /etc/mygate
  
! # Filesystems (besides /usr and /var) to mount early in boot-up
! critical_filesystems=""
  
  # One-time actions and programs on boot-up.
  lkm=YES						# run /etc/rc.lkm
--- 16,23 ----
  domainname=""					# if blank, use /etc/defaultdomain
  defaultroute=""					# if blank, use /etc/mygate
  
! # System filesystems to mount early in boot-up (eg. /usr, /var, /tmp, etc.)
! critical_filesystems="/usr /var"
  
  # One-time actions and programs on boot-up.
  lkm=YES						# run /etc/rc.lkm
>Audit-Trail:
>Unformatted: