You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "Dr. Johannes Zellner" <jo...@zellner.org> on 2015/01/20 23:01:59 UTC

can't run couchdb run as couchdb user / only root works

Hi,

I installed couchdb 1.6.1 on *debian 8.0, armv7l* mostly according to

https://cwiki.apache.org/confluence/display/COUCHDB/Debian
http://docs.couchdb.org/en/1.6.1/install/unix.html

*unfortunately it runs only as root, not as couchdb user although **I 
followed the instructions for ownership and permissions*, especially:

|sudo mkdir -p /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb
|
|sudo chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb|
|sudo chmod -R g+rw /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb|

--> *all couchdb directories and their content under /usr/local are 
owned by couchdb.couchdb*.

When starting couchdb as couchdb user I get:

couchdb@localhost:~$ couchdb
Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Failure to start Mochiweb: eacces
[error] [<0.101.0>] {error_report,<0.30.0>,
                      {<0.101.0>,crash_report,
                       [[{initial_call,
{mochiweb_socket_server,init,['Argument__1']}},
                         {pid,<0.101.0>},
                         {registered_name,[]},
                         {error_info,
                          {exit,eacces,
                           [{gen_server,init_it,6,
                             [{file,"gen_server.erl"},{line,322}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,237}]}]}},
                         {ancestors,
[couch_secondary_services,couch_server_sup,<0.31.0>]},
                         {messages,[]},
                         {links,[<0.90.0>]},
                         {dictionary,[]},
                         {trap_exit,true},
                         {status,running},
                         {heap_size,987},
                         {stack_size,27},
                         {reductions,455}],
                        []]}}
{"init terminating in 
do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,couch_secondary_services,{shutdown,{failed_to_start_child,httpd,eacces}}}}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,272}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

*Any ideas what's going wrong?*

-- 
Johannes


Re: can't run couchdb run as couchdb user / only root works

Posted by Ingo Radatz <th...@googlemail.com>.
I think you are right when the browser is the runtime environment you 
have in mind (and sorry ;-) i'm blind for all mentions of "couchbase")

But Android is used for a growing number of cheap but more and more 
powerful devices. I think we should have an eye on it - IMO it will turn 
into an interesting AND serious use case. If i see a wider adoption in 
production i will definitely try to push that into the CouchDBs 
marketing channel. Par example i know a pilot project of a german 
windmill farm - they test CouchDB for the embed systems on top of 
android. I would love to see more CouchDB's in such innovative and 
future-orientated products!

> oh, didn't know couchdb could be run on phones. I thought we had to use
> pouchdb for that (in the browser) or couchbase lite
> I guess this is only useful for well informed and versed insiders?
> Alex
>
>
> 2015-01-22 14:59 GMT+01:00 Ingo Radatz <th...@googlemail.com>:
>
>> thank you for sharing the solution
>>

Re: can't run couchdb run as couchdb user / only root works

Posted by Alexander Gabriel <al...@barbalex.ch>.
oh, didn't know couchdb could be run on phones. I thought we had to use
pouchdb for that (in the browser) or couchbase lite
I guess this is only useful for well informed and versed insiders?
Alex


2015-01-22 14:59 GMT+01:00 Ingo Radatz <th...@googlemail.com>:

> thank you for sharing the solution
>

Re: can't run couchdb run as couchdb user / only root works

Posted by Ingo Radatz <th...@googlemail.com>.
thank you for sharing the solution

Re: can't run couchdb run as couchdb user / only root works

Posted by "Dr. Johannes Zellner" <jo...@zellner.org>.
Hi,

I found the solution myself, It's not related to couchdb but I'll send 
the solution here anyway so that it's documented.

As said I'm running couchdb on ARM, to be more precise, I'm running 
couchdb on an android phone in a debian chroot environment.

Apparently android requires special permissions for opening a socket, 
see for example https://yeri.be/socket-permission-denied

The solution of my problem was as simple as this:

# addgroup --gid 3003 aid_inet
# adduser couchdb aid_inet

afterwards I could run couchdb as couchdb user.

-- 
Johannes

Am 2015-01-21 06:47, schrieb Kiril Stankov:

> Here is what I followed on Ubuntu, must work on Debian too. At least 
> check the chown ans chmod section:
> 
> # via http://wiki.apache.org/couchdb/Installing_on_Ubuntu [3]
> 
> sudo apt-get install --yes build-essential curl git
> sudo apt-get install --yes python-software-properties python g++ make
> 
> sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe 
> erlang-eunit erlang-nox erlang-xmerl erlang-inets
> sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev 
> libtool
> 
> # via http://ftp.fau.de/apache/couchdb/source/1.6.1 [4]/
> cd /tmp
> wget 
> http://ftp.fau.de/apache/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz 
> [5]
> tar xvzf apache-couchdb-*
> 
> cd apache-couchdb-*
> ./configure && make
> 
> sudo make install
> 
> useradd -d /var/lib/couchdb couchdb
> chown -R couchdb: /var/lib/couchdb /var/log/couchdb
> 
> # vi /etc/passwd here and change home directory to 
> /usr/local/var/lib/couchdb/
> 
> chown -R couchdb: /usr/local/var/{lib,log,run}/couchdb 
> /usr/local/etc/couchdb
> chmod 0770 /usr/local/var/{lib,log,run}/couchdb/
> chmod 664 /usr/local/etc/couchdb/*.ini
> chmod 775 /usr/local/etc/couchdb/*.d
> 
> cd /etc/init.d
> ln -s /usr/local/etc/init.d/couchdb couchdb
> /etc/init.d/couchdb start
> update-rc.d couchdb defaults
> 
> curl http://127.0.0.1:5984 [6]/
> 
> # vi /usr/local/etc/couchdb/default.ini
> # change bind_adress to 0.0.0.0
> 
> service couchdb restart
> 
> --
> Regards,
> 
> Kiril Stankov,
> OpenNet Software ltd.
> 
> -------------------------
> FROM: "Dr. Johannes Zellner" <jo...@zellner.org>
> SENT: 21 January 2015 00:01:59 EET
> TO: user@couchdb.apache.org
> SUBJECT: can't run couchdb run as couchdb user / only root works
> 
> Hi,
> 
> I installed couchdb 1.6.1 on *debian 8.0, armv7l* mostly according to
> 
> https://cwiki.apache.org/confluence/display/COUCHDB/Debian [1]
> http://docs.couchdb.org/en/1.6.1/install/unix.html [2]
> 
> *unfortunately it runs only as root, not as couchdb user although **I
> followed the instructions for ownership and permissions*, especially:
> 
> |sudo mkdir -p /usr/local/{lib,etc}/couchdb
> /usr/local/var/{lib,log,run}/couchdb
> |
> |sudo chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb
> /usr/local/var/{lib,log,run}/couchdb|
> |sudo chmod -R g+rw /usr/local/{lib,etc}/couchdb
> /usr/local/var/{lib,log,run}/couchdb|
> 
> --> *all couchdb directories and their content under /usr/local are
> owned by couchdb.couchdb*.
> 
> When starting couchdb as couchdb
> user I get:
> 
> couchdb@localhost:~$ couchdb
> Apache CouchDB 1.6.1 (LogLevel=info) is starting.
> Failure to start Mochiweb: eacces
> [error] [<0.101.0>] {error_report,<0.30.0>,
> {<0.101.0>,crash_report,
> [[{initial_call,
> {mochiweb_socket_server,init,['Argument__1']}},
> {pid,<0.101.0>},
> {registered_name,[]},
> {error_info,
> {exit,eacces,
> [{gen_server,init_it,6,
> [{file,"gen_server.erl"},{line,322}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,237}]}]}},
> {ancestors,
> [couch_secondary_services,couch_server_sup,<0.31.0>]},
> {messages,[]},
> 
> {links,[<0.90.0>]},
> {dictionary,[]},
> {trap_exit,true},
> {status,running},
> {heap_size,987},
> {stack_size,27},
> {reductions,455}],
> []]}}
> {"init terminating in
> do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,couch_secondary_services,{shutdown,{failed_to_start_child,httpd,eacces}}}}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,272}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
> 
> Crash dump was written to: erl_crash.dump
> init terminating
> in do_boot ()
> 
> *Any ideas what's going wrong?*


Links:
------
[1] https://cwiki.apache.org/confluence/display/COUCHDB/Debian
[2] http://docs.couchdb.org/en/1.6.1/install/unix.html
[3] http://wiki.apache.org/couchdb/Installing_on_Ubuntu
[4] http://ftp.fau.de/apache/couchdb/source/1.6.1
[5] 
http://ftp.fau.de/apache/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
[6] http://127.0.0.1:5984

Re: can't run couchdb run as couchdb user / only root works

Posted by Kiril Stankov <ki...@open-net.biz>.
Here is what I followed on Ubuntu, must work on Debian too. At least check the chown ans chmod section:

# via http://wiki.apache.org/couchdb/Installing_on_Ubuntu

sudo apt-get install --yes build-essential curl git
sudo apt-get install --yes python-software-properties python g++ make

sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets
sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool

# via http://ftp.fau.de/apache/couchdb/source/1.6.1/
cd /tmp
wget http://ftp.fau.de/apache/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
tar xvzf apache-couchdb-*

cd apache-couchdb-*
./configure && make

sudo make install



useradd -d /var/lib/couchdb couchdb
chown -R couchdb: /var/lib/couchdb /var/log/couchdb

# vi /etc/passwd here and change home directory to /usr/local/var/lib/couchdb/


chown -R couchdb: /usr/local/var/{lib,log,run}/couchdb /usr/local/etc/couchdb
chmod 0770 /usr/local/var/{lib,log,run}/couchdb/
chmod 664 /usr/local/etc/couchdb/*.ini
chmod 775 /usr/local/etc/couchdb/*.d

cd /etc/init.d
ln -s /usr/local/etc/init.d/couchdb couchdb
/etc/init.d/couchdb start
update-rc.d couchdb defaults

curl http://127.0.0.1:5984/

# vi /usr/local/etc/couchdb/default.ini
#  change bind_adress to 0.0.0.0

service couchdb restart


-- 
Regards,

Kiril Stankov,
OpenNet Software ltd.


-------- Original Message --------
From: "Dr. Johannes Zellner" <jo...@zellner.org>
Sent: 21 January 2015 00:01:59 EET
To: user@couchdb.apache.org
Subject: can't run couchdb run as couchdb user / only root works

Hi,

I installed couchdb 1.6.1 on *debian 8.0, armv7l* mostly according to

https://cwiki.apache.org/confluence/display/COUCHDB/Debian
http://docs.couchdb.org/en/1.6.1/install/unix.html

*unfortunately it runs only as root, not as couchdb user although **I 
followed the instructions for ownership and permissions*, especially:

|sudo mkdir -p /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb
|
|sudo chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb|
|sudo chmod -R g+rw /usr/local/{lib,etc}/couchdb 
/usr/local/var/{lib,log,run}/couchdb|

--> *all couchdb directories and their content under /usr/local are 
owned by couchdb.couchdb*.

When starting couchdb as couchdb user I get:

couchdb@localhost:~$ couchdb
Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Failure to start Mochiweb: eacces
[error] [<0.101.0>] {error_report,<0.30.0>,
                      {<0.101.0>,crash_report,
                       [[{initial_call,
{mochiweb_socket_server,init,['Argument__1']}},
                         {pid,<0.101.0>},
                         {registered_name,[]},
                         {error_info,
                          {exit,eacces,
                           [{gen_server,init_it,6,
                             [{file,"gen_server.erl"},{line,322}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,237}]}]}},
                         {ancestors,
[couch_secondary_services,couch_server_sup,<0.31.0>]},
                         {messages,[]},
                         {links,[<0.90.0>]},
                         {dictionary,[]},
                         {trap_exit,true},
                         {status,running},
                         {heap_size,987},
                         {stack_size,27},
                         {reductions,455}],
                        []]}}
{"init terminating in 
do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,couch_secondary_services,{shutdown,{failed_to_start_child,httpd,eacces}}}}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,272}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

*Any ideas what's going wrong?*

-- 
Johannes