Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2011 15:51:46 GMT
From:      Brian Olsen <brian@maven-group.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/158127: [patch] remount_optional option in rc.initdiskless doesn't actually work
Message-ID:  <201106211551.p5LFpkQq097095@red.freebsd.org>
Resent-Message-ID: <201106211600.p5LG0MGT042931@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



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