On Mon, May 23, 2011 at 6:29 PM, Noah Slater <[email protected]> wrote:
>
> On 23 May 2011, at 17:26, till wrote:
>
>> Yes, I did. I'm just booting my vm. Will have it for you shortly.
>>
>> Btw, the couchdb's home is its db dir. And yes, all permissions are
>> correct. It wouldn't work otherwise when I used sudo -u.
>
> Well something odd is clearly going on, and I think we should understand what
> that is before attempting to fix it through guesswork. How would we even know
> if the underlying problem had been addressed?
>
>
I think su -c foo etc. is fundamentally wrong. sudo -u is not any
better because of the ulimit mess and inconsistencies. In the end,
it's why there's start-stop-daemon.
For completeness, here's the user:
foo:~# id couchdb
uid=1001(couchdb) gid=2000(couchdb) groups=2000(couchdb)
foo:~# cat /etc/passwd|grep couchdb
couchdb:x:1001:2000:CouchDB:/couchdb/:/bin/zsh
foo:~# ls -lah /couchdb/
total 28K
drwxr-xr-x 5 couchdb couchdb 4.0K 2011-05-23 07:34 .
drwxr-xr-x 28 root root 4.0K 2011-05-23 09:22 ..
drwxr-xr-x 2 couchdb couchdb 4.0K 2011-05-23 07:08 db
drwxr-xr-x 2 couchdb couchdb 4.0K 2011-05-23 07:34 .delete
-rw-r--r-- 1 couchdb couchdb 4.1K 2011-05-23 07:35 _users.couch
drwxr-xr-x 2 couchdb couchdb 4.0K 2011-05-23 07:08 views
Debugging the init-script:
After removing the pipe to /dev/null, it errors with invalid option --
'b'. So I extracted the call:
foo:~# su couchdb -c /usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5
su: invalid option -- 'b'
Usage: su [options] [LOGIN]
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-h, --help display this help message and exit
-, -l, --login make the shell a login shell
-m, -p,
--preserve-environment do not reset environment variables, and
keep the same shell
-s, --shell SHELL use SHELL instead of the default in passwd
So, the first thing that seems to be off -- the command is not quoted
which leads to the error.
Quoting it, doesn't help either:
foo:~# su couchdb -c "/usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5"
foo:~# echo $?
127
Any thoughts?
Again, the following call works:
sudo -u couchdb /usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5
Till