Index: libexec/rc/rc.conf =================================================================== --- libexec/rc/rc.conf +++ libexec/rc/rc.conf @@ -643,6 +643,8 @@ linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). linux_mounts_enable="YES" # If linux_enable is set to YES, mount Linux-specific # filesystems at startup. +linux_mounts_createdirs="YES" # If linux_mounts_enable is set to YES, + # create the apropriate mountpoints clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks Index: libexec/rc/rc.d/linux =================================================================== --- libexec/rc/rc.d/linux +++ libexec/rc/rc.d/linux @@ -19,17 +19,18 @@ { local _emul_path _tmpdir + _emul_path="/compat/linux" load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in amd64) load_kld -e 'linux64elf' linux64 ;; esac - if [ -x /compat/linux/sbin/ldconfigDisabled ]; then + if [ -x "${_emul_path}/sbin/ldconfigDisabled" ]; then _tmpdir=`mktemp -d -t linux-ldconfig` - /compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache - if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then - cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache + ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache + if ! cmp -s ${_tmpdir}/ld.so.cache "${_emul_path}/etc/ld.so.cache"; then + cat ${_tmpdir}/ld.so.cache > "${_emul_path}/etc/ld.so.cache" fi rm -rf ${_tmpdir} fi @@ -47,7 +48,13 @@ fi if checkyesno linux_mounts_enable; then - _emul_path="/compat/linux" + if checkyesno linux_mounts_createdirs; then + install -d -m 0755 "${_emul_path}/proc" \ + "${_emul_path}/sys" \ + "${_emul_path}/dev" \ + "${_emul_path}/dev/fd" \ + "${_emul_path}/dev/shm" + fi mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" Index: share/man/man4/linux.4 =================================================================== --- share/man/man4/linux.4 +++ share/man/man4/linux.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 5, 2020 +.Dd August 30, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -88,6 +88,11 @@ line: .Pp .Dl linux_mounts_enable="NO" +.Pp +To create directories required for Linux-specific filesystems in case they do +not already exist, also add the following line: +.Pp +.Dl linux_mounts_createdirs="YES" .Sh SYSCTL VARIABLES The following variables are available as both .Xr sysctl 8 @@ -125,6 +130,7 @@ .Va SIGINFO work for Linux executables. Defaults to 0. +.El .Sh FILES .Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux