Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2021 07:32:01 -0500
From:      Dennis Clarke via freebsd-current <freebsd-current@freebsd.org>
To:        freebsd-current@freebsd.org
Subject:   Re: pkg sqlite database borked ( again ). How to restore?
Message-ID:  <3b4d90c7-cacf-8b9d-60cd-694e68e76ed1@blastwave.org>
In-Reply-To: <202111291122.1ATBM1vp034286@donotpassgo.dyslexicfish.net>
References:  <4d9d5406-c257-e5cb-d237-d26889468f62@blastwave.org> <202111291122.1ATBM1vp034286@donotpassgo.dyslexicfish.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/29/21 06:22, Jamie Landeg-Jones wrote:
> Dennis Clarke via freebsd-current <freebsd-current@FreeBSD.org> wrote:
> 
>> europa# xz -dc /var/backups/pkg.sql.xz.3 > /var/db/pkg/local.sqlite.dump
>>
>> europa#
>> europa# pkg backup -r /var/db/pkg/local.sqlite.dump
>> Restoring database:
>> Restoring: 100%
>> pkg: sqlite error while executing backup step in file backup.c:98: not
>> an error
> 
> The backup file consists of sql statements, the pkg backup -r I think
> requires a binary db file.
> 
> I think you need to do this:
> 
> pkg shell < /var/db/pkg/local.sqlite.dump
> 
> Cheers, Jamie
> 

Ah well ... that seems to toss a ton of errors and yet works ?
 europa#
europa# pkg shell < /var/db/pkg/local.sqlite.dump
Error: near line 4: table packages already exists
Error: near line 212: UNIQUE constraint failed: packages.name
Error: near line 246: table mtree already exists
Error: near line 247: table pkg_script already exists
Error: near line 611: table script already exists
Error: near line 612: UNIQUE constraint failed: script.script_id
Error: near line 684: table option already exists
Error: near line 685: UNIQUE constraint failed: option.option_id
Error: near line 1049: table option_desc already exists
Error: near line 1050: table pkg_option already exists
Error: near line 1591: table pkg_option_desc already exists
Error: near line 1592: table pkg_option_default already exists
Error: near line 1593: table deps already exists
Error: near line 2393: table files already exists
Error: near line 61890: UNIQUE constraint failed: files.path
Error: near line 61891: UNIQUE constraint failed: files.path
Error: near line 61892: UNIQUE constraint failed: files.path
Error: near line 61893: UNIQUE constraint failed: files.path
Error: near line 61894: UNIQUE constraint failed: files.path
Error: near line 61895: UNIQUE constraint failed: files.path
Error: near line 61896: UNIQUE constraint failed: files.path
Error: near line 61897: UNIQUE constraint failed: files.path
Error: near line 61898: UNIQUE constraint failed: files.path
Error: near line 61899: UNIQUE constraint failed: files.path
Error: near line 61900: UNIQUE constraint failed: files.path
Error: near line 61901: UNIQUE constraint failed: files.path
Error: near line 61902: UNIQUE constraint failed: files.path
Error: near line 61903: UNIQUE constraint failed: files.path
Error: near line 61904: UNIQUE constraint failed: files.path
Error: near line 61905: UNIQUE constraint failed: files.path
Error: near line 61906: UNIQUE constraint failed: files.path
Error: near line 61907: UNIQUE constraint failed: files.path
Error: near line 61908: UNIQUE constraint failed: files.path
Error: near line 61909: UNIQUE constraint failed: files.path
Error: near line 61910: UNIQUE constraint failed: files.path
Error: near line 61911: UNIQUE constraint failed: files.path
Error: near line 61912: UNIQUE constraint failed: files.path
Error: near line 61913: UNIQUE constraint failed: files.path
Error: near line 61914: UNIQUE constraint failed: files.path
Error: near line 61915: UNIQUE constraint failed: files.path
Error: near line 61916: UNIQUE constraint failed: files.path
Error: near line 61917: UNIQUE constraint failed: files.path
Error: near line 61918: UNIQUE constraint failed: files.path
Error: near line 61919: UNIQUE constraint failed: files.path
Error: near line 61920: UNIQUE constraint failed: files.path
Error: near line 61921: UNIQUE constraint failed: files.path
Error: near line 61922: UNIQUE constraint failed: files.path
Error: near line 61923: UNIQUE constraint failed: files.path
Error: near line 61924: UNIQUE constraint failed: files.path
Error: near line 61925: UNIQUE constraint failed: files.path
Error: near line 61926: UNIQUE constraint failed: files.path
Error: near line 61927: UNIQUE constraint failed: files.path
Error: near line 61928: UNIQUE constraint failed: files.path
Error: near line 61929: UNIQUE constraint failed: files.path
Error: near line 61930: UNIQUE constraint failed: files.path
Error: near line 61931: UNIQUE constraint failed: files.path
Error: near line 61932: UNIQUE constraint failed: files.path
Error: near line 61933: UNIQUE constraint failed: files.path
Error: near line 61934: UNIQUE constraint failed: files.path
Error: near line 61935: UNIQUE constraint failed: files.path
Error: near line 61936: UNIQUE constraint failed: files.path
Error: near line 61937: UNIQUE constraint failed: files.path
Error: near line 61938: UNIQUE constraint failed: files.path
Error: near line 61939: UNIQUE constraint failed: files.path
Error: near line 61940: UNIQUE constraint failed: files.path
Error: near line 61941: UNIQUE constraint failed: files.path
Error: near line 61942: UNIQUE constraint failed: files.path
Error: near line 61943: UNIQUE constraint failed: files.path
Error: near line 61944: UNIQUE constraint failed: files.path
Error: near line 61945: UNIQUE constraint failed: files.path
Error: near line 61946: UNIQUE constraint failed: files.path
Error: near line 61947: UNIQUE constraint failed: files.path
Error: near line 61948: UNIQUE constraint failed: files.path
Error: near line 61949: UNIQUE constraint failed: files.path
Error: near line 61950: UNIQUE constraint failed: files.path
Error: near line 61951: UNIQUE constraint failed: files.path
Error: near line 72921: table directories already exists
Error: near line 72927: UNIQUE constraint failed: directories.path
Error: near line 73338: table pkg_directories already exists
Error: near line 73759: table categories already exists
Error: near line 73760: UNIQUE constraint failed: categories.id
Error: near line 73794: table pkg_categories already exists
Error: near line 74112: table licenses already exists
Error: near line 74113: UNIQUE constraint failed: licenses.id
Error: near line 74157: table pkg_licenses already exists
Error: near line 74456: table users already exists
Error: near line 74464: table pkg_users already exists
Error: near line 74473: table groups already exists
Error: near line 74481: table pkg_groups already exists
Error: near line 74490: table shlibs already exists
Error: near line 74587: UNIQUE constraint failed: shlibs.name
Error: near line 74987: table pkg_shlibs_required already exists
Error: near line 75701: table pkg_shlibs_provided already exists
Error: near line 76192: table annotation already exists
Error: near line 76193: UNIQUE constraint failed: annotation.annotation_id
Error: near line 76194: UNIQUE constraint failed: annotation.annotation_id
Error: near line 76408: table pkg_annotation already exists
Error: near line 77219: table pkg_conflicts already exists
Error: near line 77220: table pkg_lock already exists
Error: near line 77222: table pkg_lock_pid already exists
Error: near line 77223: table provides already exists
Error: near line 77224: table pkg_provides already exists
Error: near line 77225: table config_files already exists
Error: near line 77226: table requires already exists
Error: near line 77227: table pkg_requires already exists
Error: near line 77228: table lua_script already exists
Error: near line 77233: UNIQUE constraint failed: lua_script.lua_script
Error: near line 77277: table pkg_lua_script already exists
Error: near line 77326: index packages_unique already exists
Error: near line 77327: index deps_unique already exists
Error: near line 77328: index deporigini already exists
Error: near line 77329: index pkg_script_package_id already exists
Error: near line 77330: index deps_package_id already exists
Error: near line 77331: index files_package_id already exists
Error: near line 77332: index pkg_directories_package_id already exists
Error: near line 77333: index pkg_categories_package_id already exists
Error: near line 77334: index pkg_licenses_package_id already exists
Error: near line 77335: index pkg_users_package_id already exists
Error: near line 77336: index pkg_groups_package_id already exists
Error: near line 77337: index pkg_shlibs_required_package_id already exists
Error: near line 77338: index pkg_shlibs_provided_package_id already exists
Error: near line 77339: index pkg_directories_directory_id already exists
Error: near line 77340: index pkg_annotation_package_id already exists
Error: near line 77341: index pkg_conflicts_pid already exists
Error: near line 77342: index pkg_conflicts_cid already exists
Error: near line 77343: index pkg_provides_id already exists
Error: near line 77344: index packages_origin already exists
Error: near line 77345: index packages_name already exists
Error: near line 77346: index pkg_digest_id already exists
Error: near line 77347: table pkg_shlibs already exists
Error: near line 77348: trigger pkg_shlibs_update already exists
Error: near line 77349: trigger pkg_shlibs_insert already exists
Error: near line 77350: trigger pkg_shlibs_delete already exists
Error: near line 77351: table scripts already exists
Error: near line 77352: trigger scripts_update already exists
Error: near line 77353: trigger scripts_insert already exists
Error: near line 77354: trigger scripts_delete already exists
Error: near line 77355: table options already exists
Error: near line 77356: trigger options_update already exists
Error: near line 77357: trigger options_insert already exists
Error: near line 77358: trigger options_delete already exists
Error: near line 77359: table lua_scripts already exists
Error: near line 77360: trigger lua_script_update already exists
Error: near line 77361: trigger lua_script_insert already exists
Error: near line 77362: trigger lua_script_delete already exists
europa#
europa# pkg query %n\ %v\ %o
adwaita-icon-theme 40.1.1 x11-themes/adwaita-icon-theme
argyllcms 1.9.2_5 graphics/argyllcms
at-spi2-atk 2.34.2 accessibility/at-spi2-atk
at-spi2-core 2.36.0 accessibility/at-spi2-core
atk 2.36.0 accessibility/atk
autoconf 2.69_3 devel/autoconf
autoconf-wrapper 20131203 devel/autoconf-wrapper
autoconf213 2.13.000227_7 devel/autoconf213
automake 1.16.4 devel/automake
autotools 20130627 devel/autotools
avahi-app 0.8 net/avahi-app
bash 5.1.8 shells/bash
bind-tools 9.16.22 dns/bind-tools
binutils 2.37_1,1 devel/binutils
bison 3.7.6,1 devel/bison
bitmap 1.0.9 x11/bitmap
boost-libs 1.72.0_6 devel/boost-libs
brotli 1.0.9,1 archivers/brotli
ca_root_nss 3.71 security/ca_root_nss
cairo 1.17.4,3 graphics/cairo
colord 1.3.5_1 graphics/colord
cups 2.3.3op2 print/cups
curl 7.79.1 ftp/curl
cyrus-sasl 2.1.27_2 security/cyrus-sasl2
dbus 1.12.20_5 devel/dbus
dbus-glib 0.112 devel/dbus-glib
dejavu 2.37_1 x11-fonts/dejavu
dialog4ports 0.1.6_1 ports-mgmt/dialog4ports
dtc 1.6.0 sysutils/dtc
enchant2 2.2.15 textproc/enchant2
encodings 1.0.5,1 x11-fonts/encodings
expat 2.4.1 textproc/expat2
expect 5.45.4_2,1 lang/expect
font-bh-ttf 1.0.3_4 x11-fonts/font-bh-ttf
font-misc-ethiopic 1.0.4 x11-fonts/font-misc-ethiopic
font-misc-meltho 1.0.3_4 x11-fonts/font-misc-meltho
fontconfig 2.13.94_1,1 x11-fonts/fontconfig
freeglut 3.2.1 graphics/freeglut
freetype2 2.11.0 print/freetype2
fribidi 1.0.11 converters/fribidi
gawk 5.1.1 lang/gawk
gdb 11.1_1 devel/gdb
gdbm 1.22 databases/gdbm
gdk-pixbuf2 2.40.0 graphics/gdk-pixbuf2
geoclue 2.5.7 net/geoclue
gettext-runtime 0.21 devel/gettext-runtime
giflib 5.2.1 graphics/giflib
git 2.33.1 devel/git
glew 2.2.0_3 graphics/glew
glfw 3.3.4_1 graphics/glfw
glib 2.70.1,2 devel/glib20
glib-networking 2.66.0_1 net/glib-networking
gmake 4.3_2 devel/gmake
gmp 6.2.1 math/gmp
gnome_subr 1.0 sysutils/gnome_subr
gnuplot 5.4.1_1 math/gnuplot
gnutls 3.6.16 security/gnutls
gobject-introspection 1.66.1,1 devel/gobject-introspection
graphene 1.10.6 graphics/graphene
graphite2 1.3.14 graphics/graphite2
groff 1.22.4_4 textproc/groff
gsed 4.8 textproc/gsed
gsettings-desktop-schemas 41.0 devel/gsettings-desktop-schemas
gstreamer1 1.16.2 multimedia/gstreamer1
gstreamer1-plugins 1.16.2_3 multimedia/gstreamer1-plugins
gstreamer1-plugins-bad 1.16.2 multimedia/gstreamer1-plugins-bad
gstreamer1-plugins-gl 1.16.2_2 graphics/gstreamer1-plugins-gl
gtk-update-icon-cache 3.24.26_1 graphics/gtk-update-icon-cache
gtk3 3.24.30 x11-toolkits/gtk30
harfbuzz 3.1.1 print/harfbuzz
harfbuzz-icu 3.1.1 print/harfbuzz-icu
hicolor-icon-theme 0.17 misc/hicolor-icon-theme
hunspell 1.7.0_2 textproc/hunspell
hyphen 2.8.8 textproc/hyphen
icu 70.1_1,1 devel/icu
indexinfo 0.3.1 print/indexinfo
iperf3 3.10.1_1 benchmarks/iperf3
iso-codes 4.2 misc/iso-codes
jbigkit 2.1_1 graphics/jbigkit
jpeg-turbo 2.1.1 graphics/jpeg-turbo
json-c 0.15_1 devel/json-c
json-glib 1.6.2_1 devel/json-glib
lcms2 2.12 graphics/lcms2
libGLU 9.0.2_1 graphics/libGLU
libICE 1.0.10,1 x11/libICE
libSM 1.2.3,1 x11/libSM
libX11 1.7.2,1 x11/libX11
libXScrnSaver 1.2.3_2 x11/libXScrnSaver
libXau 1.0.9 x11/libXau
libXaw 1.0.14,2 x11-toolkits/libXaw
libXcomposite 0.4.5,1 x11/libXcomposite
libXcursor 1.2.0 x11/libXcursor
libXdamage 1.1.5 x11/libXdamage
libXdmcp 1.1.3 x11/libXdmcp
libXext 1.3.4,1 x11/libXext
libXfixes 5.0.3_2 x11/libXfixes
libXft 2.3.3 x11-fonts/libXft
libXi 1.7.10,1 x11/libXi
libXinerama 1.1.4_2,1 x11/libXinerama
libXmu 1.1.3,1 x11-toolkits/libXmu
libXpm 3.5.13 x11/libXpm
libXrandr 1.5.2 x11/libXrandr
libXrender 0.9.10_2 x11/libXrender
libXt 1.2.1,1 x11-toolkits/libXt
libXtst 1.2.3_2 x11/libXtst
libXv 1.0.11_2,1 x11/libXv
libXvMC 1.0.12 x11/libXvMC
libXxf86vm 1.1.4_3 x11/libXxf86vm
libdaemon 0.14_1 devel/libdaemon
libdrm 2.4.107_1,1 graphics/libdrm
libedit 3.1.20210216,1 devel/libedit
libepoll-shim 0.0.20210418 devel/libepoll-shim
libepoxy 1.5.9 graphics/libepoxy
libevent 2.1.12 devel/libevent
libffi 3.3_1 devel/libffi
libfontenc 1.1.4 x11-fonts/libfontenc
libgcrypt 1.9.4 security/libgcrypt
libgd 2.3.1,1 graphics/gd
libglvnd 1.3.4 graphics/libglvnd
libgpg-error 1.43 security/libgpg-error
libgsf 1.14.47_1 devel/libgsf
libiconv 1.16 converters/libiconv
libidn 1.35 dns/libidn
libidn2 2.3.2 dns/libidn2
liblz4 1.9.3,1 archivers/liblz4
libmspack 0.10.1 archivers/libmspack
libnghttp2 1.46.0 www/libnghttp2
libnotify 0.7.9_1 devel/libnotify
libpaper 1.1.24.4 print/libpaper
libpcap 1.10.1 net/libpcap
libpciaccess 0.16 devel/libpciaccess
libproxy 0.4.17 net/libproxy
libpsl 0.21.1_3 dns/libpsl
libpthread-stubs 0.4 devel/libpthread-stubs
librsvg2-rust 2.52.3 graphics/librsvg2-rust
libsecret 0.20.4 security/libsecret
libsigsegv 2.12 devel/libsigsegv
libsoup 2.74.0 devel/libsoup
libssh2 1.9.0_3,3 security/libssh2
libtasn1 4.17.0 security/libtasn1
libtextstyle 0.21 devel/libtextstyle
libtool 2.4.6_1 devel/libtool
libunistring 0.9.10_1 devel/libunistring
libunwind 20201110 devel/libunwind
libuv 1.42.0 devel/libuv
libwpe 1.10.1 www/libwpe
libxcb 1.14_1 x11/libxcb
libxkbcommon 1.3.1 x11/libxkbcommon
libxml2 2.9.12 textproc/libxml2
libxshmfence 1.3_1 x11/libxshmfence
libxslt 1.1.34_2 textproc/libxslt
libyaml 0.2.5 textproc/libyaml
llvm12 12.0.1_6 devel/llvm12
lua53 5.3.6 lang/lua53
m4 1.4.19,1 devel/m4
mesa-demos 8.4.0_3 graphics/mesa-demos
mesa-dri 21.1.8 graphics/mesa-dri
mesa-libs 21.1.8 graphics/mesa-libs
mkfontscale 1.2.1 x11-fonts/mkfontscale
mpc 1.2.1 math/mpc
mpdecimal 2.5.1 math/mpdecimal
mpfr 4.1.0_1 math/mpfr
neofetch 7.1.0 sysutils/neofetch
nettle 3.7.3 security/nettle
ninja 1.10.2,2 devel/ninja
nspr 4.32 devel/nspr
openjpeg 2.4.0 graphics/openjpeg
opensbi 0.9 sysutils/opensbi
orc 0.4.31 devel/orc
p11-kit 0.24.0 security/p11-kit
p5-Authen-SASL 2.16_1 security/p5-Authen-SASL
p5-CGI 4.53 www/p5-CGI
p5-Clone 0.45 devel/p5-Clone
p5-Digest-HMAC 1.04 security/p5-Digest-HMAC
p5-Encode-Locale 1.05 converters/p5-Encode-Locale
p5-Error 0.17029 lang/p5-Error
p5-GSSAPI 0.28_1 security/p5-GSSAPI
p5-HTML-Parser 3.76_1 www/p5-HTML-Parser
p5-HTML-Tagset 3.20_1 www/p5-HTML-Tagset
p5-HTTP-Date 6.05 www/p5-HTTP-Date
p5-HTTP-Message 6.33 www/p5-HTTP-Message
p5-IO-HTML 1.004 devel/p5-IO-HTML
p5-IO-Socket-INET6 2.72_1 net/p5-IO-Socket-INET6
p5-IO-Socket-SSL 2.072 security/p5-IO-Socket-SSL
p5-LWP-MediaTypes 6.04 www/p5-LWP-MediaTypes
p5-Mozilla-CA 20211001 www/p5-Mozilla-CA
p5-Net-SSLeay 1.90 security/p5-Net-SSLeay
p5-Socket6 0.29 net/p5-Socket6
p5-TimeDate 2.33,1 devel/p5-TimeDate
p5-URI 5.10 net/p5-URI
pango 1.48.7 x11-toolkits/pango
pciids 20211028 misc/pciids
pcre 8.45 devel/pcre
pcre2 10.39 devel/pcre2
perl5 5.32.1_1 lang/perl5.32
pixman 0.40.0_1 x11/pixman
pkg 1.17.5 ports-mgmt/pkg
pkgconf 1.8.0,1 devel/pkgconf
png 1.6.37_1 graphics/png
polkit 0.120 sysutils/polkit
psutils 1.17_5 print/psutils
py38-cairo 1.18.1_2,1 graphics/py-cairo
py38-gobject3 3.38.0 devel/py-gobject3
py38-ply 3.11 devel/py-ply
py38-setuptools 57.0.0 devel/py-setuptools
pygobject3-common 3.38.0 devel/pygobject3-common
python38 3.8.12_1 lang/python38
qemu 5.0.1_2 emulators/qemu
readline 8.1.1 devel/readline
sdl2 2.0.12_7 devel/sdl20
shared-mime-info 2.0_2 misc/shared-mime-info
source-highlight 3.1.9_1 textproc/source-highlight
spidermonkey78 78.9.0_3 lang/spidermonkey78
sqlite3 3.35.5_4,1 databases/sqlite3
tcl86 8.6.12 lang/tcl86
tex-kpathsea 6.2.1_2 devel/tex-kpathsea
tiff 4.3.0 graphics/tiff
tpm-emulator 0.7.4_2 emulators/tpm-emulator
trousers 0.3.14_3 security/trousers
u-boot-qemu-riscv64 2021.07 sysutils/u-boot-qemu-riscv64
uchardet 0.0.7 textproc/uchardet
valgrind-devel 3.18.0.g20210323,1 devel/valgrind-devel
vde2 2.3.2_5 net/vde2
vim 8.2.3570 editors/vim
vte3 0.64.2_1 x11-toolkits/vte3
wayland 1.19.0_1 graphics/wayland
wayland-protocols 1.23 graphics/wayland-protocols
webkit2-gtk3 2.34.1_1 www/webkit2-gtk3
webp 1.2.1 graphics/webp
woff2 1.0.2_4 devel/woff2
wpebackend-fdo 1.10.0 www/wpebackend-fdo
wx30-gtk3 3.0.5.1_1 x11-toolkits/wxgtk30
xauth 1.1 x11/xauth
xbitmaps 1.1.2 x11/xbitmaps
xcursorgen 1.0.7 x11/xcursorgen
xkeyboard-config 2.32 x11/xkeyboard-config
xlogo 1.0.5 x11/xlogo
xorg-fonts-truetype 7.7_1 x11-fonts/xorg-fonts-truetype
xorgproto 2021.4 x11/xorgproto
xterm 369 x11/xterm
zstd 1.5.0 archivers/zstd
europa#


I have to go out on a limb and hope that pkg works again.

Thank you for the help Sir!

Dennis






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3b4d90c7-cacf-8b9d-60cd-694e68e76ed1>