Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'pkg which' attempts to write in the SQLite database #1771

Open
yurivict opened this issue Jul 14, 2019 · 3 comments · May be fixed by #1908
Open

'pkg which' attempts to write in the SQLite database #1771

yurivict opened this issue Jul 14, 2019 · 3 comments · May be fixed by #1908

Comments

@yurivict
Copy link
Member

I got this error while running as a non-root user:

$ pkg which /usr/local/lib/libgltf-0.0.so
pkg: sqlite error while executing PRAGMA user_version; in file pkgdb.c:2443: attempt to write a readonly database

IMO, pkg which should be a read-only operation, it shouldn't attempt to write.

pkg-1.11.1 on FreeBSD 12 amd64

@yurivict yurivict changed the title 'pkg which' attempts to write the SQLite database 'pkg which' attempts to write in the SQLite database Jul 14, 2019
@bapt
Copy link
Member

bapt commented Jul 14, 2019

pkg always try first to self upgrade its database. otherwise it might end up with a schema which is not valid and have commands failing with weird issue. if pkg which telles you it was to write, it is because the db schema has changed somehow. Meaning you need to run as root any pkg command.

yes it could probably be nicer about it and tell you 'hey your db is outdated upgrad it first' or something like that

@yurivict
Copy link
Member Author

yes it could probably be nicer about it and tell you 'hey your db is outdated upgrad it first' or something like that

Yes, then the error message should say something like "The DB upgrade is needed but pkg doesn't have the write access to the file {file}, please run it as root once to upgrade the DB."

@Jamie-Landeg-Jones
Copy link
Contributor

Adding to that, I just got the same message when running "pkg info" on a /var/db/pkg directory on a snapshot directory.

Please add an '-f' or something when we are performing purely read operations. As it was, I had to copy the files to a temporary directory, and use that - just to read the dependency list of a package I'd just deleted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants