Bug 214898

Summary: mount -a will remount a partition if it's a ramdisk by incrementing mdX
Product: Base System Reporter: Bjorn Robertsson <bjornr>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me Keywords: regression
Priority: ---    
Version: 10.3-RELEASE   
Hardware: amd64   
OS: Any   

Description Bjorn Robertsson 2016-11-28 09:12:55 UTC
Before mount -a:

/var/run and /tmp are mounted as ramdisk:
md                      /tmp            mfs     rw,-s512M,noatime        0       0
md                      /var/run        mfs     rw,-s32M,noatime        0       0

df -h |grep md
/dev/md0 on /tmp (ufs, local, noatime, soft-updates)
/dev/md1 on /var/run (ufs, local, noatime, soft-updates)

After mount -a:
df -h |grep md
/dev/md0              496M     52K    456M     0%    /tmp
/dev/md1               31M    128K     28M     0%    /var/run
/dev/md2              496M    8,0K    456M     0%    /tmp
/dev/md3               31M    8,0K     28M     0%    /var/run

Executing commands in /usr/local/bin will now fail:
# bash
Shared object "libintl.so.8" not found, required by "bash"

Does not happen on FreeBSD 10.2, will also happen on FreeBSD 11.0-RELEASE


Temporary resolution: umount the filesystems and for /var/run, execute: ldconfig /usr/local/lib

This does not happen when the md devices are explicitly named in fstab:
md0                      /tmp            mfs     rw,-s512M,noatime        0       0
md1                      /var/run        mfs     rw,-s32M,noatime        0       0

But mount -a returns:
mount -a
mount_mfs: mdconfig (attach) exited with error code 1
mount_mfs: mdconfig (attach) exited with error code 1

According to the man page:
     # UFS file system on a swap-backed md(4).  /dev/md10 is
     # automatically created.  If it is "md", a unit number
     # will be automatically selected.
     md10            /scratch        mfs     rw,-s1g         0       0

But at some time, after 10.3-RELEASE it will not re-use, but create new md devices?