conf/158127: [patch] remount_optional option in rc.initdiskless doesn't actually work

Brian Olsen brian at maven-group.org
Tue Jun 21 16:00:28 UTC 2011


>Number:         158127
>Category:       conf
>Synopsis:       [patch] remount_optional option in rc.initdiskless doesn't actually work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 21 16:00:22 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Brian Olsen
>Release:        8.2
>Organization:
>Environment:
FreeBSD mail.vagtelhave.dk 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Jun 21 07:23:33 CEST 2011     root at lacuna-dev.maven-group.org:/usr/obj/freakbsd.lacuna/usr/src/sys/GENERIC  i386
>Description:
When trying to use the remount_optional option on a nanobsd like build that was going to run from an iso image with an optional remount of /dev/ufs/cfg onto /conf/default/etc I discovered that it doesn't actually work.

When remount_optional is present it will always print the error message "mount -o ro /dev/ufs/cfg /conf/default/etc failed: ignoring due to remount_optional" even when the mount succeeds. And when the mount fails it still drops into a shell.

A simple fix to the problem is attached.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- /etc/rc.initdiskless	2011-02-18 02:52:09.000000000 +0100
+++ etc/rc.initdiskless	2011-06-21 17:15:21.000000000 +0200
@@ -166,14 +166,17 @@
 chkerr() {
     lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 )
     mountpoint="$(lastitem $2)"
-    [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due to remount_optional" ; return )
     case $1 in
     0)
 	;;
     *)
-	echo "$2 failed: dropping into /bin/sh"
-	/bin/sh
-	# RESUME
+	if [ -r $mountpoint/remount_optional ] ; then
+	     echo "$2 failed: ignoring due to remount_optional"
+	else
+	     echo "$2 failed: dropping into /bin/sh"
+	     /bin/sh
+	     # RESUME
+	fi
 	;;
     esac
 }


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list