stagedir vs. jail

Matthew Seaman matthew at
Sun Oct 13 11:57:56 UTC 2013

On 13/10/2013 11:58, Ekkehard Gehm wrote:
> I resently have some problems installing/updating ports. The main
> problem is that the stagedir path is somehow messed up.
> The system is running FreeBSD 9.1-RELEASE-p6 and I'm working in a
> jail. While building it creates the stagedir in
> /s/portbuild/usr/ports/...../usr/local/ BUT: When it comes to the pkg
> building it suddently is looking in .../usr-local/.. witch acctualy
> is a part of the symlink. (In the jail /usr/local is a symlink to
> /s/usr-local). Resulting in an failure.
> The only workiaround  is disabling stage completly thru make.conf... 
> As this is very quick'n'dirty I wonder if there is any other
> solution!

Your subject line is (perhaps) a bit misleading: this seems to be
nothing specific to the use of jails, but due to having sym-links in
various paths.  It could happen just the same if you laid out your host
filesystem using sym-links.

Anyhow, this looks like a bug to me -- using sym-links to put your
filesystem together should not result in chaos.

Are you using pkg(8)?  There are differences in the way a package is
generated from the staging directory between pkg(8) and pkg_create(1)
which might make all the difference.

Is it all ports that are affected?  Does the use of PLIST_FILES or
PLIST_DIRS in the port Makefile make any difference compared to having a
pkg-plist file?

A possible work-around: instead of sym-linking /s/usr-local ->
/usr/local use a nullfs mount instead.

    mount -t nullfs /s/usr-local /usr/local

(Actually, you'ld probably do that from outside the jail so adjust the
paths accordingly.)

Another workaround:  set up your own poudriere instance to build
packages for all your jails.  poudriere(8) will create its own jails to
do package building in, and manage paths etc. itself.  It's a natural
partner to pkg(8) and zfs(8) but it will work without either of those.



Dr Matthew J Seaman MA, D.Phil.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1036 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-ports mailing list