Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 May 2014 18:41:50 -0400
From:      Fbsd8 <fbsd8@a1poweruser.com>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        pkg <pkg@freebsd.org>, questions <questions@FreeBSD.org>
Subject:   Re: bootstrapping /usr/sbin/pkg inside a jail
Message-ID:  <536AB6AE.4000009@a1poweruser.com>
In-Reply-To: <CAG=rPVd23smYh2QkD9FiY20GJKDPcfqjydvzrKOFr8vu4BGBRg@mail.gmail.com>
References:  <5369407E.9060008@a1poweruser.com>	<53694241.6050207@my.hennepintech.edu>	<536A3E10.4030902@a1poweruser.com>	<CAG=rPVfqUFGm0-_pogHfZM5OcPCxO2hWEc5rSgkzCfmUgV72gw@mail.gmail.com>	<536A9BB5.9080905@a1poweruser.com> <CAG=rPVd23smYh2QkD9FiY20GJKDPcfqjydvzrKOFr8vu4BGBRg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Craig Rodrigues wrote:
> On Wed, May 7, 2014 at 1:46 PM, Fbsd8 <fbsd8@a1poweruser.com> wrote:
>> Craig Rodrigues wrote:
> 
>> Thank you Craig for your work around. But the fact is the bootstrap pkg
>> program should work from within a jail. This looks like a bug that needs a
>> PR.
> 
> /usr/sbin/pkg behaves differently on FreeBSD 9
> vs. FreeBSD 10.  You can see the source code in /usr/src/usr.bin/pkg/
> to see how it works.
> 
> Before you run /usr/sbin/pkg for the first time, you need to check if
> any of the following are true in your jail:
> 
> (1)  Is something setting PACKAGESITE in your environment?
> (2)  Do you have any files:
>           /usr/local/etc/pkg.conf
>          /usr/local/etc/pkg/repos/*
> 
> If any of those things are true, they will affect the behavior of /usr/sbin/pkg.
> You will need to delete those files and unset the variable, and then
> apply the workaround
> at: https://github.com/freenas/freenas/blob/master/build/ports/install-ports.sh#L29
> 
> You can try filing a bug against pkg, but the pkg developers might
> tell you that this
> is a bootstrapping problem which is fixed in newer versions of FreeBSD.
> 
> --
> Craig
> 

Figured out the problem.
To create my jail filesystem I download and uncompress the base.txz file 
just like bsdinstall does. This base filesystem has a environment 
variable PACKAGESITE populated with the content needed by the old 
pkg_add -r command which is no longer part of the 10.0 base. bsdinstall 
must do an unsetenv PACKAGESITE on that environment variable during the 
install process to prepare the system for pkgng.

The solution for me is after creating my jail filesystem from the 
base.txz file, I start the jail and then jexec jailname tcsh to open a 
console to the jail. From inside of the jail I issue "unsetenv 
PACKAGESITE" to disable that environment variable. Then issue pkg and 
the pkg bootstrap works as expected.

Now global system environment variables must be saved in some file that 
gets read during the system boot process. Does anyone know where that 
file is located and what its called?












Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?536AB6AE.4000009>