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 @@ -46,8 +47,15 @@ sysctl kern.elf32.fallback_brand=3 > /dev/null fi + 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 + if checkyesno linux_mounts_enable; then - _emul_path="/compat/linux" 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