0

I'm having problems getting the couchdb service running. When I start it, it only lives for a second or so before shutting itself down. Here's an example - first a status command showing it's inactive. When started it claims to be running, next status command says it is active, issuing a new status just a second later says it's failed. What's going on?

username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
   Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit) since to. 2016-01-28 22:56:32 CET; 9min ago
  Process: 2906 ExecStart=/usr/bin/couchdb (code=exited, status=1/FAILURE)
 Main PID: 2906 (code=exited, status=1/FAILURE)

jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Main process exited, code=exited, status=1/FAILURE
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Failed with result 'exit-code'.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 22:56:32 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Start request repeated too quickly.
jan. 28 22:56:32 myPC systemd[1]: Failed to start System-wide CouchDB instance.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Failed with result 'start-limit'.

username@myPC:~$ /etc/init.d/couchdb start
[ ok ] Starting couchdb (via systemctl): couchdb.service.

username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
   Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
   Active: active (running) since to. 2016-01-28 23:06:34 CET; 367ms ago
 Main PID: 3071 (beam)
   CGroup: /system.slice/couchdb.service
           +-3071 /usr/lib/erlang/erts-7.0/bin/beam -Bd -K true -A 4 -- -root /usr/lib/erlang -progname erl -- -home /var/...

jan. 28 23:06:34 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 23:06:34 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 23:06:34 myPC systemd[1]: Started System-wide CouchDB instance.
jan. 28 23:06:34 myPC couchdb[3071]: {error_logger,{{2016,1,28},{23,6,34}},std_error,"File operation error: eacces....ver."}
jan. 28 23:06:34 myPC couchdb[3071]: {error_logger,{{2016,1,28},{23,6,34}},std_error,"File operation error: eacces....ver."}
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /lost+found/ebin. Function: read_file_in...erver.
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /root/ebin. Function: read_file_info. Pr...erver.
Hint: Some lines were ellipsized, use -l to show in full.


username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
   Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit) since to. 2016-01-28 23:06:35 CET; 1s ago
  Process: 3097 ExecStart=/usr/bin/couchdb (code=exited, status=1/FAILURE)
 Main PID: 3097 (code=exited, status=1/FAILURE)

jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Main process exited, code=exited, status=1/FAILURE
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Failed with result 'exit-code'.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 23:06:35 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Start request repeated too quickly.
jan. 28 23:06:35 myPC systemd[1]: Failed to start System-wide CouchDB instance.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Failed with result 'start-limit'.

I can't find any log files/stdout/stderr. It seems like something is attempting to restart couchdb but failing based on "couchdb.service: Service hold-off time over, scheduling restart.". But why?

hallvors
  • 103
  • 1
  • 4

1 Answers1

1

The problem is defined in these lines:

jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /lost+found/ebin. Function: read_file_in...erver.
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /root/ebin. Function: read_file_info. Pr...erver.

It tries to find the ebin directory with compiled CouchDB beam files, but failes due to permission issue (eacces). However, the reason is not in permissions, but in the path: why it looks for beams in /root directory? Probably, because it fails on check for all the other options (and that service runs as root, what is bad).

The only possible answer is that you have $ERL_LIBS path misconfigured. It need to be set for beam command line argument like that -env ERL_LIBS $ERL_LIBS:/usr/lib64/couchdb/erlang/lib - note, that the path here should be set according your installation.

Kxepal
  • 126
  • 3
  • Thanks! I think I got ERL_LIBS set correctly (/usr/lib/erlang:/usr/lib/i386-linux-gnu/couchdb/erlang). However.. {"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/etc/couchdb/default.ini","/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{error,enoent}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,56}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,273}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}} Crash dump is being written.. – hallvors Jan 29 '16 at 11:14
  • "enoent" means "file or directory doesnt exists", I guess directory is your case. Also, it seems the right paths should be `/usr/lib/erlang/lib:/usr/lib/i386-linux-gnu/couchdb/erlang/lib` for you, but better check them twice. – Kxepal Jan 29 '16 at 18:18
  • 1
    I'm such a newbie, I don't know how to check :) But thanks for your help, I'm learning. I really enjoy using Lubuntu - didn't expect this slightly old laptop to be so fast and zippy and pleasant to use :) Anyway, I did an apt-get remove --purge for couchdb and another install and now it works - so far! I'll cross fingers it will keep working also when I have actual data.. – hallvors Jan 29 '16 at 22:56