Jail fails to unmount a directory
Ernie Luzar
luzar722 at gmail.com
Mon Oct 31 18:07:07 UTC 2016
io7m+org.freebsd.jail at io7m.com wrote:
> Hello.
>
> I have an incredibly trivial jail setup:
>
> /usr/jail/com.example.service0 is the root of the jail.
> /usr/jail/com.example.service0/base is an empty directory.
> /usr/jail/base is a directory containing binaries.
>
> I use the following jail configuration:
>
> com_example_service0
> {
> exec.start = "/bin/sh";
> host.hostname = com.example.service0;
> interface = em0;
> ip4.addr = 127.0.0.2;
> mount.fstab = /usr/jail/com.example.service0.fstab;
> path = /usr/jail/com.example.service0;
> }
>
> The /usr/jail/com.example.service0.fstab contains a single line:
>
> /usr/jail/base /usr/jail/com.example.service0/base nullfs ro,noauto 0 0
>
> I start the jail:
>
> host# jail -v -f com.example.service0.conf -c com_example_service0
> com_example_service0: run command: /sbin/ifconfig em0 inet 127.0.0.2 netmask 255.255.255.255 alias
> com_example_service0: run command: /sbin/mount -t nullfs -o ro,noauto /usr/jail/base /usr/jail/com.example.service0/base
> com_example_service0: jail_set(JAIL_CREATE) persist name=com_example_service0 host.hostname=com.example.service0 ip4.addr=127.0.0.2 path=/usr/jail/com.example.service0
> com_example_service0: created
> com_example_service0: run command in jail: /bin/sh
> # exit
> com_example_service0: jail_set(JAIL_UPDATE) jid=13 nopersist
> host#
>
> The jail is gone:
>
> host# jls
> JID IP Address Hostname Path
>
> However:
>
> host# df -h | grep service0
> # df -h
> Filesystem Size Used Avail Capacity Mounted on
> zroot/ROOT/default 13G 475M 13G 4% /
> devfs 1.0K 1.0K 0B 100% /dev
> zroot/tmp 13G 108K 13G 0% /tmp
> zroot/usr/home 13G 136K 13G 0% /usr/home
> zroot/usr/ports 13G 96K 13G 0% /usr/ports
> zroot/usr/src 13G 96K 13G 0% /usr/src
> zroot/var/audit 13G 96K 13G 0% /var/audit
> zroot/var/crash 13G 96K 13G 0% /var/crash
> zroot/var/log 13G 148K 13G 0% /var/log
> zroot/var/mail 13G 96K 13G 0% /var/mail
> zroot/var/tmp 13G 96K 13G 0% /var/tmp
> zroot 13G 96K 13G 0% /zroot
> zroot/jail 13G 249M 13G 2% /usr/jail
> zroot/jail/com.example.service0 13G 4.0M 13G 0% /usr/jail/com.example.service0
> /usr/jail/base 13G 249M 13G 2% /usr/jail/com.example.service0/base
>
> .. the /usr/jail/com.example.service0/base directory was not unmounted.
>
> What do I need to do to get the directory to be correctly unmounted
> when the jail ceases to exist?
>
> M
The correct way to stop the jail is to issue this command from the host
command line
host# jail -v -f com.example.service0.conf -r com_example_service0
More information about the freebsd-jail
mailing list