Solved Corrupted pkg database?

amiramix

Member

Reaction score: 4
Messages: 93

Code:
root@server:~ # pkg version
bash-4.3.42_1  =
ca_root_nss-3.20.1  =
cpdup-1.17_2  =
curl-7.44.0  <
cvsps-2.1_1  =
expat-2.1.0_3  =
gettext-0.19.5.1  <
gettext-runtime-0.19.5.1  <
gettext-tools-0.19.5.1  <
git-2.6.1  <
indexinfo-0.2.3  <
libffi-3.2.1  =
p5-Authen-SASL-2.16_1  =
p5-Digest-HMAC-1.03_1  =
p5-Error-0.17024  =
p5-GSSAPI-0.28_1  =
p5-IO-Socket-IP-0.37  =
p5-IO-Socket-SSL-2.016  <
p5-MIME-Base64-3.15  =
p5-Mozilla-CA-20141217  =
p5-Net-SMTP-SSL-1.03  =
p5-Net-SSLeay-1.72  =
p5-Socket-2.020  <
perl5-5.20.3_8  =
pkg-1.6.1  <
python27-2.7.10_1  <
smartmontools-6.4_1  =

Code:
root@server:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.

Any suggestions?
 

tobik@

Daemon
Developer

Reaction score: 1,420
Messages: 1,909

Try running pkg update -f to force refetch the repository catalogue.
 
OP
amiramix

amiramix

Member

Reaction score: 4
Messages: 93

nope

Code:
root@server:~ # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%  944 B  0.9kB/s  00:01  
Fetching packagesite.txz: 100%  5 MiB  5.5MB/s  00:01  
Processing entries: 100%
FreeBSD repository update completed. 24495 packages processed.
  
root@server:~ # pkg version
bash-4.3.42_1  =
ca_root_nss-3.20.1  =
cpdup-1.17_2  =
curl-7.44.0  <
cvsps-2.1_1  =
expat-2.1.0_3  =
gettext-0.19.5.1  <
gettext-runtime-0.19.5.1  <
gettext-tools-0.19.5.1  <
git-2.6.1  <
indexinfo-0.2.3  <
libffi-3.2.1  =
p5-Authen-SASL-2.16_1  =
p5-Digest-HMAC-1.03_1  =
p5-Error-0.17024  =
p5-GSSAPI-0.28_1  =
p5-IO-Socket-IP-0.37  =
p5-IO-Socket-SSL-2.016  <
p5-MIME-Base64-3.15  =
p5-Mozilla-CA-20141217  =
p5-Net-SMTP-SSL-1.03  =
p5-Net-SSLeay-1.72  =
p5-Socket-2.020  <
perl5-5.20.3_8  =
pkg-1.6.1  <
python27-2.7.10_1  <
smartmontools-6.4_1  =
  
root@server:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.

Also check this (in a jail):

Code:
root@msa1:/ # pkg version
Updating FreeBSD repository catalogue...
pkg: Unable to downgrade "FreeBSD" repo schema version 2012 (target version 2011) -- change not found
pkg: need to re-create repo FreeBSD to upgrade schema version
[msa1.server.com] Fetching meta.txz: 100%  944 B  0.9kB/s  00:01  
[msa1.server.com] Fetching packagesite.txz: 100%  5 MiB  5.6MB/s  00:01  
Unable to create repository FreeBSD
Unable to update repository FreeBSD
All repositories are up-to-date.
pkg: warning: database version 32 is newer than libpkg(3) version 31, but still compatible
pkg: Repo FreeBSD needs schema downgrade from 2012 to 2011 but it is opened readonly
pkg: need to re-create repo FreeBSD to upgrade schema version
pkg: Repository FreeBSD cannot be opened. 'pkg update' required
cyrus-sasl-2.1.26_9  ?
cyrus-sasl-saslauthd-2.1.26_1  ?
pkg-1.5.4  ?
sendmail+tls+sasl2-8.15.1_2  ?
   
root@msa1:/ # pkg upgrade -f
Updating FreeBSD repository catalogue...
pkg: Unable to downgrade "FreeBSD" repo schema version 2012 (target version 2011) -- change not found
pkg: need to re-create repo FreeBSD to upgrade schema version
[msa1.server.com] Fetching meta.txz: 100%  944 B  0.9kB/s  00:01  
[msa1.server.com] Fetching packagesite.txz: 100%  5 MiB  5.6MB/s  00:01  
Unable to create repository FreeBSD
Unable to update repository FreeBSD
All repositories are up-to-date.
pkg: warning: database version 32 is newer than libpkg(3) version 31, but still compatible
pkg: Repo FreeBSD needs schema downgrade from 2012 to 2011 but it is opened readonly
pkg: need to re-create repo FreeBSD to upgrade schema version
pkg: Repository FreeBSD cannot be opened. 'pkg update' required
Checking for upgrades (4 candidates): 100%
Processing candidates (4 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,299
Messages: 38,814

What version of FreeBSD? And can you post the output of pkg -vv?
 
OP
amiramix

amiramix

Member

Reaction score: 4
Messages: 93

Code:
root@server:~ # freebsd-version
10.2-RELEASE-p8

Code:
root@server:~ # pkg -vv
Version  : 1.6.1
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-10";
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:10:amd64";  
ALTABI = "freebsd:10: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.6.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'";  
  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:
  FreeBSD: {
  url  : "pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly",
  enabled  : yes,
  priority  : 0,
  mirror_type  : "SRV",
  signature_type  : "FINGERPRINTS",
  fingerprints  : "/usr/share/keys/pkg"
  }
 
OP
amiramix

amiramix

Member

Reaction score: 4
Messages: 93

Today I did pkg upgrade and the issue was automagically fixed. I restarted the server a few days ago so maybe this fixed something? Nevertheless, now when I do pkg version I get this and I am curious why a package would be in a version than in ports?:

Code:
root@server:~ # pkg version
bash-4.3.42_1  =
ca_root_nss-3.20.1  =
cpdup-1.17_2  =
curl-7.46.0_1  =
cvsps-2.1_1  =
expat-2.1.0_3  =
gettext-0.19.6  =
gettext-runtime-0.19.6  =
gettext-tools-0.19.6  =
git-2.6.4  =
indexinfo-0.2.4  =
libffi-3.2.1  =
p5-Authen-SASL-2.16_1  =
p5-Digest-HMAC-1.03_1  =
p5-Error-0.17024  =
p5-GSSAPI-0.28_1  =
p5-IO-Socket-IP-0.37  =
p5-IO-Socket-SSL-2.021  =
p5-MIME-Base64-3.15  =
p5-Mozilla-CA-20141217  =
p5-Net-SMTP-SSL-1.03  =
p5-Net-SSLeay-1.72  =
p5-Socket-2.021  =
perl5-5.20.3_8  =
pkg-1.6.2  =
python27-2.7.11_1  >
smartmontools-6.4_1  =
 
Last edited by a moderator:
OP
amiramix

amiramix

Member

Reaction score: 4
Messages: 93

Also, the issue still persists in the jail:

Code:
root@msa1:~ # pkg upgrade -f
Updating FreeBSD repository catalogue...
pkg: Unable to downgrade "FreeBSD" repo schema version 2012 (target version 2011) -- change not found
pkg: need to re-create repo FreeBSD to upgrade schema version
[msa1.earth.yoonka.com] Fetching meta.txz: 100%  944 B  0.9kB/s  00:01   
[msa1.earth.yoonka.com] Fetching packagesite.txz: 100%  5 MiB  2.8MB/s  00:02   
Unable to create repository FreeBSD
Unable to update repository FreeBSD
All repositories are up-to-date.
pkg: warning: database version 32 is newer than libpkg(3) version 31, but still compatible
pkg: Repo FreeBSD needs schema downgrade from 2012 to 2011 but it is opened readonly
pkg: need to re-create repo FreeBSD to upgrade schema version
pkg: Repository FreeBSD cannot be opened. 'pkg update' required
Checking for upgrades (4 candidates): 100%
Processing candidates (4 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
    
root@msa1:~ # pkg version
Updating FreeBSD repository catalogue...
pkg: Unable to downgrade "FreeBSD" repo schema version 2012 (target version 2011) -- change not found
pkg: need to re-create repo FreeBSD to upgrade schema version
[msa1.earth.yoonka.com] Fetching meta.txz: 100%  944 B  0.9kB/s  00:01   
[msa1.earth.yoonka.com] Fetching packagesite.txz: 100%  5 MiB  2.8MB/s  00:02   
Unable to create repository FreeBSD
Unable to update repository FreeBSD
All repositories are up-to-date.
pkg: warning: database version 32 is newer than libpkg(3) version 31, but still compatible
pkg: Repo FreeBSD needs schema downgrade from 2012 to 2011 but it is opened readonly
pkg: need to re-create repo FreeBSD to upgrade schema version
pkg: Repository FreeBSD cannot be opened. 'pkg update' required
cyrus-sasl-2.1.26_9  ?
cyrus-sasl-saslauthd-2.1.26_1  ?
pkg-1.5.4  ?
sendmail+tls+sasl2-8.15.1_2  ?
    
root@msa1:~ # pkg -vv
Version  : 1.5.4
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-10";
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:10:amd64";
ALTABI = "freebsd:10: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 = "";
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'";
  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;
    
    
Repositories:
  FreeBSD: {
  url  : "pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/latest",
  enabled  : yes,
  priority  : 0,
  mirror_type  : "SRV",
  signature_type  : "FINGERPRINTS",
  fingerprints  : "/usr/share/keys/pkg"
  }
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,299
Messages: 38,814

The host is using quarterly packages and the jail is using the latest.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,299
Messages: 38,814

The default pkg(8) repository set in /etc/pkg/FreeBSD.conf now defaults to the quarterly package set. To use the latest branch (as was the previous default), the comment at the top of /etc/pkg/FreeBSD.conf explains how to disable the default repository and specify an alternative repository. [r285830] (Sponsored by The FreeBSD Foundation)
https://www.freebsd.org/releases/10.2R/relnotes.html#releng-changes
 
OP
amiramix

amiramix

Member

Reaction score: 4
Messages: 93

This has been fixed now. I installed poudriere on another server, configured the packages installed on the server in question, compiled everything, and set up a pkg repository through Nginx. Then on the server on which I had the problem I disabled the official FreeBSD package repository and enabled the one I just created. After that I had to do pkg upgrade / pkg update a couple of times on both, the main server and in jails, and voilà, all package databases were eventually fixed and now they all report proper versions. I still don't know what caused the main problem but I don't care about that anymore. Thanks to all who tried to help.
 
Last edited by a moderator:
Top