Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CouchDB 2.1 can't start on macOS 10.12.6 #739

Closed
mgesmundo opened this issue Aug 8, 2017 · 11 comments
Closed

CouchDB 2.1 can't start on macOS 10.12.6 #739

mgesmundo opened this issue Aug 8, 2017 · 11 comments

Comments

@mgesmundo
Copy link

Hi,
I tried to start (without success) CouchDB 2.1 on the same Mac where a CouchDB 2.0 works fine.

Expected Behavior

CouchDB 2.1 runs and show Fauxton interface.

Current Behavior

CouchDB 2.1 can't start. Below the tail of the log file:

[notice] 2017-08-08T11:00:35.833546Z couchdb@localhost <0.320.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:327) <= mem3_shards:load_shards_from_disk/1(line:315) <= mem3_shards:load_shards_from_disk/2(line:331) <= mem3_shards:for_docid/3(line:87) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)
[error] 2017-08-08T11:00:35.833621Z couchdb@localhost emulator -------- Error in process <0.16789.1> on node couchdb@localhost with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,327}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,315}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,331}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,87}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,38}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,187}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,134}]}]}

Steps to Reproduce

  1. shutdown CouchDB 2.0 (if running)
  2. start CouchDB 2.1

Your Environment

  • Version used: CouchDB 2.1.0
  • Operating System and version: macOS 10.12.6
@Chris-Andrews
Copy link

I'm also unable to run CouchDB 2.1 on macOS 10.11.6

@wohali
Copy link
Member

wohali commented Aug 8, 2017

The errors you're seeing indicate two things:

  1. CouchDB is running just fine. Those are expected errors for a brand new CouchDB 2.1 installation.
  2. You haven't completed the First Time single-node setup steps as outlined in our manual here: http://docs.couchdb.org/en/2.1.0/install/setup.html#install-setup

Someone on our IRC channel just commented he was able to get CouchDB 2.1 on Mac running correctly, though he had to take a few extra steps:

14:23 < bitcollage_> so i solved it.
14:23 < bitcollage_> removing the cache folder from ~/Library/Caches
14:23 < bitcollage_> removing any related file/folder in ~/Library/Application
                     Support/CouchDB
14:24 < bitcollage_> removing ~/Library/Preferences/couchdb-server.ini
14:24 < bitcollage_> removing ~/Library/Preferences/org.apache.couchdb.plist
14:25 < bitcollage_> lsof -wni tcp:3000
14:25 < bitcollage_> kill -9 PID
14:25 < bitcollage_> i mean lsof -wni tcp:5984
14:26 < bitcollage_> then following
                     http://docs.couchdb.org/en/2.1.0/install/mac.html for
                     fresh installation

Can you please try these steps and report back? Thanks.

@SerkanSipahi
Copy link

SerkanSipahi commented Aug 8, 2017

Note:

1.) Please make a backup of your Database/Configuration Files/etc. before your applying the commands.

@mgesmundo
Copy link
Author

@wohali thanks for your answer.
I've tried all steps to clean the previous 2.0 installation, but the 2.1 can't start. When I try to start the native app, it try to open 127.0.0.1/_utils page but the server is down.
I've also tried using another clean Mac with also macOS 10.12.6, but CouchDB 2.1 can't start (same result).
Finally I've tried on a Mac with OS X 10.10.5 where there is a CouchDB 1.6.1: CouchDB 2.1 can't starts.
Note that on CouchDB 2.1 is not possible to update Launch Admin Console at Start / Automatically Start at Login commands available on the icon bar menu.
I'm not able to complete the First Time single-node setup steps because the server is down.
Suggestions?
Thanks!

@SerkanSipahi
Copy link

SerkanSipahi commented Aug 9, 2017

@mgesmundo one of my problems was also to start the native app. When it tried to start couch, the mac show a window with [cancel] and [retry]. After several tries i decided to click cancel! That was, after then it works. Its also important to start your native app in the mac program folder ( not outside of them). Furthermore please make sure you have killed all running process when using this command lsof -wni tcp:5984

@mgesmundo
Copy link
Author

@SerkanSipahi on all three Mac I've not a window with [cancel] and [retry] buttons. The app is into Applications folder and when I try to start it, simply it takes a long time to show the menu icon on menu bar and opens an empty Safari page that fail to connect to CouchDB. Using lsof -wni tcp:5984 I've not a running CouchDB instance.
All commands of the menu bar icon are unresponsive.
This is the first issue that I've with CouchDB after several years!

@b20n
Copy link
Contributor

b20n commented Aug 9, 2017

Hrm, this works fine for me on 10.11.4.

  1. Download 2.1.0 from here
  2. Double-click the red icon

Fauxton immediately pops up in my browser and I've got a beam running:

~ $ ps -ef | grep beam
  501 67915 67808   0  8:59AM ??         0:01.19 /Users/banjiewen/Downloads/Apache CouchDB.app/Contents/Resources/couchdbx-core/bin/../erts-6.3/bin/beam.smp -K true -A 16 -Bd -- -root /Users/banjiewen/Downloads/Apache CouchDB.app/Contents/Resources/couchdbx-core/bin/.. -progname couchdb -- -home /Users/banjiewen -- -boot /Users/banjiewen/Downloads/Apache CouchDB.app/Contents/Resources/couchdbx-core/bin/../releases/2.1.0/couchdb -name couchdb@localhost -setcookie monster -kernel error_logger silent -sasl sasl_error_logger false -noshell -noinput -config /Users/banjiewen/Downloads/Apache CouchDB.app/Contents/Resources/couchdbx-core/bin/../releases/2.1.0/sys.config -couch_ini /Users/banjiewen/Downloads/Apache CouchDB.app/Contents/Resources/couchdbx-core/etc/default.ini /Users/banjiewen/Library/Preferences/couchdb2-local.ini

Killing it behaves somewhat oddly, and I haven't seen a window with cancel/retry buttons.

This machine has never run the .app for a previous version.

@wohali
Copy link
Member

wohali commented Aug 9, 2017

We've now got a log of the output when startup fails:

https://gist.github.com/anonymous/3908d3725832b1ee1cfcffc40878f8d6

Then, from IRC:

18:37 <+rnewson> ah, I see it
18:37 <+rnewson> couch_epi calls crypto but doesn't depend on it
18:38 <+rnewson> so the crypto app isn't loaded when we try to call it
18:39 <+rnewson> I caused it
18:39 <+rnewson> in 9e56cf334c33d4cdb96acbfca9cc9461e2b658aa
18:39 <+rnewson> https://www.irccloud.com/pastebin/2aYJ6jS5/
18:39 <+Wohali> doh.
18:39 <+Wohali> this was you trying to fix 20 support right?
18:39 <+rnewson> https://www.irccloud.com/pastebin/HGHbShdT/
18:39 <+rnewson> right

@wohali
Copy link
Member

wohali commented Aug 9, 2017

We worked through this on IRC and have two workarounds.

  1. Stop the Apache CouchDB app. Then, as root or with sudo, run the following commands:
chmod +x '/Applications/Apache CouchDB.app/Contents/Resources/couchdbx-core/lib/crypto-3.4.2/priv/lib/crypto.so'
install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib lib/libcrypto.1.0.0.dylib '/Applications/Apache CouchDB.app/Contents/Resources/couchdbx-core/lib/crypto-3.4.2/priv/lib/crypto.so'
chmod -x '/Applications/Apache CouchDB.app/Contents/Resources/couchdbx-core/lib/crypto-3.4.2/priv/lib/crypto.so'
  1. Install a system-wide openssl with brew install openssl.

@mgesmundo @Chris-Andrews Can you try either of these 2 workarounds and let us know if it works?

The bug is here: https://github.com/janl/build-couchdb-mac/blob/master/build.sh#L81
I'll open a PR against that to fix it, which won't get merged and fixed for about another two weeks, when the maintainer of this binary is back from holidays and can build a new version.

@Chris-Andrews
Copy link

@wohali Thank you for looking into this. I'll have a chance to try the suggested fix on the computer that was giving me trouble within the next couple days. In the meantime I tried installing the version 2.1 app on another machine and found that it works with no problems. I checked and on this machine I had already installed openssl via homebrew, so I think this is likely the fix for this issue.

@mgesmundo
Copy link
Author

Thank you very much @wohali ! After installing openssl CouchDB 2.1 works fine!
All the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants