Starting a jail that's configured with 'mount.devfs' with `jail -c` does not check if devfs is already mounted and mounts it again. The problem seems to be when the (nopersist) jail is stopped by itself because all the processes in it have exited, so it wasn't explicitly `jail -r`. When that happens, devfs is not unmounted. So next time the jail is started, devfs is mounted again, resulting with multiple mounts of devfs into $JAIL_ROOT/dev: > % mount | grep /zroot/jails/test/dev > devfs on /zroot/jails/test/dev (devfs, local, multilabel) > devfs on /zroot/jails/test/dev (devfs, local, multilabel) > devfs on /zroot/jails/test/dev (devfs, local, multilabel) > devfs on /zroot/jails/test/dev (devfs, local, multilabel) If the jail is explicitly stopped with `jail -r`, devfs is unmounted.
proposed fix: https://reviews.freebsd.org/D32934
(In reply to VK from comment #0) > The problem seems to be when the (nopersist) jail is stopped by itself because all > the processes in it have exited, so it wasn't explicitly `jail -r`. When that > happens, devfs is not unmounted. For non-persist jails I think this is the expected behavior. `mount.devfs` is a pseudo-parameter and as per jail(8): > There are pseudo-parameters that are not passed to the kernel, but are > used by jail to set up the jail environment, often by running specified > commands when jails are created or removed. > So next time the jail is started, devfs is mounted again, resulting with multiple > mounts of devfs into $JAIL_ROOT/dev: Maybe we can teach /usr/sbin/jail to check existing mount of devfs(5) before starting jails.