libpkg, sqlite and database problems prevent building any packages

Matthew Seaman matthew at freebsd.org
Mon Aug 5 14:03:58 UTC 2013


On 05/08/2013 14:30, Thomas Mueller wrote:
> I could see my pkg client is out of date, but how do I update it?
> 
> Attempts to update all gave me those error messages.  Installation fails.        

Your package database has got into an inconsistent state.  pkg(8) is
attempting to auto-update the schema to the latest version, but failing
because it's trying to remove an 'infos' column from a table where that
column has apparently already been removed.  (Likely this situation has
come about because pkg got killed in the middle of doing this update
previously.)

How happy are you to get down'n'dirty with the source code and running
SQL from the command line?  If you look at the updates pkg is attempting
to run shown here:

   https://github.com/freebsd/pkg/blob/master/libpkg/private/db_upgrades.h

would you be capable of looking at the DB schema, working out which of
those updates had been applied, aplying any outstanding ones by hand and
then setting the user version to 19 by:

   sql> PRAGMA user_version = 19 ;

?

If not, check in /var/backups for a good copy of your local.sqlite
database and try and restore from there.  Unfortunately, there's no
guarantee that any backup copy doesn't have the same inconsistencies as
your live copy.

We need to make pkg(8) databases more resilient to the effects of SIGHUP
or similar while they are elbows-deep in the bowels of the DB schema...

	Cheers,

	Matthew







More information about the freebsd-ports mailing list