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:   [Bug 213611] ports-mgmt/pkg: 1.9.1 pkgdb locking doesn't work on NFS
Message-ID:  <bug-213611-32340@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D213611

            Bug ID: 213611
           Summary: ports-mgmt/pkg: 1.9.1 pkgdb locking doesn't work on
                    NFS
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkg@FreeBSD.org
          Reporter: mwennrich@gmail.com
          Assignee: pkg@FreeBSD.org
             Flags: maintainer-feedback?(pkg@FreeBSD.org)

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 ...)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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