34

I'm testing Meteor examples and this is what I see when I run meteor in todos examples:

Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod. Check for other processes listening on port 3002 or other meteors running in the same project.

And this is what happens if I run mongod in the command line:

Thu Apr 12 19:27:39 Mongo DB : starting : pid = 2686 port = 27017 dbpath = /data/db/ master = 0 slave = 0  32-bit 

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations for more

Thu Apr 12 19:27:39 db version v1.4.4, pdfile version 4.5
Thu Apr 12 19:27:39 git version: nogitversion
Thu Apr 12 19:27:39 sys info: Linux murphy 2.6.32.14-dsa-ia32 #1 SMP Thu May 27 16:19:20 CEST 2010 i686 BOOST_LIB_VERSION=1_42
Thu Apr 12 19:27:39 waiting for connections on port 27017
Thu Apr 12 19:27:39 listen(): bind() failed errno:98 Address already in use for port: 27017
Thu Apr 12 19:27:39 MiniWebServer: bind() failed port:28017 errno:98 Address already in use
Thu Apr 12 19:27:39   addr already in use
Thu Apr 12 19:27:39 warning: web admin interface failed to initialize on port 28017

Someone helps? Thanks!

4

26 Answers 26

63

I had the same problem. Fixed with:

WARNING: This erases your local database:

meteor reset

7
  • me too, does not work, I get this error: $ sudo meteor reset reset: Meteor is running. This command does not work while Meteor is running your application. Exit the running meteor development server.
    – stwienert
    Apr 14, 2012 at 16:54
  • 1
    This worked for me. (I had started receiving the Can't start mongod error after restarting my machine without exiting meteor.)
    – Emmett
    May 7, 2012 at 15:10
  • Worked for me too. I had been struggling getting the project shared to my win box (I am running Ubuntu through VirtualBox on a Windows host). During this time the folder has been moved around and I suddenly had problems like described above. I must admit that the confidence in that meteor reset should work, but hey - it worked :)
    – Spiralis
    Jun 13, 2012 at 9:17
  • 3
    Worked for me. I think you have to cd into the project root folder and then do the meteor reset.
    – user405398
    Aug 12, 2012 at 17:15
  • Yes, it works, but it removes all your data from Mongo as well. Try removing .meteor/local/db/mongod.lock (see answer below) first!
    – GijsjanB
    Apr 15, 2013 at 20:06
27

I had the same problem. Just remove .meteor/local/db/mongod.lock in your meteor project folder. And meteor should run normally.

Hope it helped! :)

2
  • meteor reset did the trick for me. I guess that this command perhaps removes the lock-file (along with some other stuff maybe)?
    – Spiralis
    Jun 13, 2012 at 9:19
  • 1
    +1 worked great. meteor reset removes everything from your database so this solution is a much better bet.
    – TimDog
    Nov 29, 2012 at 20:15
26

As mKriss mentioned, try

meteor reset

If you get this error:

reset: Meteor is running.

This command does not work while Meteor is running your application.
Exit the running meteor development server.

Then look for meteor in your running processes:

ps -x | grep meteor

This gave me the following output:

14877 pts/0    Sl     0:02 /usr/lib/meteor/mongodb/bin/mongod --bind_ip 127.0.0.1 --port 3005 --dbpath /home/sam/proto/.meteor/local/db
15022 pts/0    S+     0:00 grep --color=auto meteor

So then I did:

kill -s KILL 14877
meteor reset
meteor

Now everything works!

0
19

Not sure if this is relevant to your problem, but I got this error and eventually discovered it was caused because I had my app directory in a NFS share (I am running on Ubuntu in VirtualBox) which mongodb doesn't like. Putting my app in my home directory instead fixed the problem.

6
  • I had the same problem when I had my project directory on a VirtualBox share, with Ubuntu as the guest and Win7 as the host. Works elsewhere.
    – Ilkka
    Apr 20, 2012 at 9:35
  • Same bug seems to appear in installs on my NTFS share (Win7/Ubuntu 12.04). Moving back to a directory on EXT4 seems to fix things.
    – rjz
    May 21, 2012 at 0:32
  • I have the same problem. I'd really like to keep the share location for my meteor apps, however...any known workarounds?
    – TimDog
    Aug 15, 2012 at 21:02
  • 6
    @TimDog I had same issue running VirtualBox on mac with Vagrant using precise64 (ubuntu) box. For me the workaround was to put my apps in the share location (/vagrant) and to use rsync to copy the apps to the /home/vagrant so I could run mongo without the errors on startup. I put some notes in my dev box repo here: github.com/pixelhandler/vagrant-dev-env Oct 8, 2012 at 6:48
  • 3
    The reason is here, groups.google.com/forum/?fromgroups=#!topic/mongodb-user/… Some file systems don't support the exclusive locking type needed in the dbpath directory. If this is a problem it will be very apparent as the server won't start.
    – TiansHUo
    Nov 16, 2012 at 1:29
11

There are a few ways around this, the question didn't show how to use mongod so I'm going to run through how to get a bit more detail on the error. meteor reset might work but not always & it will clear your apps data if it does work.

The core issue is meteor is very undescriptive when it comes to displaying data, so I would advise to get get a bit more detail on the error as it could literally any mongodb error out there. The steps below should reproduce the error with more verbosity to help diagnose what the root issue is

Find where Meteor installs mongodb

If you have the mongod tool (downloadable from http://mongodb.com), otherwise use the one installed with meteor. Just be careful you don't get too new a version that upgrades your old database, then meteor's older mongodb won't be able to understand it.

typically (but not always) at

/usr/local/meteor/mongodb/bin/mongod (OS X)

/usr/lib/meteor/mongodb/bin/mongod (Red Hat/Debian)

C:\Program Files\Meteor\mongodb\bin\mongod.exe (Windows via Tom Wijsman's port)

Run Meteor's database manually with mongodb

So we're going to use this to manually run mongodb on your apps mongodb database:

In your projects directory with your terminal app/command prompt

cd .meteor
cd local
/usr/local/meteor/mongodb/bin/mongod --dbpath ./

If your mongod path is something else use that instead, the above works on OS X.

Analyse the output to find the root cause of the issue

Now mongodb should run and give you a good description of what the problem is, or run smoothly:

Mon Apr  1 23:59:55 [initandlisten] MongoDB starting : pid=84640 port=27017 dbpath=./ 64-bit  host=MacBook-Pro.local
Mon Apr  1 23:59:55 [initandlisten] 
Mon Apr  1 23:59:55 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Mon Apr  1 23:59:55 [initandlisten] db version v2.2.1, pdfile version 4.5
Mon Apr  1 23:59:55 [initandlisten] git version: d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae
Mon Apr  1 23:59:55 [initandlisten] waiting for connections on port 27017

Have a look at the what the error might be and then tackle the problem displayed. It could be one of many.

Example issue

If it has:

exception in initAndListen: 10310 Unable to lock file: ./mongod.lock. Is a mongod instance already running?, terminating

Then restart your computer to kill any processes that might be using the file and if it still doesn't help use meteor reset to clear the directory at .meteor/local/db so your app uses a fresh database.

The errors are very helpful e.g low disk space (clear up the trash ;-) or cannot write to disk (permissions issue - use chmod/sudo).

Very obscure issues

If you find something very perplexing it might be a mongodb issue more than a meteor one, have a look around for the error you get here on stackoverflow and if you can't find it put a question up and swarms of helpful people are hopefully ready to help :)

1
  • This was helpful, thanks. In my case, I had another Mongo running on the same port. Killing the process was enough to solve the problem.
    – Sacha
    Apr 8, 2014 at 0:12
10

I have very simple solution:

export LC_ALL="en_US.UTF-8"

and run meteor

If it is ok, you can add this line to

sudo vim /usr/local/bin/meteor

0
5

If meteor reset isn't working for you, check your disk space usage.

If you don't have any free disk space, you will get this error. MongoDB takes up about 450MBs, so creating a few projects can fill up a partition quickly.

1
  • 1
    You're a lifesaver, I had 420 MB free and was wondering why I keep getting this message
    – sdooo
    Dec 20, 2014 at 14:53
3

If your meteor project is in a DropBox-folder, check for file names that contain the words conflicted copy in .meteor/local/db/ in your project folder and remove them. That should free up Mongod to run.

1
  • Also nb: on linux many files in the .meteor or symlinks to other locations. This causes epic-dropbox badness. I have disabled syncing on these files.
    – meawoppl
    Mar 14, 2013 at 3:12
3

This is what helped me to run meteor on Google Compute Engine:

export LC_ALL=C
1
  • worked for Digital Ocean droplet too, i was using Ubuntu 14 configured for nodejs Feb 24, 2015 at 19:53
2

Watch for accents in the path of your projects.

..\Système\MyMeteorProject will not work, ..\System\MyMeteorProject will work.

1

Forgive the obvious, but does netstat -antep | grep 3002 show anything? (assuming you're on *nix)

1
  • No, it doesn't show nothing. Apparently there ins't any proccess listening on port 3002
    – davidmatas
    Apr 11, 2012 at 13:50
1

I know this question is rather old, however I just ran into this issue as well and thought this might be useful to someone. What worked in my case was to run "sudo meteor"

1

I got this error message:

MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

...and it turned out that I had an instance of the same app running on a different port, so add "making sure you don't have any other instances of the app running on an alternate port" to the list of things that can cause this error.

1

I could solve the issue under Meteor 1.2.1 and recover my data by deleting the lock file, copying whats left of .meteor/local/db/ to a temporary location (you might call this a backup), issue meteor reset and copy the backup data back to .meteor/local/db/. Everything worked as before.

1

for those using vagrant and do not want to meteor reset, clearing out the db of your meteor's local directory resolved the conflict. from the terminal:

rm -rf .meteor/local/db/
0
Thu Apr 12 19:27:39 listen(): bind() failed errno:98 Address already in use for port: 27017

Something else is already using the port 27017, so mongo startup is failing. Start mongo on a different port or kill whatever process is using 27017 first.

1
  • Yes, I can start mongo in other port, but the problem with meteor persists. Can't start mongod. Check for other processes listening on port 3002 or other meteors running in the same project. There is nothing in that port.
    – davidmatas
    Apr 13, 2012 at 9:07
0

Meteor reset command did not work for me in DOS

I deleted all files and folder under <projectfolder>/.meteor/local/db to Recycle Bin

**DOS Log below:**

D:\Meteor\todos>meteor reset
Project reset.

D:\Meteor\todos>
0

I found the same conflict issue from syncing. I was using Ubuntu One and a bunch of new files were created in .meteor/local/db/ with "u1_conflicted" appended. I deleted those, and the ones in .meteor/local/db/journal and was back up and running.

0

I could recover the error by deleting the Local Mogo db lock.

Steps to remove the db lock :

  1. Navigate to your app directory(where you have Meteor application files)
  2. Remove file $ rm .meteor/local/db/mongod.lock

NOTE : $ meteor reset

WARNING: meteor reset erases everything in your local database.

Error occurs if Meteor Application is still running in background. Db lock is not released by the running application or due to improper system/application shutdown and unavailable for second instance of same application.

So take care to quit the application every time.

0

Same problem when I tried to create my project in a VMWare shared folder linking to a host folder...

cd /mnt/hgfs/Folder_in_C_host_drive

meteor create myapp

cd myapp

meteor

Unexpected mongo exit code 100. Restarting.

...

Solved by moving the project to a standard folder in my filesystem...VMWare Shared Folders are not capable of handling file security and any files are root:root owned...that was why it ended in those MongoDB errors

1
  • Could you possibly clarify your answer, it is not clear how your solution works.
    – dayuloli
    Mar 17, 2015 at 16:18
0

If you are using Vagrant, MongoDb won't run in the Vagrant shared directory: https://gist.github.com/gabrielhpugliese/5855677

If you using Windows for your dev work, Meteor now has a Windows installer: http://win.meteor.com/

0

You can just try to stop running your meteor app using this command: kill -9 ps ax | grep node | grep meteor | awk '{print $1}'

0

I ran into the Unexpected mongo exit code 100. Restarting. error a while back.I ended up answering my own question here which seems to have done the trick for many facing the same issue.Most importantly is it doesn't require meteor resetwhich wipes the database.It's a simple and very quick three step fix so I'd recommend trying it before some of the more complicated suggestions.

0

I had the same problem. Fixed with:

Fixed with:

  1. your project directory
  2. redirect to .meteor directory > .local > .db
  3. in .db folder remove all the files from here
  4. run command "meteor"

It's working fine for me.Try this, it really helps alot.

0

Become a superuser:

# meteor --allow-superuser

0

run the command meteor reset on sudo user. It should work for you..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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