Subject: Re: mksandbox
To: Jan Danielsson <>
From: Louis Guillaume <>
List: pkgsrc-users
Date: 04/23/2007 00:48:15
Jan Danielsson wrote:
> Steven M. Bellovin wrote:
> [---]
>> You may want to try pkg_comp instead; it's designed for precisely this
>> purpose.
>    Ok, I tried pkg_comp, and it seems to be working mostly. A few
> questions, though..
>    1) Do I need to run "pkg_comp chroot" and edit mk.conf in the chroot,
> or is there some way to make the pkg_comp chroot automatically migrate
> my mk.conf preferences automatically?
>    "man pkg_comp" gives me:
>              A list of variable names that will be appended to the generated
>              /etc/mk.conf file, together with their values set in the
> configu-
>              ration file.  Its default value contains all variables listed
>              here.
>    ...which I - frankly - don't understand.

I forget where it's documented, but you can create an EXTRAMK file that
contains the stuff you want in mk.conf. I put it in my ~/pkg_comp
directory next to default.conf.

In default.conf you need a line that looks like this...


... keep in mind that this is a one-time deal. Once you "makeroot" this
isn't consulted anymore. But each time I do a major update of NetBSD I
try to "removeroot" and "makeroot" again, just to make sure everything's
nice and clean. EXTRAMK comes in handy there. If, during a build, I have
to add ACCEPTABLE_LICENSES or something, I end up doing
double-configuration, in extramk.conf and in the chrooted /etc/mk.conf,
but the next time it's just there and I don't have to think about it.

>    2) I built rtorrent with pkg_comp, and expected to find a binary
> libtorrent package, but I could not. In mk.conf I have
> "DEPENDS_TARGET=package". Do I need to add that in my chrooted mk.conf?

You need to figure out the value of ${PACKAGES} inside your chroot
environment. Either you set it with ${REAL_PACKAGES} in default.conf, or
it's just going to be in ${DESTDIR}/pkg_comp/packages.

I love pkg_comp. It's one of the best things about pkgsrc IMO.

I've also successfully used the mksandbox script on Linux to kind of do
the pkg_comp thing. But I never really did it enough to say it's
reliable. I think I had to add /usr/src to the list of null-mounted
filesystems in the chroot, but I don't really remember. I also tried on
Mac OS X and AIX but they did not work at all.

Hope that helps,