Bug 158127 - [patch] remount_optional option in rc.initdiskless doesn't actually work
Summary: [patch] remount_optional option in rc.initdiskless doesn't actually work
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2011-06-21 17:00 UTC by Brian Olsen
Modified: 2017-12-31 22:29 UTC (History)
0 users

See Also:

file.diff (665 bytes, patch)
2011-06-21 17:00 UTC, Brian Olsen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Olsen 2011-06-21 17:00:22 UTC
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.

Fix: Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-06-23 19:12:03 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Mark Linimon 2012-06-20 07:01:04 UTC
----- Forwarded message from Dewayne <dewayne.geraghty@heuristicsystems.com.au> -----

Date: Wed, 20 Jun 2012 06:19:55 +1000
From: Dewayne <dewayne.geraghty@heuristicsystems.com.au>
To: stable@freebsd.org
Cc: brian@maven-group.org
Subject: Diskless ignore remount - fix (Re: conf/158127: [patch]
	remount_optional option in rc.initdiskless doesn&#39;
	t actually work)

I notice that PR 158127 remains outstanding, June, 2011.  I've enclosed a
patch for Stable 9.0, to correct diskless booting.  When a mountpoint
fails, the failure may be ignored as required/documented.

--- /tmp/rc.initdiskless        2012-06-19 19:01:33.000000000 +1000
+++ /etc/rc.initdiskless        2012-06-19 19:02:16.000000000 +1000
@@ -166,7 +166,7 @@
 chkerr() {
     lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 )
     mountpoint="$(lastitem $2)"
-    [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due
to remount_optional" ; return )
+    [ -r $mountpoint/remount_optional ] && echo "$2 failed: ignoring due
to remount_optional" && return
     case $1 in

The patch has been tested with/without /conf/default/etc/remount_optional &
is functionally correct. 

It would be appreciated if someone would verify and commit.

Regards, Dewayne.
PS My apologies if Outlook has corrupted the patches appearance,we have to
work with what we've got.

----- End forwarded message -----
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:24 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped