unionfs: strange error when mounted in jail.

Beeblebrox zaphod at berentweb.com
Wed Mar 28 09:26:45 UTC 2012


I am using ezjail to setup some jailed services. Ezjail sets up a
light-jail and a base(fat)-jail which is mounted "ro" under the light-jail.
I modified this to experiment with an idea. In addition to the standard
mount_nullfs ezjail does, I placed in /etc/fstab.pxe:
> > /data/jails/base/usr/local    /data/jails/pxe/usr/local    unionfs
rw,below,noatime,copymode=masquerade 0 0
> > /data/jails/base/var/db/pkg    /data/jails/pxe/var/db/pkg   unionfs
rw,below,noatime,copymode=masquerade 0 0
What this does, is it allows to create a "base ports" fat-jail where all
"base ports" will be included in subsequently created thin-jails, not as
copy but as a unionfs layer. When updating ports in the jails, the "base
ports" package will have to be updated only once, instead of repeated
update for each thin-jail. I also have zfs dedup=on for the /data/jails
folder.

I install jail-specific ports into the thin-jail by normal process -> start
the jail normally & pkg_add. I then shut-down jail, modify the jail's fstab
(fstab.pxe) and re-start jail.
The problem I run into: Start the jail, then #jexec into jailed env.
Execute an app or service like portmaster (installed into /data/jails/base)
or dhcpd installed into /data/jails/pxe) portmaster will start-up, but
hangs after a short run. dhcpd hangs and freezes the jail immediately - I
cannot kill any of the processes and have to do a poweroff. Both
executables run normally without the unionfs structure.

Regards.


More information about the freebsd-fs mailing list