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!

davidmatas
  • 1,851
  • 3
  • 15
  • 14

26 Answers26

63

I had the same problem. Fixed with:

WARNING: This erases your local database:

meteor reset

colllin
  • 9,442
  • 9
  • 49
  • 65
Kriss
  • 676
  • 4
  • 5
  • 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 '12 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 07 '12 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 '12 at 09:17
  • 3
    Worked for me. I think you have to cd into the project root folder and then do the meteor reset. –  Aug 12 '12 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 '13 at 20:06
  • Works like a charm. My failure was caused by an unexpected shutdown btw. – urig Oct 05 '13 at 17:59
  • Putting up a warning doesn't make this a good solution. Meteor reset should only be used as a last resource. The answer on http://stackoverflow.com/questions/31617615/meteor-unexpected-mongo-exit-code-100-restarting-cant-start-mongo-server fits perfectly, deleting mongodb.lock and journal files. – Marcelo Schmidt Jan 28 '16 at 13:05
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! :)

jsbeckr
  • 1,183
  • 1
  • 10
  • 24
  • `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 '12 at 09:19
  • 1
    +1 worked great. `meteor reset` removes *everything from your database* so this solution is a much better bet. – TimDog Nov 29 '12 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!

Samo
  • 8,202
  • 13
  • 58
  • 95
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.

devdave
  • 688
  • 5
  • 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 '12 at 09: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 '12 at 00: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 '12 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: https://github.com/pixelhandler/vagrant-dev-env – pixelhandler Oct 08 '12 at 06:48
  • 3
    The reason is here, https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/QSkyXTqaMjc `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 '12 at 01:29
  • @TiansHUo Yep, that was my problem. I was using a VirtualBox shared folder (shared with Windows 8). Once I created my meteor project in my Ubuntu home directory all was well. Thank you. – Abe May 08 '13 at 03:27
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 :)

Community
  • 1
  • 1
Tarang
  • 75,157
  • 39
  • 215
  • 276
  • 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 08 '14 at 00: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

ravshanoff
  • 101
  • 1
  • 3
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.

Dave
  • 2,735
  • 8
  • 40
  • 44
  • 1
    You're a lifesaver, I had 420 MB free and was wondering why I keep getting this message – sdooo Dec 20 '14 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.

Emil
  • 7,220
  • 17
  • 76
  • 135
Larry R.
  • 43
  • 4
  • 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 '13 at 03:12
3

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

export LC_ALL=C
tomrozb
  • 25,773
  • 31
  • 101
  • 122
2

Watch for accents in the path of your projects.

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

Trinos
  • 21
  • 1
1

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

RevBingo
  • 307
  • 1
  • 12
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"

Steve
  • 79
  • 2
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.

benvenker
  • 355
  • 1
  • 3
  • 10
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/
danlee2
  • 11
  • 1
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.

mpobrien
  • 4,922
  • 1
  • 33
  • 35
  • 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 '12 at 09: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>
iyermobile
  • 64
  • 4
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.

Trevor Geise
  • 101
  • 8
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.

Sourabh
  • 413
  • 5
  • 17
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

Community
  • 1
  • 1
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/

TH_
  • 97
  • 2
  • 9
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}'

Community
  • 1
  • 1
YaTaras
  • 5,159
  • 1
  • 20
  • 15
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.

Community
  • 1
  • 1
mikeym
  • 5,705
  • 8
  • 42
  • 62
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

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
0

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

Ashraf
  • 63
  • 4