Jail question: packages with relative symlinks

Matthew Seaman matthew at FreeBSD.org
Wed Aug 26 16:28:29 UTC 2020


On 25/08/2020 22:30, Valeri Galtsev wrote:
> I probably didn't explain things detailed enough.
> 
> my jail has its root in:
> 
> /jail/[jailname]
> 
> so all what is inside jail on host filesystem is visible as:
> 
> /jail/[jailname]/s/etc
> /jail/[jailname]/etc --> s/etc
> /jail/[jailname]/usr
> /jail/[jailname]/s/usr-local
> /jail/[jailname]/usr/local --> ../s/usr-local
> ...
> 
> the
> 
> /jail/[jailname]
> 
> is base system mounted read-only (with symlinks etc pointing to s/etc,
> and others which point to a single place
> 
> /jail/[jailname]/s
> 
> which is mounted read-write, and this is the only place inside jail
> which  is read-write. This is the wonderful idea which inside jail makes
> base system read-only. And it is convenient, as you maintain only one
> base system (of given version) for all jails. And as you correctly said,
> chroot is used (in addition to other things), so inside jail what on
> host is /jail/[jailname]/ is plainly /
> 
> I hope, this provides enough detail to un-confuse things (and the need
> of symlinks when one sets up jails "by the book", meaning FreeBSD Handbook)
> 
> Valeri

There's a '--relocate' flag to pkg-add(8) which almost does what you
want.  The idea is that it allows you to prepend an arbitrary path to
the location where the package is installed.  In your case, that would
mean running

 pkg add --relocate /jail/[jailname]  some-package

However I'm not sure how well that works for installing the same package
in several different jails, or in your jail and in the host system --
you might need to play games with using several different $PKG_DBDIR setups.

Also, it only works with pkg-add(8), not pkg-install(8) or
pkg-upgrade(8).  It is an experimental feature intended for use in
cross-installing packages for a small appliance by mounting its drive
onto a larger and more capable machine.

	Cheers,

	Matthew

	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20200826/b176e10a/attachment.sig>


More information about the freebsd-questions mailing list