Corrupt package database

Since I've had problems upgrading packages using pkgng, I went upgrading things through the ports system.


This is what I did:
Code:
# portsnap fetch update

I found apache22, pkg amongst other available updates.
I started with apache22

Code:
# cd /usr/ports/www/apache22
# make deinstall
# make reinstall
# /usr/local/etc/rc.d/apache22 restart

So far so good.

I went further to pkgng.

Code:
# cd /usr/ports/ports-mgmt/pkg
# make
/usr/ports/ports-mgmt/pkg/work/pkg-1.0.2/pkg-static/pkg-static: not found
*** Error code 127

Stop in /usr/ports/ports-mgmt/pkg.
#

I commented out WITH_PKGNG in make.conf and tried again.

Code:
# cd /usr/ports/ports-mgmt/pkg
# make reinstall
# pkg2ng
pkg_info: the package info for package 'apache22-2.2.23' is corrupt
usage: pkg info <pkg-name>
       pkg info -a
       pkg info [-eDgxXdrlBsqOf] <pkg-name>
       pkg info [-drlBsqfR] -F <pkg-file>

For more information see 'pkg help info'.
pkg_info: the package info for package 'apache22-2.2.23' is corrupt
make: don't know how to make showconfig. Stop
cat: /var/db/pkg/apache22-2.2.23/+COMMENT: No such file or directory
pkg_info: the package info for package 'apache22-2.2.23' is corrupt
egrep: /var/db/pkg/apache22-2.2.23/+CONTENTS: No such file or directory
pkg: open(/tmp/pkg2nguKSWh/+DESC): No such file or directory
Segmentation fault (core dumped)
Registration of apache22-2.2.23 failed.
name: apache22
version: 2.2.23
origin: 
comment: |
  maintainer: 
prefix: 
licenselogic: single
deps:
pkg_info: the package info for package 'bash-completion-2.0,1' is corrupt
usage: pkg info <pkg-name>
       pkg info -a
       pkg info [-eDgxXdrlBsqOf] <pkg-name>
       pkg info [-drlBsqfR] -F <pkg-file>

For more information see 'pkg help info'.
pkg_info: the package info for package 'bash-completion-2.0,1' is corrupt
make: don't know how to make showconfig. Stop
cat: /var/db/pkg/bash-completion-2.0,1/+COMMENT: No such file or directory
pkg_info: the package info for package 'bash-completion-2.0,1' is corrupt
egrep: /var/db/pkg/bash-completion-2.0,1/+CONTENTS: No such file or directory
pkg: open(/tmp/pkg2ngzZChK/+DESC): No such file or directory
Segmentation fault (core dumped)
Registration of bash-completion-2.0,1 failed.
name: bash-completion
version: 2.0,1
origin: 
comment: |
  maintainer: 
prefix: 
licenselogic: single
deps:
pkg_info: the package info for package 'p5-HTTP-Message-6.06' is corrupt
usage: pkg info <pkg-name>
       pkg info -a
       pkg info [-eDgxXdrlBsqOf] <pkg-name>
       pkg info [-drlBsqfR] -F <pkg-file>

For more information see 'pkg help info'.
pkg_info: the package info for package 'p5-HTTP-Message-6.06' is corrupt
make: don't know how to make showconfig. Stop
cat: /var/db/pkg/p5-HTTP-Message-6.06/+COMMENT: No such file or directory
pkg_info: the package info for package 'p5-HTTP-Message-6.06' is corrupt
egrep: /var/db/pkg/p5-HTTP-Message-6.06/+CONTENTS: No such file or directory
pkg: open(/tmp/pkg2ngcjVWS/+DESC): No such file or directory
Segmentation fault (core dumped)
Registration of p5-HTTP-Message-6.06 failed.
name: p5-HTTP-Message
version: 6.06
origin: 
comment: |
  maintainer: 
prefix: 
licenselogic: single
deps:
pkg_info: the package info for package 'p5-Net-SSLeay-1.49' is corrupt
usage: pkg info <pkg-name>
       pkg info -a
       pkg info [-eDgxXdrlBsqOf] <pkg-name>
       pkg info [-drlBsqfR] -F <pkg-file>

For more information see 'pkg help info'.
pkg_info: the package info for package 'p5-Net-SSLeay-1.49' is corrupt
^C
#
# pkg2ng
Conversion has been successfully finished
Your old packages database has been moved to: /var/db/pkg.bak.

Yes, I did interrupt the pkg2ng conversion thinking this was a bad idea.
I know this wasn't very thoughtful, so please be polite. I want to solve this.

I've got two backups:
/var/db/pkg.bak which I think is created by pkg2ng when I first started using pkgng (the modification date of the directory leads me to that conclusion)
Contents:
130 package directories, no auditfile or SQLite database files. I guess this is non-pkgng related stuff.

/var/db/pkg.bak2 created by me, just before the pkgng upgrade attempt.
/var/db/pkg is empty.
Contents:
Code:
# ls -l
total 91893
drwxr-xr-x  2 root  wheel         3 Nov 20 11:59 apache22-2.2.23/
-r--r--r--  1 root  wheel    693224 Nov 20 11:59 auditfile
drwxr-xr-x  2 root  wheel         3 Nov 20 11:59 bash-completion-2.0,1/
-rw-r--r--  1 root  wheel   5506048 Nov 20 11:59 local.sqlite
drwxr-xr-x  2 root  wheel         3 Nov 20 11:59 p5-HTTP-Message-6.06/
drwxr-xr-x  2 root  wheel         3 Nov 20 11:59 p5-Net-SSLeay-1.49/
drwxr-xr-x  2 root  wheel         7 Nov 20 11:59 pkg-1.0.2/
-rw-r--r--  1 root  wheel  87436288 Nov 20 11:59 repo.sqlite


I hope this helps

So, suggestions?
 
I'm able to restore some of it from pkg.bak2
Code:
# cd /var/db
# cp -r pkg pkg.corrupted
# cp -r pkg.bak2/* pkg

So this leaves me with a database not including the pkgng package.
How would I reinstall it properly?

(and I'm still interested in how to handle package upgrades. I know some people are using a jail to build custom packages, would this be an appropriate option?)

Edit:
Well, I guess I solved it and I hope the pkg.bak2 backup was enough.
I ended up reinstalling pkg using ports (with WITH_PKGNG set to YES in make.conf). This fixed the needed metadata in the pkg database.
Code:
# make deinstall
===>  Deinstalling for ports-mgmt/pkg
===>   pkg not installed, skipping
# make reinstall

It suggests me to run pkg2ng. This time, I didn't.

I'm still curious on how to manage upgrades with pkgng though. Have a look at my updated problem description in this thread.
 
I am a little confused about [CMD=""]pkg[/CMD] and [CMD=""]pkg2ng[/CMD], in order to set my system ready, I am trying with [CMD=""]portmaster[/CMD] "Using portmaster to do a complete reinstallation of all your ports:" seeing at [CMD=""]man portmaster[/CMD] then [CMD=""]portmaster -a -f -D[/CMD]

Code:
server# pkg_info
pkg_info: the package info for package 'autoconf-2.69' is corrupt
pkg_info: the package info for package 'automake-1.12.4' is corrupt
pkg_info: the package info for package 'cyrus-sasl-2.1.25_2' is corrupt
pkg_info: the package info for package 'db46-4.6.21.4' is corrupt
pkg_info: the package info for package 'gettext-0.18.1.1' is corrupt
pkg_info: the package info for package 'gmake-3.82_1' is corrupt
pkg_info: the package info for package 'help2man-1.40.13' is corrupt
pkg_info: the package info for package 'isc-dhcp42-server-4.2.4_2' is corrupt
pkg_info: the package info for package 'libiconv-1.14' is corrupt
pkg_info: the package info for package 'libltdl-2.4.2' is corrupt
pkg_info: the package info for package 'libsigsegv-2.10' is corrupt
pkg_info: the package info for package 'libtool-2.4.2' is corrupt
pkg_info: the package info for package 'm4-1.4.16_1,1' is corrupt
pkg_info: the package info for package 'makedepend-1.0.3,1' is corrupt
pkg_info: the package info for package 'openldap-sasl-client-2.4.33' is corrupt
pkg_info: the package info for package 'p5-Locale-gettext-1.05_3' is corrupt
pkg_info: the package info for package 'perl-5.16.2' is corrupt
pkg_info: the package info for package 'pkg-1.0.3_1' is corrupt
pkg_info: the package info for package 'pkgconf-0.8.9' is corrupt
pkg_info: the package info for package 'portmaster-3.14_8' is corrupt
pkg_info: the package info for package 'sqlite34-3.4.2' is corrupt
pkg_info: the package info for package 'sudo-1.8.6.p3_1' is corrupt
pkg_info: the package info for package 'tcl-8.5.13' is corrupt
pkg_info: the package info for package 'tcl-modules-8.5.13' is corrupt
pkg_info: the package info for package 'xproto-7.0.22' is corrupt
server# pkg info
autoconf-2.69                  Automatically configure source code on many Un*x platforms
autoconf-wrapper-20101119      Wrapper script for GNU autoconf
automake-1.12.4                GNU Standards-compliant Makefile generator
automake-wrapper-20101119      Wrapper script for GNU automake
cyrus-sasl-2.1.25_2            RFC 2222 SASL (Simple Authentication and Security Layer)
db46-4.6.21.4                  The Berkeley DB package, revision 4.6
gettext-0.18.1.1               GNU gettext package
gmake-3.82_1                   GNU version of 'make' utility
help2man-1.40.13               Automatically generating simple manual pages from program output
isc-dhcp42-server-4.2.4_2      The ISC Dynamic Host Configuration Protocol server
libiconv-1.14                  A character set conversion library
libltdl-2.4.2                  System independent dlopen wrapper
libsigsegv-2.10                Handling page faults in user mode
libtool-2.4.2                  Generic shared library support script
m4-1.4.16_1,1                  GNU m4
makedepend-1.0.3,1             A dependency generator for makefiles
openldap-sasl-client-2.4.33    Open source LDAP client implementation with SASL2 support
p5-Locale-gettext-1.05_3       Message handling functions
perl-5.16.2                    Practical Extraction and Report Language
pkg-1.0.3_1                    New generation package manager
pkgconf-0.8.9                  Utility to help to configure compiler and linker flags
portmaster-3.14_8              Manage your ports without external databases or languages
sqlite34-3.4.2                 An SQL database engine in a C library
sudo-1.8.6.p3_1                Allow others to run commands as root
tcl-8.5.13                     Tool Command Language
tcl-modules-8.5.13             Tcl common modules
xproto-7.0.22                  X11 protocol headers
server#
At this time I Will not must be used: [CMD=""]pkg2ng[/CMD], I think, in order to avoid conflicts
Anybody knows a best tutorial about this ??
 
Do you have this in /etc/make.conf ?
Code:
WITH_PKGNG=yes

What does this say if you run it?

# portmaster --version

You probably have an out of date version of ports-mgmt/portmaster that is not aware of PKGNG.
 
Code:
server# cat /etc/make.conf
WITH_PKGNG=yes
# added by use.perl 2012-12-09 07:22:56
PERL_VERSION=5.16.2
server#
and
Code:
server# portmaster --version

===>>> Version 3.14 (pkgng patch 1.6)
server#

That U you see all is "Up to date", Thanks for the reply
 
For portmaster I tried:
Code:
20121015:
  AFFECTS: users of ports-mgmt/portmaster
  AUTHOR: bdrewery@FreeBSD.org

  Portmaster now supports pkgng. To use pkgng, enable the patch in the port,
  enable pkgng in your make.conf, and convert your existing /var/db/pkg
  database. Also see UPDATING entry 20121010 if you are on a recent CURRENT
  and do not want to use pkg.

  This is optional and not currently required.

  # make -C /usr/ports/ports-mgmt/pkg install clean
  # make -C /usr/ports/ports-mgmt/portmaster config build deinstall install clean
  # echo 'WITH_PKGNG=yes' >> /etc/make.conf
  # pkg2ng
 
Back
Top