I am netbooting FreeBSD using pxe. I am updating ports in the netbooted machine using pkg(8). This worked flawlessly up to 10.3, but with 11.0 fails with errors 'sqlite database locked' (don't remember the exact message) after a few operations.
Specifically, I could today update pkg from pkg-1.8.7_3 to pkg-1.9.0, however subsequently listing the installed packages using 'pkg query -a %o' failed with the above error.
After shutting down the netbooted machine, I chroot'ed into its root dir on the netboot server. There the pkg query command could be executed without problems.
It seems there is a regression in the NFS locking code between 10.3 and 11.0.
pkg 1.9.0 had a bug, and 1.9.1 has been issued to address it. Can you try that right now to eliminate that as the only source of the problem?
What I did:
- booted the netbooted machine
- with pkg-1.9.0 installed
- ran 'portmaster -gaB'
- "All ports are up to date"
- which is incorrect because pkg-1.9.1 and others are new
Continuing on netboot server:
- chrooted to netboot environment on netboot server
- cp /usr/local/sbin/pkg-static /tmp/pkg-static
- /tmp/pkg-static delete -f pkg-1.9.0
- /tmp/pkg-static add <path>/pkg-1.9.1.txz
Continuing on (still running) netbooted machine:
- ran 'pkg query -a %o'
- "pkg: sqlite error while executing iterator in file pkgdb_iterator.c:1033: database is locked"
Since pkg-1.9.0 and 1.9.1 both ran without problems for my use cases I still suspect a regression in NFS locking.
Well, I still have the problem, and it would be nice if it could be solved; this worked before.
I changed the summary to start with "ports-mgmt/pkg" since maybe the problem lies there and not in the kernel.
For example, with the netbooted system I just got (^C because it hangs):
# portmaster -a
pkg: sqlite error while executing PRAGMA user_version; in file pkgdb.c:2423: database is locked
# ll /var/db/pkg
-rw-r--r-- 1 root wheel 1554432 Mar 5 09:15 local.sqlite
drwxr-xr-x 2 root wheel 2 Mar 6 19:34 local.sqlite.lock
A symptom is that in /var/db/pkg, the directory "local.sqlite.lock" always persists.
Note: If on the same netbooted machine I move /var/db/pkg to /tmp/pkg (where tmp is a memory disk), pkg works.
This seems to be working now with FreeBSD 12.