Re: Recover from a corrupt pkg DB
- In reply to: Baptiste Daroussin : "Re: Recover from a corrupt pkg DB"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Aug 2022 16:44:22 UTC
On Wed, Aug 31, 2022 at 12:33 AM Baptiste Daroussin <bapt@freebsd.org> wrote: > On Tue, Aug 30, 2022 at 09:36:52AM -0700, Kevin Oberman wrote: > > I had a crash while building ffmpeg on a new system. The build had not > > begun, so I don't think ffmpeg is really an issue. portmaster(8) was > > walking the dependency tree when the system panicked and, after a reboot > > and full fsck, I get the error: > > pkg: sqlite error while executing PRAGMA user_version; in file > > pkgdb.c:2357: database disk image is malformed > > > > Is there any way to rebuild the DB or, if not, how do I remove it and > start > > from scratch? > > rm /var/db/pkg/local.sqlite > xzcat /var/backups/pkg.sql.xz | pkg shell > > Best regards, > Bapt > Thanks, Bapt! That is exactly what I was looking for, though with only 210 ports installed, on a system which had a rather broken installation, I decided to newfs the system and start over. This was clearly the right choice as several things are now working much better. It would be great to have this documented somewhere as corrupt databases are a rare, but real issue. -- Kevin Oberman, Part time kid herder and retired Network Engineer E-mail: rkoberman@gmail.com PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683