misc/182035: /etc/rc.d/tmp can't create tmpmfs on root-mfs

Harald Schmalzbauer freebsd at omnilan.de
Thu Sep 12 11:20:01 UTC 2013

>Number:         182035
>Category:       misc
>Synopsis:       /etc/rc.d/tmp can't create tmpmfs on root-mfs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 12 11:20:00 UTC 2013
>Originator:     Harald Schmalzbauer
>Release:        FreeBSD 9.2-RC1 amd64
System: FreeBSD preed.labshop.wdn.omnilan.net 9.2-RC1 FreeBSD 9.2-RC1 #0 r254055: Wed Aug 7 17:18:19 CEST 2013 admin at preed.labshop.wdn.omnilan.net:/usr/local/share/deploy-tools/obj-amd64/usr/local/share/deploy-tools/RELENG_9_2/src/sys/GENERIC amd64

	On startup, /etc/rc.d/tmp checks if /tmp is writable, and if not,
creates a memory-disk filesystem for /tmp.
Before actually creating, there's an additional check to see if /tmp is
already a memory-disk, which returns false positive, if the
root filesystem is a memory-disk!
	Boot any setup with root_mfs read-only, and leave tmpmfs="AUTO".
/etc/rc.d/tmp will recognize that /tmp is not writable, but refuses to create
the memorydisk, because 'df' with '/tmp'  and 'md[0-9]' as regex returns
false positive.

--- src/etc/rc.d/tmp.orig	2013-09-11 20:43:25.000000000 +0200
+++ src/etc/rc.d/tmp	2013-09-11 20:48:46.000000000 +0200
@@ -39,7 +39,7 @@
 mount_tmpmfs ()
-	if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
+	if ! /sbin/mount | grep -q "^/dev/md[0-9].\+/tmp[[:blank:]]"; then
 		mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
 		chmod 01777 /tmp


More information about the freebsd-bugs mailing list