[Bug 256886] ports-mgmt/pkg pkg backup -r fails to restore local.sqlite

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 29 Jun 2021 13:34:51 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256886

            Bug ID: 256886
           Summary: ports-mgmt/pkg pkg backup -r fails to restore
                    local.sqlite
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkg_at_FreeBSD.org
          Reporter: eimar.koort_at_tutamail.com
             Flags: maintainer-feedback?(pkg_at_FreeBSD.org)
          Assignee: pkg_at_FreeBSD.org

When using "pkg backup" to create backup file from installed packages and later
trying to restore, it fails. Backup itself works. Restore part fails.


root_at_fbsd:~ # uname -a
FreeBSD fbsd 13.0-RELEASE FreeBSD 13.0-RELEASE #0
releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021    
root_at_releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

root_at_fbsd:~ # pkg info
libevent-2.1.12                API for executing callback functions on events
or timeouts
pkg-1.16.3                     Package manager
tmux-3.1c                      Terminal Multiplexer
root_at_fbsd:~ # cp /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite_bak 
root_at_fbsd:~ # pkg backup -d pkg_backup.dump 
Dumping database:
Backing up: 100%   

root_at_fbsd:~ # rm /var/db/pkg/local.sqlite
root_at_fbsd:~ # cp pkg_backup.dump /var/db/pkg/local.sqlite 
root_at_fbsd:~ # pkg info
libevent-2.1.12                API for executing callback functions on events
or timeouts
pkg-1.16.3                     Package manager
tmux-3.1c                      Terminal Multiplexer

So the backup file itself is OK. Now trying to use "restore":

root_at_fbsd:~ # pkg backup -r pkg_backup.dump 
Restoring database:
Restoring: 100%
root_at_fbsd:~ # pkg info
pkg: sqlite error while executing ALTER TABLE packages ADD licenselogic INTEGER
NOT NULL DEFAULT(1); in file pkgdb.c:2489: no such table: packages
root_at_fbsd:~ # ls -la /var/db/pkg
total 32084
drwxr-xr-x   2 root  wheel         7 Jun 29 16:08 .
drwxr-xr-x  19 root  wheel        27 May  8 14:50 ..
-rw-r--r--   1 root  wheel       158 Jun 29 16:02 FreeBSD.meta
-rw-r--r--   1 root  wheel     20480 Jun 29 16:08 local.sqlite
-rw-r--r--   1 root  wheel    405504 Jun 29 16:08 local.sqlite_bak
-rw-r--r--   1 root  wheel         0 Jun 29 16:08 pkg_backup.dump
-rw-r--r--   1 root  wheel  50925568 Jun 29 07:39 repo-FreeBSD.sqlite

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Tue Jun 29 2021 - 13:34:51 UTC

Original text of this message