From owner-freebsd-pkg@FreeBSD.ORG Wed May 7 22:42:02 2014 Return-Path: Delivered-To: pkg@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACF603E3; Wed, 7 May 2014 22:42:02 +0000 (UTC) Received: from relay.mailchannels.net (ar-005-i201.relay.mailchannels.net [162.253.144.83]) by mx1.freebsd.org (Postfix) with ESMTP id 9C9539A1; Wed, 7 May 2014 22:42:01 +0000 (UTC) X-Sender-Id: _forwarded-from|107.201.34.133 Received: from mail-24.name-services.com (ip-10-237-3-9.us-west-2.compute.internal [10.237.3.9]) by relay.mailchannels.net (Postfix) with ESMTPA id 6E5FD60CA2; Wed, 7 May 2014 22:41:59 +0000 (UTC) X-Sender-Id: _forwarded-from|107.201.34.133 Received: from mail-24.name-services.com (mail-24.name-services.com [10.235.16.137]) (using TLSv1 with cipher AES128-SHA) by 0.0.0.0:2500 (trex/5.1.2); Wed, 07 May 2014 22:41:59 GMT X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from%7C107.201.34.133 X-MailChannels-Auth-Id: demandmedia Received: from [10.0.10.1] (107-201-34-133.lightspeed.bcvloh.sbcglobal.net [107.201.34.133]) by mail-24.name-services.com with SMTP; Wed, 7 May 2014 15:41:52 -0700 Message-ID: <536AB6AE.4000009@a1poweruser.com> Date: Wed, 07 May 2014 18:41:50 -0400 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Craig Rodrigues Subject: Re: bootstrapping /usr/sbin/pkg inside a jail References: <5369407E.9060008@a1poweruser.com> <53694241.6050207@my.hennepintech.edu> <536A3E10.4030902@a1poweruser.com> <536A9BB5.9080905@a1poweruser.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: pkg , questions X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2014 22:42:02 -0000 Craig Rodrigues wrote: > On Wed, May 7, 2014 at 1:46 PM, Fbsd8 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?