pkg: sqlite: database disk image is malformed (pkgdb.c:1274)

Matthew Seaman matthew at
Sun Oct 13 19:41:50 UTC 2013

On 13/10/2013 20:24, Anton Shterenlikht wrote:
> My box crashed during "pkg upgrade".
> On reboot I get:
> # pkg update
> Updating repository catalogue
> pkg: sqlite: database disk image is malformed (pkgdb.c:1274)
> #
> What's broken?
> And how can I recover?

Not sure exactly what's broken, but you can usually recover by:

rm /var/db/pkg/repo-*.sqlite

and then use pkg as normal.  It's safe to delete the repo sqlite files
as all the information in them comes from the repository catalogues and
can be regenerated from source as desired.

Failing that, there should be a nightly backup in
/var/backups/pkgdb.bak.tbz but that can be up to a day old, so be
prepared to redo any package updates from the day in order to resynch it
with what's on the filesystem.



Dr Matthew J Seaman MA, D.Phil.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1036 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-ports mailing list