1

After using CouchDB 1.4 on Ubuntu 14.04, I recently tried to start fresh with 15.10 and the main couchdb package. It installed couchdb 1.6 which was a welcome change, but the ubuntu installation documentation on the couch site hasn't been updated.

I'm having quite a few issues getting it up and running. I ran the apt-get install couchdb package installation and created a couchdb user and group.

It appears that maybe the Ubuntu repo doesn't install things in the same locations as it says in the couchdb docs for ubuntu (which isn't that big of an issue) but it also doesn't seem to create all of the needed folders, nor set the correct permissions.

When I run couchdb -b, I get Apache CouchDB needs write permission on the PID file: /var/run/couchdb/couchdb.pid

Separately (as more information), the /var/run/couchdb folder does not get created on install, but if I create it (and a couple others) and set the permissions on those ones to couchdb:couchdb as well,things do start up. However this does not do it permanently as the pid file gets reset after restart and we're back to square one. As a side note, I also don't know if all the required log or other folders get created on install. Let me know if you noticed anything there.

As another piece of info, when I try to run sudo -i -u couchdb couchdb I get: sudo: unable to change directory to /usr/local/var/lib/couchdb: No such file or directory

This (usr/local) seems like the right folder from the documentation, but the Ubuntu 15 installations seems to not use /usr/local and mostly use /etc/couchdb. A bit confusing trying to follow along with all the docs because of this.

If I run sudo -i -u couchdb couchdb I get:

{"init terminating in do_boot",{{badmatch,{error,{bad_return,    
{{couch_app,start,[normal,  
["/etc/couchdb/default.ini","/etc/couchdb/local.ini"]]},{'EXIT',{{bad match,
{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 to: erl_crash.dump...done
init terminating in do_boot ()

Which is a enoent error. I also get the permissions error sibling of this at times (eecees? can't remember). Is that any help?

When I run around swatting things by creating random folders and changing permissions, I can get close, but I can't get the final pid file to keep the correct permissions. Is that the only issue or should I be wary of the 15.10 install in general? Can someone help me trouble shoot the pid permissions error? How do I run it? Thanks!

2

1 Answer 1

1

The answer lies in the init script that comes along with the default ubuntu package.

/etc/init.d/couchdb starting in Line 83

start_couchdb () {
    # Start Apache CouchDB as a background process.

    mkdir -p "$RUN_DIR"
    if test -n "$COUCHDB_USER"; then
        chown $COUCHDB_USER "$RUN_DIR"
    fi
    command="$COUCHDB -b"
    if test -n "$COUCHDB_STDOUT_FILE"; then
        command="$command -o $COUCHDB_STDOUT_FILE"
    fi
    if test -n "$COUCHDB_STDERR_FILE"; then
        command="$command -e $COUCHDB_STDERR_FILE"
    fi
    if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
        command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
    fi
    run_command "$command" > /dev/null
}

I got myself the official ubuntu 15.10 vagrant box and installed the couchdb package, then edited /etc/couchdb/local.ini to bind the httpd to a different IP Adress and restarted the couchdb service via /etc/init.d/couchdb restart

Everything worked fine for me.

TL;DR use the init script /etc/init.d/couchdb to start/stop and restart couchdb

2
  • I had done this before and it doesn't seem to get it up and running. Doing it again now, when I curl the server, I get curl: (7) Failed to connect to 127.0.0.1 port 5984: Connection refused Commented Nov 13, 2015 at 4:41
  • did you try it with a fresh untouched vagrant box? Probably easier than trying to figure out where it went wrong. It works fine for me. Here i put up my command history of my vagrant box on pastebin, also showing the curl to localhost: pastebin.com/LyeCVLnD
    – DanVan
    Commented Nov 13, 2015 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .