FreeBSD pkg upgrade not working for jails with -j parameter

freebsd

On a FreeBSD 8.4 system I have jais running with EZjail, and PKGNG (pkg) to maintain my ports.

pkg works fine on the host but refuses to update software in jails.

pkg -j 5 version -v gives the desired output, eg

ImageMagick-6.7.3.4                <   needs updating (index has 6.9.0.4,1)
ORBit2-2.14.19                     <   needs updating (index has 2.14.19_1)

But when I run pkg -j 5 upgrade or pkg -j 5 upgrade [portname] I get the following message:

No active remote repositories configured.

I installed pkg inside of that jail as well, and the problem is exactly the same (of course running without the -j parameter when inside of the jail.

What could be the problem?

Best Answer

The problem was that inside the jail the repository directory was empty, unlike the /etc/pkg/ directory on the host. In this directory on the host is a file called FreeBSD.conf, which defines the repository.

This file was made automatically on the host, but not in the jail. (even though pkg was also installed inside of the jail. Apparently 'pkg -j' looks for this file inside of the jail.

I just copied this file into the directory /etc/pkg/ in the jail and it works now.

FYI, the contents of this FreeBSD.conf file:

# $FreeBSD$
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}