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

Eduardo Morras emorrasg at
Thu Oct 12 19:56:01 UTC 2017

On Thu, 12 Oct 2017 20:19:02 +0200
Vidar Karlsen <vidar at> wrote:

> > On 12 Oct 2017, at 19:50, Jos Chrispijn <bsdports at>
> > wrote:
> > 
> > Op 12-10-2017 om 7:39 schreef Vidar Karlsen:
> >> Also check if your current work dir has been deleted,
> > Do you mean my BSD workdir like /temp or do you refer to the
> > workdir that is used during the portupdate? Where can I find which
> > workdir that is?
> 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.

What configuration has sqlite in pkg? It looks like it tries to create
wal, temp and/or shm files in current directory. If compile sqlite with
options temp_store = memory, 3, or sets it at open file or as pre open
pragma, temp files won't exist. For shm files and wal, use pragma
directory_data, deprecated sqlite pragma because Windows OS could cause
db corruption, but we are not Windows.

And now that I write it, perhaps it's easier to check if the current
directory exists before opening the db file.

---   ---
Eduardo Morras <emorrasg at>

More information about the freebsd-ports mailing list