unicorn I had run fsck, there's no error found.
OK, but, if /usr
or /var
are separate filesystems, then you'll check them also.
Well, I can see errors in your logs, but, they're mostly from last year:
sql.log
[...]
SQL error at 2022-05-05 02:52:44 CST
errmsg: statement aborts at 13: [INSERT INTO LOCAL_PROVIDES (PKG_ID, LOCAL_PROVIDES_PKGNAME) VALUES (116,'/usr/pkg/lib/gstreamer-1.0/libgstsubparse.so');] attempt to write a readonly database
query: INSERT INTO LOCAL_PROVIDES (PKG_ID, LOCAL_PROVIDES_PKGNAME) VALUES (116,'/usr/pkg/lib/gstreamer-1.0/libgstsubparse.so');
SQL error at 2022-05-05 02:52:44 CST
errmsg: statement aborts at 13: [INSERT INTO LOCAL_PROVIDES (P
pkg_install.log
[...]
---May 04 21:32:25: refreshing gdk-pixbuf2-2.42.6nb1...
g_module_open() failed for /usr/pkg/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so: /usr/pkg/lib/libpangoft2-1.0.so.0: Undefined PLT symbol "hb_font_set_synthetic_slant" (symnum = 7)
[1] Segmentation fault (core dumped) ${GDK_PIXBUF_QUERY_LOADERS} >${GDK_PIXBUF_LOAD...
[...]
---May 05 02:41:56: refreshing serf-1.3.9nb2...
pkg_add: Read error for lib/libserf-1.so.1.3.0: Lzma library error: Corrupted input data
pkg_add: Updating of serf-1.3.9nb2 to serf-1.3.9nb2 failed.
pkg_add: Remember to run pkg_admin rebuild-tree after fixing this.
pkg_add: Couldn't remove /usr/pkg/lib/pkgconfig/serf-1.pc: No such file or directory
pkg_add: 1 package addition failed
[...]
---May 28 18:48:40: refreshing gdk-pixbuf2-2.42.6nb1...
pkg_delete: Couldn't remove package directory in `/usr/pkg/pkgdb/gdk-pixbuf2-2.42.6nb1'
pkg_add: command failed: /usr/pkg/sbin/pkg_delete -K /usr/pkg/pkgdb -p /usr/pkg gdk-pixbuf2-2.42.6nb1
pkg_add: 1 package addition failed
---May 28 18:48:41: refreshing gdbm-1.23...
pkg_add: /usr/pkg/pkgdb/gdk-pixbuf2-2.42.6nb1/+CONTENTS: No such file or directory
---May 28 18:48:41: refreshing gd-2.3.3nb1...
pkg_add: /usr/pkg/pkgdb/gdk-pixbuf2-2.42.6nb1/+CONTENTS: No such file or directory
---May 28 18:48:41: refreshing gcc7-7.5.0nb5...
[...]
Many other there...
More relevent is the output of pkg_info
which shows definite corruption:
[...]
xfce4-power-manager-4.16.0nb2 Xfce power manager
py310-expat-3.10.9nb1 /* XPM */
static char * to
Right. The easiest thing to do is reinstall after wiping everything:
rm -rf /var/db/pkgin /usr/pkg
export PKG_PATH='http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All'
pkg_add pkgin
echo 'http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$arch/10.0/All' > /usr/pkg/etc/pkgin/repositories.conf
pkgin update
pkgin install [...]
Replace 10.0
everywhere with 9.3
or 9.2
or whatever version of NetBSD you have.
Otherwise, you can try to salvage your current install:
Move old DB out of the way. (You can remove these later...)
mv /var/db/pkgin /var/db/pkgin.orig
mv /usr/pkg/pkgdb/pkgdb.byfile.db /usr/pkg/pkgdb/pkgdb.byfile.db.orig
Fix corrupted files.
Running pkg_info
causes it to read the +CONTENTS
file in each package directory in /usr/pkg/pkgdb/
. You can see this is failing because (at least one of) the files is corrupt:
py310-expat-3.10.9nb1 /* XPM */
static char * to
I suspect that some of the files in /usr/pkg/pkgdb/py310-expat-3.10.9nb1/
are bad. So, download that tarball from here (use correct version please), then extract only the +
-files, over-writing the possibly corrupt files in the /usr/pkg/pkgdb/<package name>/
directory.
Run, pkg_info
again, and check for other corrupt packages. Repeat as necessary.
Rebuild database
When the pkg_info
output looks OK, try rebuilding the database:
pkg_admin rebuild
If there are any errors here, then note which packages are corrupted, do Step 2 for each of them, then rebuild again until the rebuild succeeds without errors.
Check packages
By this point the database should be consistent. Now check all the installed package files:
pkg_admin check
If any files fail in their checksums, remove the package and reinstall:
pkgin clean
pkgin update
pkgin rm [...]
pkgin autoremove
pkgin in [...]
This should make things reasonably consistent. @pin can chime in with corrections...