Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2016 13:16:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        pkg@FreeBSD.org
Subject:   maintainer-feedback requested: [Bug 213611] ports-mgmt/pkg: 1.9.1 pkgdb locking doesn't work on NFS
Message-ID:  <bug-213611-32340-WdawqEJbHb@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-213611-32340@https.bugs.freebsd.org/bugzilla/>
References:  <bug-213611-32340@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
Markus Wennrich <mwennrich@gmail.com> has reassigned Bugzilla Automation
<bugzilla@FreeBSD.org>'s request for maintainer-feedback to pkg@FreeBSD.org:
Bug 213611: ports-mgmt/pkg: 1.9.1 pkgdb locking doesn't work on NFS
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D213611



--- Description ---
pkg info fails with following error, if /var/db/pkg is on NFS:

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

ktrace:

 61912 pkg	CALL  setgroups(0x1,0x802780abc)
 61912 pkg	RET   setgroups 0
 61912 pkg	CALL  setegid(0xfffe)
 61912 pkg	RET   setegid 0
 61912 pkg	CALL  setgid(0xfffe)
 61912 pkg	RET   setgid 0
 61912 pkg	CALL  seteuid(0xfffe)
 61912 pkg	RET   seteuid 0
 61912 pkg	CALL  setuid(0xfffe)
 61912 pkg	RET   setuid 0
 61912 pkg	CALL=20
mkdir(0x80301c2e8,0x1ff<S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_I=
ROTH
|S_IWOTH|S_IXOTH>)
 61912 pkg	NAMI  "/var/db/pkg/local.sqlite.lock"
 61912 pkg	RET   mkdir -1 errno 13 Permission denied

=3D=3D> privileges get dropped and only afterwards mkdir
/var/db/pkg/local.sqlite.lock is tried, which has to fail as user "nobody".



Verified with "chmod 777 /var/db/pkg/"

   drwxr-xr-x	2 nobody  nobody    4096 Oct 19 12:50 local.sqlite.lock



>From src/info.c:

322
323	    drop_privileges();
324	    if (pkgdb_obtain_lock(db, PKGDB_LOCK_READONLY) !=3D EPKG_OK) {
325		    pkgdb_close(db);

Probably wrong order of drop_privileges and pkgdb_obtain_lock?


This happens only on NFS because of this in src/pkgdb.c:

1026  /*
1027   * Fall back on unix-dotfile locking strategy if on a network filesys=
tem
1028   */

(...)
1034   sqlite3_vfs_register(sqlite3_vfs_find("unix-dotfile"), 1);


(Our quick workaround was to comment out the whole "fall back on unix-dotfi=
le
on NFS" part. Probably not the best solution ...)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-213611-32340-WdawqEJbHb>