Background: I'm running a redmine server with the redmine DMSF plugin, which provides full text search using xapian. Redmine is running on Passenger, hosted by Nginx. The Passenger process is running as user "redmine" and group "nginx". Apparmor is disabled for Passenger and Nginx.
The redmine log indicates that the xapian index cannot be found:
REDMAIN_XAPIAN ERROR: Xapian database is not properly set, initiated or it's corrupted.
DatabaseOpeningError: Couldn't stat '/var/tmp/dmsf-index/english'
And an strace on the running passenger process shows the following:
[pid 1013] stat("/var/tmp/dmsf-index/english", 0x7fa3bd112f00) = -1 ENOENT (No such file or directory)
[pid 1013] write(8, "REDMAIN_XAPIAN ERROR: Xapian dat"..., 88) = 88
[pid 1013] write(8, "DatabaseOpeningError: Couldn't s"..., 66) = 66
A file listing as root:
775# ls -ahl /var/tmp/dmsf-index/english/
total 340K
drwxr-x--- 2 redmine nginx 4.0K Sep 5 13:04 .
drwxr-x--- 3 redmine nginx 4.0K Sep 5 13:04 ..
-rw-r----- 1 redmine nginx 0 Sep 5 14:00 flintlock
-rw-r----- 1 redmine nginx 28 Sep 5 13:04 iamchert
-rw-r----- 1 redmine nginx 13 Sep 5 13:04 position.baseA
-rw-r----- 1 redmine nginx 16 Sep 5 13:04 position.baseB
-rw-r----- 1 redmine nginx 80K Sep 5 13:04 position.DB
-rw-r----- 1 redmine nginx 13 Sep 5 13:04 postlist.baseA
-rw-r----- 1 redmine nginx 17 Sep 5 13:04 postlist.baseB
-rw-r----- 1 redmine nginx 176K Sep 5 13:04 postlist.DB
-rw-r----- 1 redmine nginx 13 Sep 5 13:04 record.baseA
-rw-r----- 1 redmine nginx 14 Sep 5 13:04 record.baseB
-rw-r----- 1 redmine nginx 8.0K Sep 5 13:04 record.DB
-rw-r----- 1 redmine nginx 13 Sep 5 13:04 termlist.baseA
-rw-r----- 1 redmine nginx 14 Sep 5 13:04 termlist.baseB
-rw-r----- 1 redmine nginx 32K Sep 5 13:04 termlist.DB
And several commands run as user "redmine" and group "nginx" via sudo -i:
redmine@redmine:/var/tmp/dmsf-index/english$ pwd
/var/tmp/dmsf-index/english
redmine@redmine:/var/tmp/dmsf-index/english$ file .
.: directory
redmine@redmine:/var/tmp/dmsf-index/english$ ls
flintlock iamchert position.baseA position.baseB position.DB postlist.baseA postlist.baseB postlist.DB record.baseA record.baseB record.DB termlist.baseA termlist.baseB termlist.DB
redmine@redmine:/var/tmp/dmsf-index/english$ file record.DB
record.DB: data
redmine@redmine:/var/tmp/dmsf-index/english$ whoami
redmine
redmine@redmine:/var/tmp/dmsf-index/english$
As far as I can tell there are no permission errors (usually indicated with EACCES). I have read that NFS or CIFS can return ENOENT under obscure circumstances, but this is a local ext4 partition mounted at /
I have even tried setting the permissions for dmsf-index recursively as 777, but I get the same error.
So my question is, why can't Passenger/Redmine find the directory, while a shell running as the same user can?