Date: Wed, 26 Aug 2020 11:39:17 -0500 From: Valeri Galtsev <galtsev@kicp.uchicago.edu> To: Matthew Seaman <matthew@FreeBSD.org> Cc: freebsd-questions@freebsd.org Subject: Re: Jail question: packages with relative symlinks Message-ID: <5E7E9966-E534-407E-B5DB-A45878760FA0@kicp.uchicago.edu> In-Reply-To: <2eb62151-38b5-5e63-43a1-5cac1967b681@FreeBSD.org> References: <f3636f36-b6ce-3e8a-878a-bf8d5f75144d@kicp.uchicago.edu> <24d244da-43e4-9a5e-e940-3f183bc5a50e@holgerdanske.com> <9127e9ca-c6be-d007-bd82-fdf7c5508242@kicp.uchicago.edu> <7c3ad6a6-5ff1-5816-dc23-83d80590baac@kicp.uchicago.edu> <2eb62151-38b5-5e63-43a1-5cac1967b681@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Aug 26, 2020, at 11:28 AM, Matthew Seaman <matthew@FreeBSD.org> = wrote: >=20 > On 25/08/2020 22:30, Valeri Galtsev wrote: >> I probably didn't explain things detailed enough. >>=20 >> my jail has its root in: >>=20 >> /jail/[jailname] >>=20 >> so all what is inside jail on host filesystem is visible as: >>=20 >> /jail/[jailname]/s/etc >> /jail/[jailname]/etc --> s/etc >> /jail/[jailname]/usr >> /jail/[jailname]/s/usr-local >> /jail/[jailname]/usr/local --> ../s/usr-local >> ... >>=20 >> the >>=20 >> /jail/[jailname] >>=20 >> is base system mounted read-only (with symlinks etc pointing to = s/etc, >> and others which point to a single place >>=20 >> /jail/[jailname]/s >>=20 >> 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 / >>=20 >> 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) >>=20 >> Valeri >=20 > 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 >=20 > pkg add --relocate /jail/[jailname] some-package >=20 Matthew, thanks for a nice idea! It has never occurred to me. Basically, = as package is installed by executing pkg command in jail, pkg already = sees /jail/[jailname] as / , but as I care of symlinks, and all writable = is in jail mounted as /s/ , relocation of that package to /s may do the = trick. I will check that, and will report if it solves my case, I just = could not hold myself and answered now being this excited by idea that = looks so simple so it is next to genius, and which never occurred to = me=E2=80=A6 Valeri > 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. >=20 > 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. >=20 > Cheers, >=20 > Matthew >=20 > =09 >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5E7E9966-E534-407E-B5DB-A45878760FA0>