PKG Problem, Can't Install or Update Packages in 11.2-U7

amp88

Explorer
Joined
May 23, 2019
Messages
56
Hi all. Another strange problem. I just did this procedure a couple of days ago and it worked fine, but now on a clean install of FreeNAS 11.2-U7 it's failing and I don't know why. I'm running FreeNAS virtualised in XCP-ng 8.0 and trying to install the xe-guest-utilities package, but it's failing.

I'm following this procedure (which has worked in a couple of other 11.2-U7 installations I've run in the last week or so). Toggle 'enabled' in /usr/local/etc/pkg/repos/FreeBSD.conf from 'no' to 'yes', toggle 'enabled' in /usr/local/etc/pkg/repos/local.conf from 'yes' to 'no', then run 'pkg install xe-guest-utilities'. However, when I do this I get the following error (with the debug flag enabled to get more verbose output):

Code:
root@freenas[~]# pkg -d install xe-guest-utilities
DBG(1)[7363]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[7363]> PkgRepo: verifying update for FreeBSD
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
DBG(1)[7363]> PkgRepo: need forced update of FreeBSD
DBG(1)[7363]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[7363]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/meta.txz with opts "i"
Fetching meta.txz: 100%    916 B   0.9kB/s    00:01
DBG(1)[7363]> PkgRepo: extracting meta of repo FreeBSD
DBG(1)[7386]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
DBG(1)[7363]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/packagesite.txz with opts "i"
Fetching packagesite.txz: 100%    6 MiB   6.5MB/s    00:01
DBG(1)[7363]> PkgRepo: extracting packagesite.yaml of repo FreeBSD
DBG(1)[7388]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!

If I try to run 'pkg -d update' I get the following error:
Code:
root@freenas[~]# pkg -d update
DBG(1)[7340]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[7340]> PkgRepo: verifying update for FreeBSD
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
DBG(1)[7340]> PkgRepo: need forced update of FreeBSD
DBG(1)[7340]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[7340]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/meta.txz with opts "i"
Fetching meta.txz: 100%    916 B   0.9kB/s    00:01
DBG(1)[7340]> PkgRepo: extracting meta of repo FreeBSD
DBG(1)[7341]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
DBG(1)[7340]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/packagesite.txz with opts "i"
Fetching packagesite.txz: 100%    6 MiB 202.1kB/s    00:32
DBG(1)[7340]> PkgRepo: extracting packagesite.yaml of repo FreeBSD
DBG(1)[7361]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!

I don't really know how to interpret this error. Does 'pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2' mean my local file is corrupted, or is there a problem at the remote end? This is a fresh installation, I've literally done nothing else other than to set the local IP for the machine and add a default gateway and DNS server to install this package. Any input would be appreciated, thanks.
 

amp88

Explorer
Joined
May 23, 2019
Messages
56
In case it's useful to anyone in figuring this out, here's the output from running 'pkg -vv':

Code:
root@freenas[~]# pkg -vv
Version                 : 1.10.5
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-11";
HANDLE_RC_SCRIPTS = false;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
ABI = "FreeBSD:11:amd64";
ALTABI = "freebsd:11:x86:64";
DEVELOPER_MODE = false;
VULNXML_SITE = "http://vuxml.freebsd.org/freebsd/vuln.xml.bz2";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/1.10.5";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
    all-depends = "query %dn-%dv";
    annotations = "info -A";
    build-depends = "info -qd";
    cinfo = "info -Cx";
    comment = "query -i \"%c\"";
    csearch = "search -Cx";
    desc = "query -i \"%e\"";
    download = "fetch";
    iinfo = "info -ix";
    isearch = "search -ix";
    prime-list = "query -e '%a = 0' '%n'";
    prime-origins = "query -e '%a = 0' '%o'";
    leaf = "query -e '%#r == 0' '%n-%v'";
    list = "info -ql";
    noauto = "query -e '%a == 0' '%n-%v'";
    options = "query -i \"%n - %Ok: %Ov\"";
    origin = "info -qo";
    provided-depends = "info -qb";
    raw = "info -R";
    required-depends = "info -qr";
    roptions = "rquery -i \"%n - %Ok: %Ov\"";
    shared-depends = "info -qB";
    show = "info -f -k";
    size = "info -sq";
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = false;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
PLIST_ACCEPT_DIRECTORIES = false;
IP_VERSION = 0;
AUTOMERGE = true;
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
    "pkg+http",
    "pkg+https",
    "https",
    "http",
    "file",
    "ssh",
    "ftp",
    "ftps",
    "pkg+ssh",
    "pkg+ftp",
    "pkg+ftps",
]
ALLOW_BASE_SHLIBS = false;
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
OSVERSION = 1102500;
IGNORE_OSVERSION = false;


Repositories:
  FreeBSD: {
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  local: {
    url             : "file:///usr/ports/packages",
    enabled         : no,
    priority        : 0
  }
  pcbsd-major: {
    url             : "http://pkg.cdn.pcbsd.org/10.0-RELEASE/amd64",
    enabled         : no,
    priority        : 0,
    signature_type  : "FINGERPRINTS"
  }
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
You can't install packages on the base system by design. Any packages need to be installed in a jail.
 

amp88

Explorer
Joined
May 23, 2019
Messages
56
You can't install packages on the base system by design. Any packages need to be installed in a jail.
As I said in the OP, I've followed this procedure successfully multiple times (in both FreeNAS 11.2-U7 and 11.3). There must be a reason it's broken now.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
FreeBSD 11.2 is out of support, there are no packages for it. You need to upgrade to 11.3. But as @Jailer said: don't.
 

amp88

Explorer
Joined
May 23, 2019
Messages
56
FreeBSD 11.2 is out of support, there are no packages for it. You need to upgrade to 11.3. But as @Jailer said: don't.
I had a number of problems with FreeNAS 11.3 which I wasn't encountering in 11.2-U7, so I'd prefer to remain on 11.2-U7 and wait for some updates to 11.3.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Then no packages any more ...
 

amp88

Explorer
Joined
May 23, 2019
Messages
56
Then no packages any more ...
OK, can I just manually download the .txz file from the repository and extract its contents into my local filesystem then (with the knowledge that what I'm doing is unsupported, potentially a security problem and a stupid idea)?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
There are no 11.2 compatible packages in the repo anymore. Only 11.3. That's precisely the point. Once a release has reached EOL, when the next quarterly branch of the ports is released the packages are built for the now current release version. And outdated quarterly branches are removed from the repo.
 

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hello,

I have the same issue in my iocage jails, which are on 11.3.

Code:
FreeBSD rt 11.3-RELEASE-p5 FreeBSD 11.3-RELEASE-p5 #0 r325575+8ed1cd24b60(HEAD): Mon Jan 27 18:07:23 UTC 2020     root@tnbuild02.tn.ixsystems.com:/freenas-releng/freenas/_BE/objs/freenas-releng/freenas/_BE/os/sys/FreeNAS.amd64  amd64


Here is what happens when I try to update pkg:

Code:
root@rt:~ # pkg update
Updating FreeBSD repository catalogue...
pkg: repository meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
[rt] Fetching meta.txz: 100%    916 B   0.9kB/s    00:01   
pkg: repository meta has wrong version 2
repository FreeBSD has no meta file, using default settings
[rt] Fetching packagesite.txz: 100%    6 MiB 119.3kB/s    00:54   
pkg: repository meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!


And here when I do pkg -d update:
Code:
root@rt:~ # pkg -d update
DBG(1)[5869]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[5869]> PkgRepo: verifying update for FreeBSD
pkg: repository meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
DBG(1)[5869]> PkgRepo: need forced update of FreeBSD
DBG(1)[5869]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[5869]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/meta.txz with opts "i"
[rt] Fetching meta.txz: 100%    916 B   0.9kB/s    00:01   
DBG(1)[5869]> PkgRepo: extracting meta of repo FreeBSD
DBG(1)[5872]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta has wrong version 2
repository FreeBSD has no meta file, using default settings
DBG(1)[5869]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:amd64/latest/packagesite.txz with opts "i"
[rt] Fetching packagesite.txz: 100%    6 MiB 165.2kB/s    00:39   
DBG(1)[5869]> PkgRepo: extracting packagesite.yaml of repo FreeBSD
DBG(1)[5890]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!


And here when I do pkg -vv:

Code:
root@rt:~ # pkg -vv
Version                 : 1.11.1
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-11";
HANDLE_RC_SCRIPTS = false;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
ABI = "FreeBSD:11:amd64";
ALTABI = "freebsd:11:x86:64";
DEVELOPER_MODE = false;
VULNXML_SITE = "http://vuxml.freebsd.org/freebsd/vuln.xml.bz2";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/1.11.1";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
    all-depends = "query %dn-%dv";
    annotations = "info -A";
    build-depends = "info -qd";
    cinfo = "info -Cx";
    comment = "query -i \"%c\"";
    csearch = "search -Cx";
    desc = "query -i \"%e\"";
    download = "fetch";
    iinfo = "info -ix";
    isearch = "search -ix";
    prime-list = "query -e '%a = 0' '%n'";
    prime-origins = "query -e '%a = 0' '%o'";
    leaf = "query -e '%#r == 0' '%n-%v'";
    list = "info -ql";
    noauto = "query -e '%a == 0' '%n-%v'";
    options = "query -i \"%n - %Ok: %Ov\"";
    origin = "info -qo";
    provided-depends = "info -qb";
    rall-depends = "rquery %dn-%dv";
    raw = "info -R";
    rcomment = "rquery -i \"%c\"";
    rdesc = "rquery -i \"%e\"";
    required-depends = "info -qr";
    roptions = "rquery -i \"%n - %Ok: %Ov\"";
    shared-depends = "info -qB";
    show = "info -f -k";
    size = "info -sq";
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = false;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
PLIST_ACCEPT_DIRECTORIES = false;
IP_VERSION = 0;
AUTOMERGE = true;
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
    "pkg+http",
    "pkg+https",
    "https",
    "http",
    "file",
    "ssh",
    "ftp",
    "ftps",
    "pkg+ssh",
    "pkg+ftp",
    "pkg+ftps",
]
ALLOW_BASE_SHLIBS = false;
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
OSVERSION = 1103000;
IGNORE_OSVERSION = false;


Repositories:
  FreeBSD: {
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What does freebsd-version inside your jail say?
 

SeaFox

Explorer
Joined
Aug 6, 2013
Messages
98
Hello.

Can anyone offer any further advice on this?
It seems I'm having this same issue on multiple 11.3 jails.
 

damjan

Dabbler
Joined
Jan 8, 2016
Messages
11
Hi,

I had the same problem on the upgraded jails. The problem on my system was caused by the outdated repo file in the local directory pointing to FreeBSD 10 repo:
/usr/local/etc/pkg/repos/FreeBSD.conf

I removed the outdated repo config file and pkg update completed successfully; so did the pkg upgrade.

On one of the upgraded zones, pkg did not work because of outdated dependencies. I used pkg-static to upgrade pkg to the latest version followed by the pkg upgrade. Since then I do not have any issues.

So check if you have any /usr/local/etc/pkg/repos/FreeBSD.conf file pointing to the old FreeBSD repo.
 

SeaFox

Explorer
Joined
Aug 6, 2013
Messages
98
So check if you have any /usr/local/etc/pkg/repos/FreeBSD.conf file pointing to the old FreeBSD repo.

Nah, that file does not exist by default in the jails. They seem to be configured elsewhere to use the quarterly update manifest and not the latest. But you did give me an idea... I know I can create that file and point it to the Latest packages for FreeBSD, so I tried that, and it also did not work. I was still getting the same error as FlyingPersian.

But I think I just found the solution: pkg bootstrap -f

I seem to be able to update packages normally now. I'm going to roll back this jail and try again one more time to make sure the change in respository is not playing a role, too.

When this first started happening it was a weeks ago, and I thought I was being effected by this bug. But it got resolved and I was still having the issue, even earlier today when I upgraded an old jail.

Edit: Yes -- this works, without changing the repository.

Code:
root@nginx_reverse:/ # pkg bootstrap -f
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
[nginx_reverse] Installing pkg-1.13.2...
package pkg is already installed, forced install
[nginx_reverse] Extracting pkg-1.13.2: 100%
root@nginx_reverse:/ # pkg update
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
root@nginx_reverse:/ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
root@nginx_reverse:/ #


No error about repositories. Nothing to update at this point since I'm back to the normal quarterly repo, but I think we'll be fine.
Thanks for helping me look at this further. I was afraid I would have to remake every jail I have (which I've already done with my Plex jail now).
 
Last edited:

charlyGREEN

Dabbler
Joined
Feb 21, 2017
Messages
18
Nah, that file does not exist by default in the jails. They seem to be configured elsewhere to use the quarterly update manifest and not the latest. But you did give me an idea... I know I can create that file and point it to the Latest packages for FreeBSD, so I tried that, and it also did not work. I was still getting the same error as FlyingPersian.

But I think I just found the solution: pkg bootstrap -f

Thanks a lot you saved me from a whole day reinstalling or something (and making a disaster prolly)
 

rovan

Dabbler
Joined
Sep 30, 2013
Messages
33
Thanks Seafox, that bootstrap command fixed my pkg file. cheers mate :)
 
Top