pkg: sqlite error while executing sqlite open in file pkgdb.c:1126: unable to open database file

Vidar Karlsen vidar at karlsen.tech
Fri Oct 13 18:19:24 UTC 2017


> On 13 Oct 2017, at 20:06, Jos Chrispijn <bsdports at cloudzeeland.nl> wrote:
> 
> 
> Op 12-10-2017 om 20:19 schreef Vidar Karlsen:
>> I usually get that exact error when I run pkg from a directory that no longer exists. In my case, this typically happens because I’m sitting in a port dir like /usr/ports/dns/unbound after having run 'portsnap fetch update’ which has deleted that dir and created a new one because of a version bump in the tree.
> Yes, I thought of that too; unfortunately I cannot reproduce manually. Sometime this occurs and sometimes it doesn't.
> 
> 
>> Your case with portmaster might be a bit different, but it should normally not happen unless portmaster cd’s to a dir that then gets deleted. Did your ports tree change while portmaster was running?
> Nope - i mostly logon the BSD and run that batch by hand, without doing anything else.
>> If you can run pkg commands (like ‘pkg info’) normally otherwise, I’ll have to assume that your sqlite database is fine and that there is a temporary issue during the portmaster run that causes this error to be thrown.
> Everything is fine - my portscollection is in sync and I get no errors on updating other than the one I initially wrote about.
> Somehow I can't get it out of my head why I cannot put my finger behind this minor issue..

In case this is the non-existent directory issue that’s biting you, I can confirm that bapt’s relatively recent change to libpkg/pkgdb.c takes care of that problem. I’d try that; simply change:
if (sqlite3_open("local.sqlite", &db->sqlite) != SQLITE_OK) {
to:
if (sqlite3_open("/local.sqlite", &db->sqlite) != SQLITE_OK) {

…or download the following patch into ${PORTSDIR}/ports-mgmt/pkg/files and rebuild pkg:
https://karlsen.tech/freebsd/pkg/patch-libpkg_pkgdb.c

Hope that helps.

—
Vidar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20171013/bc847ced/attachment.sig>


More information about the freebsd-ports mailing list