Shrenik Gala Shrenik Gala - 4 months ago 21
Linux Question

start-stop-daemon: failed to start `/usr/bin/mongod'

I have an alpine machine on my virtual machine and I want to install mongodb. I added the package for mongodb using "apk add mongodb". I started mongo daemon using command mongod in one terminal. Then opened another terminal with mongo shell using mongo --disableJavaScriptJIT. I tried adding files and reading them from the database and that worked fine. But when I do sudo service mongodb restart I got the following output.

* Caching service dependencies ... [ ok ]
* Starting mongodb ...
* start-stop-daemon: failed to start `/usr/bin/mongod' [ !! ]
* ERROR: mongodb failed to start

Answer

The first thing you should do is to read the log file. I think that you’ll read here that mongodb doesn’t have rights to access some files. When you started it manually, you haven’t run it as user mongodb, have you…?

If this hypothesis is right, then the solution is to fix owner (and group) of the /var/lib/mongodb (recursively).