Solved pkg database corrupt

Well I was able to finish downloading everything but the update went south for other reasons : while installing/unpacking python311 there was a crash dump. After rebooting I got this error message :
[1/244] Upgrading python311 from 3.11.10 to 3.11.11...
pkg: sqlite error while executing INSERT OR REPLACE INTO packages( origin, name, version, comment, desc, message, arch, maintainer, w
ww, prefix, flatsize, automatic, licenselogic, time, manifestdigest, dep_formula, vital)VALUES( 'lang/python311', 'python311', '3.11.
11', 'Interpreted object-oriented programming language', 'Python is an interpreted object-oriented programming language, and is
often compared to Tcl, Perl or Scheme.', '[{"message":"Note that some standard Python modules are provided as separate ports\nas they
require additional dependencies. They are available as:\n\npy311-gdbm databases/py-gdbm@py311\npy311-sqlite3 databases/py-s
qlite3@py311\npy311-tkinter x11-toolkits/py-tkinter@py311","type":"install"}]', 'FreeBSD:14:amd64', 'python@FreeBSD.org', 'https:/
/www.python.org/', '/usr/local', 210761985, 1, 1, NOW(), '2$2$753xcncqf5z4m86y4u16y3843jrphksedme86xnc6ap6qoe9ssynakrbyue3osrup3s39k4
9zykjnqxhg7iwo5akxeu5wzpas11y3dd', NULL, 0 ) in file pkgdb.c:1651: database disk image is malformed
pkg: Package database is busy while closing!
I deleted the package in /var/cache/pkg and re-downloaded it just in case but it kept the same error.
I was able to install other packages not requiring it, like vlc and tmux, but I had another crash while unpacking openjdk11.

Any idea how I could fix this? Removing the python311 (and probably openjdk11) from some database?

Should I make another thread for it, as it seems a completely different issue?
 
I was doing an upgrade of packages but while installing/unpacking python311 there was a crash dump. After rebooting I got this error message when trying to finish the upgrade :
Code:
[1/244] Upgrading python311 from 3.11.10 to 3.11.11...
pkg: sqlite error while executing INSERT OR REPLACE INTO packages( origin, name, version, comment, desc, message, arch, maintainer, w
ww, prefix, flatsize, automatic, licenselogic, time, manifestdigest, dep_formula, vital)VALUES( 'lang/python311', 'python311', '3.11.
11', 'Interpreted object-oriented programming language', 'Python is an interpreted object-oriented programming language, and is
often compared to Tcl, Perl or Scheme.', '[{"message":"Note that some standard Python modules are provided as separate ports\nas they
require additional dependencies. They are available as:\n\npy311-gdbm       databases/py-gdbm@py311\npy311-sqlite3    databases/py-s
qlite3@py311\npy311-tkinter x11-toolkits/py-tkinter@py311","type":"install"}]', 'FreeBSD:14:amd64', '[EMAIL]python@FreeBSD.org[/EMAIL]', 'https:/
/www.python.org/', '/usr/local', 210761985, 1, 1, NOW(), '2$2$753xcncqf5z4m86y4u16y3843jrphksedme86xnc6ap6qoe9ssynakrbyue3osrup3s39k4
9zykjnqxhg7iwo5akxeu5wzpas11y3dd', NULL, 0 ) in file pkgdb.c:1651: [B]database disk image is malformed[/B]
pkg: Package database is busy while closing!
I deleted the package in /var/cache/pkg and re-downloaded it just in case but it kept the same error.
I was able to install other packages not requiring it, like vlc and tmux, but I had another crash while unpacking openjdk11.

Any idea how I could fix this? Removing the line for python311 (and probably openjdk11) from some database? Or pkg needs to update it and can't have it absent?
 
Last edited by a moderator:
I was able to install other packages not requiring it, like vlc and tmux, but I had another crash while unpacking openjdk11.
On possible explanation could be the file system might be corrupted. If this is UFS run fsck_ffs(8) in single-user mode or from another system to see if the file system is "clean". It's important that the checked file system is un-mounted or mounted read-only.
 
I was able to fix it by following the first three steps of miguelc's post, great solution :)
Thread pkg-database-error.64361

I got back my db from a few days back, "uninstalled" two or three packages I had uninstalled since, did a pkg autoremove so I was in the same state as before my first try. And then I updated normally.
 
Back
Top