Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed MongoDB using this tutorial. I have tried to set --dbpath in /etc/mongodb.conf like this:


#where to log


When I mongod I get:

ERROR: dbpath (/data/db/) does not exist.

Further more, if I declare mongodb --dbpath /path/that/iwant i get:

exception in initAndListen: 10309 Unable to create/open lock file
errno:13 Permission denied Is a mongod instance already running?

Q: How do I get mongod to reference the proper path in the config file without specifying.

Bonus: Why is permission being denied from mongo. (I have tried sudo chmod -R 775 /path/that/iwant and sudo chown -R mongodb /path/that/iwant)

I am new to mongo and database admin exchange. As a brother from Stack Overflow I am humbled.

Edit: I added the path /data/db to the pie and chown mongodb on it. If I sudo mongod the server starts. If I try to start it with my user it will not start getting an error Unable to create/open lock file which exists.

Edit: Here is what my /etc/init.d/mongd looks like:


# Default defaults.  Can be overridden by the /etc/default/$NAME
LOGFILE=$LOGDIR/$NAME.log  # Server logfile

...further down

DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}
DAEMON_OPTS="$DAEMON_OPTS --config $CONF --rest"

This is what ps aux | grep mongo looks like after i start the server with sudo mongod:

root     10747  0.1  0.3   5124  1612 pts/0    S+   10:41   0:00 sudo mongod
root     10748  1.8  3.8  84896 17416 pts/0    Sl+  10:41   0:00 mongod
1001     10823  0.0  0.1   3544   808 pts/1    S+   10:42   0:00 grep --color=auto mongo
share|improve this question
I've had somewhat similar issues. First, /data/db is going to be the default data path. That's why it's trying to start there if you don't specify. You can specify in the init script. I don't see a note that you did that, and couldn't find an instruction in the tutorial you linked. Is $DATA specified there as called in this line? DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}. Also, are you calling the init script when you start (e.g., service mongo start) to call in those values? Can you paste in your ps aux | grep mongo here when it's running? – Valerie Parham-Thompson Apr 20 '14 at 12:49
I've edited my question and added that information @ValerieParham-Thompson. I thank you so much for the response. I thought I was a goner on this one. – 13ruce1337 Apr 20 '14 at 14:43
OK. Are you typing "sudo mongod" or "sudo /etc/init.d/mongod start"? – Valerie Parham-Thompson Apr 21 '14 at 1:21
@ValerieParham-Thompson I am typing "sudo mongod" – 13ruce1337 Apr 21 '14 at 12:18
Ah, okay. Try using the init file... the instructions in that tutorial say "sudo /etc/init.d/mongod start" so that should be the right command. That should call in the variables you've specified in the init file, including the mongodb user. Does that work? – Valerie Parham-Thompson Apr 22 '14 at 1:17

Firstly instead of installing mongodb through apt just get a tar or zip of it.

1)Extract it to your home folder or wherever you would like.

2)Mark the mongod,mongo,mongos executable.

3)make a conf file say mongod.conf and add

 port = 27001
 fork = true

4)Start mongod by

 path/bin/mongod --config path/mongod.conf

"bin" because you will find mongod in bin folder after extract

share|improve this answer
I'm not sure if you've noticed I have an ARM processor... – 13ruce1337 Apr 24 '14 at 1:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.