[Bug 269810] How to restore pkg database

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 24 Feb 2023 21:20:57 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269810

            Bug ID: 269810
           Summary: How to restore pkg database
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: mfv@bway.net

Now that 'pkg backup' has been removed I do not know how to restore a corrupted
pkg database. The FreeBSD manual at section '4.4.11. Restoring the Package
Database' shows 2 methods.  The 1st methid is the now-removed 'pkg backup -r'
while the 2nd method is implied by the use of the compressed file created by
'periodic daily', that is, a compressed version of a sqlite3 dump.

However there are no instructions how to create/restore a new database from the
file created by 'periodic daily'.  I have uncompressed pkg.sql.xz and then read
pkg.sql into a news database using sqlite3 but the new database is much smaller
than the original database, local.sqlite.

In summary what are the manual commands to create/restore a new pkg database
from 'periodic daily'.  Alternatively, would there be any harm to just manually
make backup copies of local.sqlite, say as local.sqlite.1, local.sqlite.2, etc.

With thanks,
Marek

-- 
You are receiving this mail because:
You are the assignee for the bug.