Bug 241007 - ports-mgmt/pkg: cannot open sqlite3 db: Not a directory (FreeBSD 13.0-CURRENT)
Summary: ports-mgmt/pkg: cannot open sqlite3 db: Not a directory (FreeBSD 13.0-CURRENT)
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-02 11:49 UTC by Nathan
Modified: 2020-05-25 07:17 UTC (History)
7 users (show)

See Also:
w.schwarzenfeld: maintainer-feedback? (pkg)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan 2019-10-02 11:49:22 UTC
Upgraded from 12-RELEASE to 13.0-CURRENT
pkg gives:
FreeBSD% doas su
FreeBSD# pkg update
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD load error: cannot open sqlite3 db: Not a directory
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   2.2MB/s    00:03    
Unable to create repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!

Looking at /var/db/pkg the db did exists

The fix is to deinstall/reinstall from ports

After just a bit I have to do it again. Does this in stable pkg and devel version
Comment 1 Nathan 2019-10-02 15:09:49 UTC
Additional note, this seems to happen if one is in a path that no longer exists, I did a pwd a moment ago to see where I was and it gave “.”  I would think pkg should still work nonetheless
Comment 2 Baptiste Daroussin freebsd_committer 2019-10-02 15:12:16 UTC
Thanks for that precision, that is exactly what I was missing to reproduce. I will fix asap.
Comment 3 Nathan 2019-10-02 15:35:16 UTC
(In reply to Baptiste Daroussin from comment #2)
This may help too. Weirdly I was working in a git dir and switched to master to delete that branch, and tried to use pkg and noticed the dir seemed to disappear and caused pkg issue again. So yeah it is because of current pwd not existing to cause bug it seems; just don’t know what made my dir that existed to disappear  :)
Comment 4 spork 2019-10-16 21:56:07 UTC
Same on 11.3-RELEASE-p3.

In my case I was sitting in a /usr/ports/blah/foo directory that disappeared when a cron job to update the latest tree ran.
Comment 5 Miroslav Lachman 2020-02-19 23:12:34 UTC
I was bitten by this today. 
pkg: Repository codelab load error: cannot open sqlite3 db: No such file or directory

Thank you for the info about non existent current directory. That was the problem.

Can it be fixed in pkg or can be the message more informative about what is going on?
Comment 6 Mårten Lindblad 2020-04-07 07:41:01 UTC
Had the same issue today on 12.1 version 1.13.2.
I was standing in /usr/ports/www/node10 and did portsnap extract and then a pkg install failed with: pkg: Repository FreeBSD load error: cannot open sqlite3 db: Not a directory
Comment 7 rob2g2 2020-05-25 07:17:56 UTC
same problem here.
I was in a directory that did not exist any more