pkg unable to find catalogs

I completely followed this instruction: https://wiki.freebsd.org/pkgng. Now if I type pkg install portupgrade this thing is always happening:
Code:
Updating repository catalogue
digests.txz 100%
packagesite.txz 100%
Incremental update completed, 23171 packages processed:
0 packages updated, 0 removed and 23171 added.
pkg: unable to find catalogs

It seems pkg cannot find something :). What is the problem? My pkg version is pkg-1.2.4-1.
 
Can you show us what's in /var/db/pkg/? There should be a couple of files there.

Code:
root@molly:~ # ll /var/db/pkg/
total 16916
-r--r--r--  1 root  wheel    769562 Dec 27 03:50 auditfile
-rw-r--r--  1 root  wheel  12484608 Jan  7 10:34 local.sqlite
-rw-r--r--  1 root  wheel    745472 Jan  9 10:53 repo-dicelan.sqlite
-r--r--r--  1 root  wheel   3052308 Jan  9 03:51 vuln.xml
 
Code:
ls -l /var/db/pkg
total 1556
-rw-r--r-- 1 root wheel 1467392 Jan 9 18:00 local.sqlite
drwxr-xr-x 2 root wheel 512 Jan 9 11:45 pkg-1.1.4_1
-rw-r--r-- 1 root wheel 38912 Jan 9 07:51 repo-FreeBSD.sqlite
-rw-r--r-- 1 root wheel 38912 Jan 9 07:51 repo-packagesite.sqlite

I did rm /var/db/pkg/repo-*.sqlite and pkg update again.

Code:
pkg -vv
...
Repositories:
 FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/freebsd:9:x86:32/latest",
  enabled: yes,
  mirror_type: "SRV"
}

Sorry for having typed the output of the commands manually. because I installed freebsd FreeBSD on a virtual machine and couldn't copy paste.
 
As long as the data you posted is reasonably correct that shouldn't matter. Helpful tip: enable SSH on the VM, then you can use PuTTY from the host to SSH into it. That makes working a little easier because you can have a bigger screen (with scrollbar) and you can copy/paste.

You need to run pkg2ng at least once to get the registration for ports-mgmt/pkg correct. It's still registered with the old system. As for the original problem try removing those repo-* files, see if that helps; rm /var/db/pkg/repo-*. Whatever you do, do NOT remove that local.sqlite file! It contains all your local package registrations.
 
SirDice said:
.

You need to run pkg2ng at least once to get the registration for ports-mgmt/pkg correct. It's still registered with the old system.

No, I don't think that is the case. The /var/db/pkg/<pkgname> directories are still used to track the distfiles in case you compile a port and use PKGNG packages. It's a shortcoming of the PKGNG system sure but there's no better system yet in place.
 
kpa said:
The /var/db/pkg directories are still used to track the distfiles in case you compile a port and use PKGNG packages.
I don't think so. I regularly mix ports with PKGNG and there are no subdirectories in /var/db/pkg/. The only time you get subdirectories there is with the old package system. That usually happens when you forget to add WITH_PKGNG in make.conf and build a port.

On a clean FreeBSD 8.x or 9.x system the first time you install ports-mgmt/pkg from ports it installs itself with the old package registration. And you need to run pkg2ng afterwards to get it to register correctly with the new system.
 
SirDice said:
I don't think so. I regularly mix ports with pkgng and there are no subdirectories in /var/db/pkg/. The only time you get subdirectories there is with the old package system. That usually happens when you forget to add WITH_PKGNG in make.conf and build a port.

On a clean FreeBSD 8.x and 9.x system the first time you install ports-mgmt/pkg from ports it installs itself with the old package registration. And you need to run pkg2ng afterwards to get it to register correctly with the new system.

When I first use the pkg command, it asked me to install that and I did 'yes'. After the installation I did pkg2ng.
Code:
root@freeaipo:~ # vi /etc/make.conf
WITH_PKGNG= yes

# added by use.perl 2014-01-09 17:06:55
PERL_VERSION=5.14.4

But now I am really confused.
Code:
# pkg2ng
Converting packages from /var/db/pkg
Converting pkg-1.1.4_1...
pkg: lstat(/usr/local/share/licenses/pkg-1.1.4_1/catalog.mk): No such file or directory
pkg: lstat(/usr/local/share/licenses/pkg-1.1.4_1/LICENSE): No such file or directory
pkg: lstat(/usr/local/share/licenses/pkg-1.1.4_1/BSD): No such file or directory
pkg: lstat(/usr/local/etc/periodic/daily/400.status-pkg): No such file or directory
pkg: lstat(/usr/local/share/licenses/pkg-1.1.4_1/): No such file or directory
pkg: fopen(/usr/ports/Keywords/display.yaml): No such file or directory
pkg: unknown keyword display, ignoring @display
Installing pkg-1.1.4_1... done

Code:
# pkg version
pkg-1.1.4_1                        =
I don't understand how the package version changed from 1.2.4 to 1.1.4.

Code:
# ll /usr/local/share/licenses/
total 20
drwxr-xr-x  2 root  wheel  512 Jan  9 17:36 help2man-1.43.3/
drwxr-xr-x  2 root  wheel  512 Jan  9 17:06 perl-5.14.4/
drwxr-xr-x  2 root  wheel  512 Dec 19 18:47 pkg-1.2.4_1/
drwxr-xr-x  2 root  wheel  512 Jan  9 17:38 pkgconf-0.9.2_1/
Is that saying something?
 
I did the command below:
Code:
# cd /usr/ports/ports-mgmt/pkg
# make reinstall
...
# pkg2ng

After it finished, when I try to install a program using pkg:
Code:
# pkg install portupgrade
pkg: Invalid configuration format, ignoring the configuration file
Updating repository catalogue
pkg: re-creating repo to upgrade schema version from 2006 to 2005
pkg: pkg+http://pkg.FreeBSD.org/freebsd:9:x86:32/latest/digests.txz: Invalid URL scheme
pkg: No digest falling back on legacy catalog format
pkg: pkg+http://pkg.FreeBSD.org/freebsd:9:x86:32/latest/repo.txz: Invalid URL scheme
 
If I remember correctly, you need to run pkg2ng before adding
Code:
WITH_PKGNG= yes
to /etc/make.conf.
 
SirDice said:
kpa said:
The /var/db/pkg directories are still used to track the distfiles in case you compile a port and use PKGNG packages.
I don't think so. I regularly mix ports with pkgng and there are no subdirectories in /var/db/pkg/. The only time you get subdirectories there is with the old package system. That usually happens when you forget to add WITH_PKGNG in make.conf and build a port.

On a clean FreeBSD 8.x and 9.x system the first time you install ports-mgmt/pkg from ports it installs itself with the old package registration. And you need to run pkg2ng afterwards to get it to register correctly with the new system.

I remember now, it's actually ports-mgmt/portmaster that uses those directories to track the distfiles. Sorry for the noise.
 
Regarding /var/db/pkg/pkg-1.1.4_1/, here's what I think happened. At some point you installed ports-mgmt/pkg from ports. This installed pkg-1.1.4_1 but registered it with the old system. Later on you probably used pkg to update pkg (or you did use ports and had WITH_PKGNG in make.conf), this added the registration for pkg-1.2.4_1 in the new system. However this doesn't remove the old registration, only pkg2ng can do that. Hence pkg_info(1) still thinks pkg-1.1.4_1 is installed but pkg(8) has pkg-1.2.4_1.

If pkg(8) is working correctly you can safely remove the old registration directory ( rm -rf /var/db/pkg/pkg-1.1.4_1/).
 
@SirDice you are right. I deinstalled pkg-1.1.4_1 from ports. Did portsnap fetch extract update and make install again. It has worked. Thank you all.
 
Last edited by a moderator:
I too am having this issue. However, my version is 1.2.5 and everything looks to be in place. This is on a brand new install. The only oddity being that I installed on 9.0 and upgraded to 9.1 via the freebsd-update process.

make.conf
Code:
WITH_PKGNG=yes

Code:
root@myhost:/usr/ports/ports-mgmt/pkg # pkg -vv
Version                 : 1.2.5
PACKAGESITE             : 
PKG_DBDIR               : /var/db/pkg
PKG_CACHEDIR            : /var/cache/pkg
PORTSDIR                : /usr/ports
PUBKEY                  : 
HANDLE_RC_SCRIPTS       : no
ASSUME_ALWAYS_YES       : no
REPOS_DIR               : [
  /etc/pkg/,
  /usr/local/etc/pkg/repos/,
]
PLIST_KEYWORDS_DIR      : 
SYSLOG                  : yes
AUTODEPS                : yes
ABI                     : freebsd:9:x86:64
DEVELOPER_MODE          : no
PORTAUDIT_SITE          : http://portaudit.FreeBSD.org/auditfile.tbz
VULNXML_SITE            : http://www.vuxml.org/freebsd/vuln.xml.bz2
MIRROR_TYPE             : SRV
FETCH_RETRY             : 3
PKG_PLUGINS_DIR         : /usr/local/lib/pkg/
PKG_ENABLE_PLUGINS      : yes
PLUGINS                 : [
]
DEBUG_SCRIPTS           : no
PLUGINS_CONF_DIR        : /usr/local/etc/pkg/
PERMISSIVE              : no
REPO_AUTOUPDATE         : yes
NAMESERVER              : 
EVENT_PIPE              : 
FETCH_TIMEOUT           : 30
UNSET_TIMESTAMP         : no
SSH_RESTRICT_DIR        : 
PKG_SSH_ARGS            : 
PKG_ENV                 : {
}
DISABLE_MTREE           : no
DEBUG_LEVEL             : 0
ALIAS                   : {
}

Repositories:
  FreeBSD: { 
    url             : "pkg+http://pkg.FreeBSD.org/freebsd:9:x86:64/latest",
    enabled         : yes,
    mirror_type     : "SRV"
  }

Code:
root@myhost:/usr/ports/ports-mgmt/pkg # ls -lhaR /var/db/pkg
total 2836
drwxr-xr-x   3 root  wheel   512B Jan 17 20:52 .
drwxr-xr-x  10 root  wheel   512B Jan 17 19:54 ..
-rw-r--r--   1 root  wheel   2.7M Jan 17 20:52 local.sqlite
drwxr-xr-x   2 root  wheel   512B Jan 17 20:52 pkg-1.2.5
-rw-r--r--   1 root  wheel    38k Jan 15 08:16 repo-FreeBSD.sqlite

/var/db/pkg/pkg-1.2.5:
total 48
-rw-r--r--  1 root  wheel    31B Jan 17 20:52 +COMMENT
-rw-r--r--  1 root  wheel   4.9k Jan 17 20:52 +CONTENTS
-rw-r--r--  1 root  wheel    87B Jan 17 20:52 +DESC
-rw-r--r--  1 root  wheel    73B Jan 17 20:52 +DISPLAY
-rw-r--r--  1 root  wheel    17k Jan 17 20:52 +MTREE_DIRS
drwxr-xr-x  2 root  wheel   512B Jan 17 20:52 .
drwxr-xr-x  3 root  wheel   512B Jan 17 20:52 ..

Code:
root@myhost:/usr/ports/ports-mgmt/pkg # pkg info
apr-1.4.8.1.5.3                Apache Portability Library
autoconf-2.69                  Automatically configure source code on many Un*x platforms
autoconf-wrapper-20131203      Wrapper script for GNU autoconf
db42-4.2.52_5                  The Berkeley DB package, revision 4.2
dialog4ports-0.1.5_2           Console Interface to configure ports
expat-2.1.0                    XML 1.0 parser written in C
gdbm-1.11                      GNU database manager
help2man-1.43.3_1              Automatically generating simple manual pages from program output
libexecinfo-1.1_3              A library for inspecting program's backtrace
libffi-3.0.13_1                Foreign Function Interface
libidn-1.28_1                  Internationalized Domain Names command line tool
libtool-2.4.2_2                Generic shared library support script
libyaml-0.1.4_2                A YAML 1.1 parser and emitter written in C
m4-1.4.17,1                    GNU m4
p5-Locale-gettext-1.05_3       Message handling functions
perl5-5.16.3_6                 Practical Extraction and Report Language
pkg-1.2.5                      New generation package manager
portupgrade-2.4.12,2           FreeBSD ports/packages administration and management tool suite
py27-setuptools-2.0.1          Python packages installer
python2-2_2                    The "meta-port" for version 2 of the Python interpreter
python27-2.7.6_1               Interpreted object-oriented programming language
ruby-1.9.3.484,1               Object-oriented interpreted scripting language
ruby19-bdb-0.6.6_3             Ruby interface to Oracle Berkeley DB revision 2 or later
scons-2.3.0                    Build tool alternative to make
serf-1.3.2_1                   Serf HTTP client library
sqlite3-3.8.2                  SQL database engine in a C library
subversion-1.8.5               Version control system
wakeonlan-0.41                 Sends magic packets to WOL enabled NIC to switch on the called PC
wget-1.14_2                    Retrieve files from the Net via HTTP(S) and FTP

Code:
root@myhost:/usr/ports/ports-mgmt/pkg # pkg install bash
Updating repository catalogue
digests.txz                                                                                                                           100% 1069KB   1.0MB/s   1.0MB/s   00:00    
packagesite.txz                                                                                                                       100% 4948KB   4.8MB/s   4.6MB/s   00:01    
Incremental update completed, 22859 packages processed:
0 packages updated, 0 removed and 22859 added.
pkg: Unable to find catalogs

Code:
root@myhost:/usr/ports/ports-mgmt/pkg # pkg install git
Updating repository catalogue
digests.txz                                                                                                                           100% 1069KB   1.0MB/s   1.0MB/s   00:01    
packagesite.txz                                                                                                                       100% 4948KB   4.8MB/s   2.5MB/s   00:01    
Incremental update completed, 22859 packages processed:
0 packages updated, 0 removed and 22859 added.
pkg: Unable to find catalogs

Please let me know if you can see my mistake.

Thank you.
 
Back
Top