Ah crap! pkg_version: the package info for package '...' is corrupt

Matthew Seaman matthew at FreeBSD.org
Sat Mar 30 08:38:16 UTC 2013

On 30/03/2013 08:17, Ronald F. Guilmette wrote:
> Today my system crashed twice while I was doing "portupgrade -a".
> I'm not sure but I suspect the new cards I have installed recently may
> just be a bit too much for the old power supply I have.  (When the thing
> crashed, the machine just simply shut itself off.  This exact same thing
> has also happened a couple of other times in the past week.)
> I'll deal with the power issue soon, but right now I am more worried about
> this new, different, and additional problem I seem to have created for
> myself.  When I run pkg_version, I am getting a bunch of messages of
> the following general form:
>    pkg_version: the package info for package 'PKG' is corrupt
> where `PKG' is the name of some package or another that I have installed.
> I have at least 6 such messages for different packages I have installed...
> and probably more.

Are you using pkgng?  If so, you'll get the "'PKG' is corrupt" message
for everything when you use pkg_version.  That's because on a pkgng-ized
you should instead be using 'pkg version'.  Same command flags, just
s/_/ /.

> I googled around a bit and did not find any good explanation for the
> above error or, more importantly, what to do about it.
> I gather however that my package data base has become corrupted.
> OK, so how does one rebuild that from scratch?
> Please don't tell me that I have to reinstall every bleedin' port from
> scratch!
> Regards,
> rfg
> P.S.  Oh!  I just remembered.  I made a full system backup quite recently...
> thank god.  Do I just simply need to get the entire contents of /var/db/pkg/
> from that and then do "rm -fr /var/db/pkg" and then copy my backup copy
> of /var/db/pkg to the real /var/db/pkg ?
> Hummm.. that won't reflect the several things that _did_ managed to get
> updated, you know, before my system crashed.

Assuming you *aren't* on a pkgng-ized system:

If you have a recent backup of /var/db/pkg then you should restore from
there.  If you installed or updated any ports between taking the backup
and the crash, then reinstalling those ports will fixup the /var/db/pkg
entries for them.



Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 268 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20130330/43d15975/attachment.sig>

More information about the freebsd-questions mailing list