Subject: corrupted pkg database
To: None <netbsd-help@netbsd.org>
From: Lubos Vrbka <shnek@chemi.muni.cz>
List: netbsd-help
Date: 01/07/2003 15:11:21
hi,

this problem is continuing of the CVS update issue... i couldn't get the 
newest pkgsrc tree using cvs update -dP, so i finally decided to 
checkout the whole pkgsrc tree ( i backed up the old one). then i tried 
to run make update for the fluxbox package.
the x11-links package needs to be updated, but the make wasn't able to 
do that. it advised me to set FORCE_PKG_REGISTER,but even after setting 
this up the result is:

snail# make update
===> Deinstalling for fluxbox-0.1.14
Running PKG_DBDIR=/var/db/pkg /usr/sbin/pkg_delete -r fluxbox-0.1.8
pkg_delete: cannot open pkgdb: No such file or directory
=> Checksum OK for fluxbox-0.1.14.tar.bz2.
===> Extracting for fluxbox-0.1.14
===> Required package bsetroot>=0.1nb1: NOT found
===> Verifying update for ../../wm/bsetroot
===> Resuming update for bsetroot-0.1nb1
=> Checksum OK for blackbox-0.65.0.tar.gz.
===> Extracting for bsetroot-0.1nb1
===> Required package x11-links>=0.10: NOT found
===> Verifying update for ../../pkgtools/x11-links
===> Resuming update for x11-links-0.10
===> Installing for x11-links-0.10
install -d -o root -g wheel -m 555 /usr/pkg/share/x11-links
cd /usr/pkgsrc/pkgtools/x11-links/work/.buildlink && 
         /bin/cp -R include lib /usr/pkg/share/x11-links
/usr/sbin/chown -R root:wheel /usr/pkg/share/x11-links
/bin/cat /usr/pkgsrc/pkgtools/x11-links/PLIST > 
/usr/pkgsrc/pkgtools/x11-links/work/.PLIST_SRC
cd /usr/pkg; /usr/bin/find share/x11-links \! -type d -print     | 
/usr/bin/sed "s|^\./||g" | /usr/bin/sort -u >> 
/usr/pkgsrc/pkgtools/x11-links/work/.PLIST_SRC
echo "@unexec /bin/rm -rf %D/share/x11-links" >> 
/usr/pkgsrc/pkgtools/x11-links/work/.PLIST_SRC
===> [Automatic ELF shared object handling]
pkg_delete: cannot open /var/db/pkg/pkgdb.byfile.db: Undefined error: 0
*** Error code 1

i'm not able to deinstall/update any package existing in the computer. 
for example:
snail# make deinstall
===> Deinstalling for xosview-1.7.0b
Running PKG_DBDIR=/var/db/pkg /usr/sbin/pkg_delete xosview-1.7.0b
pkg_delete: cannot open pkgdb: No such file or directory

adding new software is also problem - it's compiled ok and works, but 
when registering the installation:
===> Registering installation for xsnow-1.42
pkg_create: can't open pkgdb: Undefined error: 0
*** Error code 1

it seems that the database is corrupted, but i don't know when did it 
occur. i didn't have any system crash and in the morning everything was 
ok. it seems that it started when i used new checkout'ed pkgsrc tree.

is there any way how to restore the db file?

snail# ls -la pkgdb.byfile.db
-rw-r--r--  1 root  wheel  6254592 Jan  7 10:48 pkgdb.byfile.db

in case that not, what will be the solution? delete the contents of 
/var/db/pkg and installing software again? won't it collide? or should i 
reinstall whole system?

i was thinking about posting this to netbsd-users,too - do you advise me 
to do that? there's probably wider forum...

thanks for any help,

lubos
_@_:

-- 
-
#################################################
Lubos Vrbka
National Centre for Biomolecular Research
Masaryk university, Brno, Czech Republic

shnek@chemi.muni.cz
http://www.chemi.muni.cz/~shnek
tel. +420 541 129 508
#################################################