Unexpected mongo exit code 100. Restarting - mongodb

I was trying to run Meteor on my VPS and I was getting this error:
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.
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.
I have figured out that the problem is in my user permissions or something like that. It works very smoothly when I try to run meteor with root access. If I try to run meteor with my "custom" user, it fails. Even though I grant him sudo privileges as listed on DigitalOcean. Why is it so? What is the problem behind?
I am on Ubuntu 14.04.1 LTS. Meteor is version 0.8.3 and I am using MongoDB coming with Meteor. I do not have seperated instalation of MongoDB.
Update: Basicly I have found the problem but I still do not now what is causing the problem. I am on DigitalOcean VPS. If I run Meteor over SSH, it fails. If I run Meteor on web Console Access, it works. I do not get it.

Answer https://stackoverflow.com/a/15752736 helped me to find out that Mongo doesn't want to start without properly set locale.
Try to run export LC_ALL="en_US.UTF-8" command before meteor command.

WARNING: This deletes the database and all of the application's data.
rm -rf .meteor/local
Solved it for me when none of the above solutions did.

I would guess that the custom user you created cannot remove the mongod.lock file due to insufficient premissions.

Also check that you have space on your HD, That was my problem.

Related

Bootstrap failed: 5: Input/output error while running any service on macOS Big Sur version 11.5.2

I am trying to run mongodb-community#4.2 service using brew services start mongodb-community#4.2 (facing similar error, while running httpd service or any other service)
Following is the error:
Error: Failure while executing; /bin/launchctl bootstrap gui/502 /Users/chiragsingla/Library/LaunchAgents/homebrew.mxcl.mongodb-community#4.2.plist exited with 5.
There can be multiple reasons behind this error message. So, the first thing to do is to find where your mongo related logs are stored. To do that, run the following command -
sudo find / -name mongod.conf
This will get you the mongo db config file. On running this command, I got /usr/local/etc/mongod.conf. You may find it directly under /etc.
On opening mongod.conf, you will find log path mentioned there. You can open the file itself, or instead get the last 15-20 lines of this log file via tail command -
tail -n 15 <<your mongo db log path>>
Now, you will need to debug the issue mentioned in the logs. Generally, I have seen these three sets of issues -
Permission issue with /tmp/mongodb-27017.sock - While some SO answers asked to change the permissions for this file as a solution, my issue with this only went away after I removed this file.
Compatibility issue - If you see a message like Version incompatibility detected, it means that the mongodb version you have currently installed is different from the version whose data is present on your system. Uninstall the current mongodb version and then install the correct older version (if you don't want to lose the data).
Once you have done it, and your mongo is up and running, and you want to upgrade mongodb version, follow this SO answer.
Permission issues with WiredTiger - Using chmod to change file permissions resolved these.
In case you have any issue other than these three, you will still need to search more on SO and figure it out. Hope this was of some help! :)

Can't use Mongo show commands, getting 'show: command not found' errors

I have Mongo running but can't use the mongo commands. When I type show collections I get the error show: command not found.
How can I fix this?
I installed with homebrew so my mongo installation is at: /usr/local/Cellar/mongodb/3.0.6 and my databases are at /data /db.
I searched around but couldn't find an answer.
The following didn't help:
https://stackoverflow.com/questions/10203589/cant-use-mongo-command-shows-command-not-found-on-mac
Oh, lol. I have to open the Mongo shell (by typing mongo into the terminal) and not just start the database using mongod as I had already done. Well ok then... my problem is solved.

Meteor: unexpected mongo exit code null. Restarting. What is this?

The title pretty much says it - when I try to start a newly created meteor app, this appears when starting the proxy and I get the message that the mongo server can't be started.
I created some swap space already (that was mentioned in the only other thread realted to that problem) and even reinstalled it - no further success.
Weird thing is, on my normal laptop this works. The laptop I'm having trouble with is a Pentium III with 1GB RAM, maybe this matters.
Any thoughts? Is the machine too old?
EDIT:
My setup:
Thinkpad T23, PIII 1.13 GHz, 1GB RAM.
Debian Stretch/testing, Linux Kernel 4.1.0-1-686-pae
My log:
[[[[[ ~/Server/sample ]]]]]
=> Started proxy.
Unexpected mongo exit code null. Restarting.
Unexpected mongo exit code null. Restarting.
Unexpected mongo exit code null. Restarting.
Can't start Mongo Server.
This command will reset your database
meteor reset
Have you tried setting your LANG environment variable? As shown in Mongo can't be started when starting Meteor, which explains the following:
<snip>
If you get an error like
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Unexpected mongo exit code null. Restarting.
...
Can't start Mongo server.
the solution is very easy but not easy to know:
You have not set your LANG settings in current shell.
Set your LANG env vars before starting meteor manually or permanent in your profile settings.
export LANG=C
export LC_ALL=C
Now you can run meteor and it should be able to start the mongo development process.
</snip>
It might be worth trying. HTH.
I think your suspicion about the machine being too old is correct.
You can reproduce the same error by trying to build a meteor app on a digitalocean droplet with 512mb of ram. On an otherwise identical machine with 8gb of ram, the app builds without error.
Just remove the #w=majority param in your connection string

Creating a new meteor.js file and get error 100, MongoDB not able to write

I'm playing with meteor.js and I get this error:
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
MongoDB had an unspecified uncaught exception.
Check to make sure that MongoDB is able to write to its database directory.
I'm not sure how to remedy this, especially within the context of Meteor.js
I installed using curl on snow leopard mac os.
It was actually working for a while as I did a few exercises from a book I have, then it conked out with the error. Not sure what I did.
I fixed this by going to .meteor\local\db and deleting mongod.lock
I had this problem when I updated from 0.7 to 0.8 in my local environment, I had nothing to loose in my local database, so I fixed by:
rm -rf .meteor/local/db
As with our discussion, you just need to free up some disk space, I wish meteor would give more descriptive errors.
If you free up some space it should sort itself out
It could be that you have an instance of mongod running already, do a
ps -el | grep mongo
and if it's running kill it and restart
As #Akshat said:
If you even as root cannot run meteor, it's probably a full partion & you have to clean up or just move the folder to an other partition.
If you can run meteor as root, it's probably a rights issue solvable this way:
In the meteor project folder: sudo chown -R $USER:$USER .
I recommend not to use a NTFS partition as setting the correct rights there is difficult.

When using a separate MongoDB with meteor, meteor reset stopped working

I have my MONGO_URL set to mongodb://localhost:27017/meteor and have the MongoDB run as a service.
When running my project it seems OK to store data to the separate MongoDB until I tried to run meteor reset.
My assumption is it tried to remove its default database. The error complained that myproject.meteor\local is not empty and pointed to fs.js:456 which goes to files.js:256 (rm_recursive) and so on.
any idea what and how I can fix this?
$ meteor reset only resets the bundled MongoDB. It won't reset an external Mongo database.
(That's something we should explain better in the documentation.)
In your case, try connecting to the Mongo database directly (with the mongo command line shell) and running > db.dropDatabase()