5

I was trying to install bash on a FreeBSD 10.2 system, see How to Install bash on FreeBSD

But the install failed because pkg was trying to fetch from a too-new repository.

I then tried following the recipe at https://glasz.org/sheeplog/2017/02/freebsd-usrlocalliblibpkgso3-undefined-symbol-utimensat.html, which several sources said was the right thing to do.

However, part of the recipe involved uninstalling pkg and reinstalling it. That resulted in the following:

# pkg install -y pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y

Bootstrapping pkg from 
pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/release_2, please 
wait...
Verifying signature with trusted certificate 
pkg.freebsd.org.2013102301... done
pkg-static: warning: database version 34 is newer than libpkg(3) 
version 31, but still compatible
pkg-static: sqlite error while executing INSERT OR ROLLBACK INTO 
pkg_search(id, name, origin) VALUES (?1, ?2 || '-' || ?3, ?4); in 
file pkgdb.c:1542: no such table: pkg_search

And so now I'm stuck. Can anybody tell me how I might recover from this state?

5

You can try removing everything in /var/db/pkg/ directory, but the proper solution is to upgrade to supported FreeBSD release (10.4 or 11.2)

  • Thanks; I'll give it a shot. I don't know if I can justify upgrading a system that I'm not even the owner of (just helping administer it), just to run one lousy bash script. – Edward Falk Oct 28 '18 at 15:58
0

I recently encountered a similar symptom (line breaks added for readability):

# pkg info
pkg: Warning: Major OS version upgrade detected.  \
        Running "pkg-static install -f pkg" recommended
pkg: warning: database version 34 is newer than libpkg(3) version 33, \
        but still compatible
pkg: sqlite error while executing INSERT OR ROLLBACK INTO pkg_search(id, name, origin) \
        VALUES (?1, ?2 || '-' || ?3, ?4); in file pkgdb.c:1544: \
        no such table: pkg_search

I focused on this part of the error message:

no such table: pkg_search

and in my specific case, I was able to resolve my problem by doing:

# cp -p /var/db/pkg/local.sqlite /var/db/pkg/local.sqlite.safety
# sqlite3 /var/db/pkg/local.sqlite
SQLite version 3.28.0 2019-04-16 19:49:53
Enter ".help" for usage hints.
sqlite> CREATE VIRTUAL TABLE pkg_search USING fts4(id, name, origin);
sqlite> .quit

That particular SQL query is mentioned in this thread from January 2017.

After that SQL incantation, pkg became functional again and I was able to upgrade to the latest version of pkg and then upgrade or reinstall the rest of the packages. This had been a 10.x to 12.x migration, so after upgrading pkg I did pkg upgrade -f on everything, and wound up with no more warnings or sqlite3 errors:

# pkg -N; pkg info; pkg upgrade
pkg: 15 packages installed
apache24-2.4.41                Version 2.4.x of Apache web server
apr-1.7.0.1.6.1                Apache Portability Library
bash-5.0.7                     GNU Project's Bourne Again SHell
db5-5.3.28_7                   Oracle Berkeley DB, revision 5.3
expat-2.2.6_1                  XML 1.0 parser written in C
gdbm-1.18.1_1                  GNU database manager
gettext-runtime-0.20.1         GNU gettext runtime libraries and programs
indexinfo-0.3.1                Utility to regenerate the GNU info page index
libnghttp2-1.39.2              HTTP/2.0 C Library
libxml2-2.9.9                  XML parser library for GNOME
linux_base-f10-10_10           Base set of packages needed in Linux mode for i386/amd64 (Linux Fedora 10)
pcre-8.43_2                    Perl Compatible Regular Expressions library
perl5-5.30.0                   Practical Extraction and Report Language
pkg-1.11.1                     Package manager
readline-8.0.0                 Library for editing command lines as they are typed
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.