Bug 213544 - ports-mgmt/pkg: does not work with NFS-mounted /var/db/pkg (was: NFS locking regression (lockd))
Summary: ports-mgmt/pkg: does not work with NFS-mounted /var/db/pkg (was: NFS locking ...
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Linimon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-16 18:46 UTC by Martin Birgmeier
Modified: 2019-07-28 06:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2016-10-16 18:46:33 UTC
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.

-- Martin
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2016-10-17 06:17:20 UTC
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?
Comment 2 Martin Birgmeier 2016-10-17 17:53:00 UTC
What I did:
- booted the netbooted machine
- with pkg-1.9.0 installed
- ran 'portmaster -gaB'

Result:
- "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'

Result:
- "pkg: sqlite error while executing iterator in file pkgdb_iterator.c:1033: database is locked"

Conclusion:
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.
Comment 3 Martin Birgmeier 2017-03-06 18:48:48 UTC
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
^C
# ll /var/db/pkg     
total 1539
-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.

-- Martin
Comment 4 Martin Birgmeier 2019-07-28 06:50:24 UTC
This seems to be working now with FreeBSD 12.

-- Martin