MongoDB does´t start, exit code 203 - mongodb

I installed MongoDB on the Ruspberry pi desktop on a VM, then I started it with the following command:
sudo service mongod start
The result of this command is the following:
systemctl list-unit-files --state enabled
mongodb.service enabled
Then when I check the status using
sudo service mongod status
The other issue is that there´s no .sock file in my /tmp folder.
PS: I removed MongoDB and reinstalled it trying to fix the issue but I always get the same problem.
Can anyone help me please?
Thank you in advance.
I get the following error:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-08 12:33:17 CEST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 22168 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=203/EXEC)
Main PID: 22168 (code=exited, status=203/EXEC)
Jun 08 12:33:17 raspberry systemd[1]: Started MongoDB Database Server.
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed to execute command: Exec format error
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed at step EXEC spawning /usr/bin/mongod: Exec format error
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Main process exited, code=exited, status=203/EXEC
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Failed with result 'exit-code'.```

Related

Unable to start MongoDB server on Ubuntu 20.04

I'm installing the latest MongoDB on Ubuntu 20.04 (Focal Fossa), and it's giving the below error. How can I fix it?
sudo systemctl status mongod
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-08-28 23:40:03 IST; 1min 43s ago
Docs: https://docs.mongodb.org/manual
Main PID: 10901 (code=exited, status=217/USER)
systemd[1]: Started MongoDB Database Server.
systemd[10901]: mongod.service: Failed to determine user credentials: No such process
systemd[10901]: mongod.service: Failed at step USER spawning /usr/bin/mongod: No such process
systemd[1]: mongod.service: Main process exited, code=exited, status=217/USER
systemd[1]: mongod.service: Failed with result 'exit-code'.
systemd[1]: /lib/systemd/system/mongod.service:11: PIDFile= references a path below legacy directory >
Changing ownership of "/var/lib/mongodb" directory worked for me.
Command to change ownership:
sudo chown -R mongodb:mongodb /var/lib/mongodb

Will `sudo service mongodb start` deletes my previous data?

I am working on EC2 aws. My mongo suddenly stopped connecting.
sudo service mongodb status displays the following:-
● mongodb.service - High-performance, schema-free document-oriented >database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-03-29 18:31:08 UTC; 1h 18min ago
Main PID: 3773 (code=exited, status=100)
Mar 29 18:31:07 ip-172-31-41-39 systemd[1]: Started An object/document-oriented database.
Mar 29 18:31:08 ip-172-31-41-39 systemd[1]: mongodb.service: Main process exited, code=exited, status=100/n/a
Mar 29 18:31:08 ip-172-31-41-39 systemd[1]: mongodb.service: Failed with result 'exit-code'.
I read that doing sudo service mongodb start might solve your problem but I fear will it delete my data?
An exit code 100 for the mongodb service means that it could not access or find the data directory. If your data directory is protected by sudo then starting the service with sudo will solve your problem.

mongod.service: Failed at step USER spawning /usr/bin/mkdir: No such process

I'm running ec2 instance of os Ubuntu 16.04.
I recently tried to upgrade my mongodb from 3.2 to 3.6.
And I tried to run sudo service mongod start and mongod service failed to start.
Below is the error message.
mongod.service - High-performance, schema-free document-oriented
database
Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-03-05 05:48:12 UTC; 11s ago
Docs: https://docs.mongodb.org/manual
Process: 18587 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=217/USER)
Main PID: 16567 (code=exited, status=100)
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: Starting High-performance, schema-free document-oriented database...
Mar 05 05:48:12 ip-172-31-18-34 systemd[18587]: mongod.service: Failed at step USER spawning /usr/bin/mkdir: No such proc
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Control process exited, code=exited status=217
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: Failed to start High-performance, schema-free document-oriented database.
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Unit entered failed state.
Mar 05 05:48:12 ip-172-31-18-34 systemd[1]: mongod.service: Failed with result 'exit-code'.
And I never edited a single line of default mongod.service file.
How can I fix this issue?
If you have just copied mongod.service file from somewhere you should edit User in [Service] section
Changing ownership of "/var/lib/mongodb" directory worked for me
Command to change ownership:
"sudo chown -R mongodb:mongodb /var/lib/mongodb"
**Old response:**
$ sudo systemctl status mongodb
● mongodb.service - MongoDB Database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-07-31 18:52:49 IST; 17h ago
Docs: https://docs.mongodb.org/manual
Main PID: 13728 (code=exited, status=217/USER)
Jul 31 18:52:49 LAP-LIN-712 systemd[1]: Started MongoDB Database.
Jul 31 18:52:49 LAP-LIN-712 systemd[13728]: mongodb.service: Failed to determine user credentials: No such process
Jul 31 18:52:49 LAP-LIN-712 systemd[13728]: mongodb.service: Failed at step USER spawning /usr/bin/mongod: No such process
Jul 31 18:52:49 LAP-LIN-712 systemd[1]: mongodb.service: Main process exited, code=exited, status=217/USER
Jul 31 18:52:49 LAP-LIN-712 systemd[1]: mongodb.service: Failed with result 'exit-code'.
**New Response:**
$ sudo systemctl status mongodb
● mongodb.service - MongoDB Database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-08-01 11:54:10 IST; 8s ago
Docs: https://docs.mongodb.org/manual
Main PID: 8143 (mongod)
Tasks: 20 (limit: 4915)
CGroup: /system.slice/mongodb.service
└─8143 /usr/bin/mongod --quiet --config /etc/mongod.conf
/usr/bin/mongod - No such process. ---> This error means you have placed the mongod binary in someother path instead of the default one. Try changing the path in mongod.service file and reattempt it using service start mongodb
For me it was solved by commenting "User" and "Group" directives in the service file as described here.
I hope it helps somebody.

mongo shell working in UBUNTU but 'mongod start' doesn't work?

command mongo gives the interactive shell on command but when this command is executed as sudo systemctl enable mongod.service, it gives following output.
Failed to enable unit: Unit file mongod.service does not exist.
I am using ubuntu 17 machine.
also sudo systemctl start mongodb doesn't give any output.
on running sudo service mongodb status
it gives output as
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-02-15 23:08:02 IST; 1min 37s ago
Docs: man:mongod(1)
Process: 19137 ExecStart=/usr/bin/mongod --unixSocketPrefix=${SOCKETPATH} --config ${CONF} $DAEMON_OPTS (code=exited, status=100)
Main PID: 19137 (code=exited, status=100)
Feb 15 23:08:02 gd systemd[1]: Started An object/document-oriented database.
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Main process exited, code=exited, status=100/n/a
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Unit entered failed state.
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Failed with result 'exit-code'.
how can I solve this problem?
Your mongo service is called mongodb, pretty sure it should called mongod like you tried! Similar question here.
If your service is called mongodb you could so try:
sudo systemctl enable mongodb.service
When starting a service it wont give you any output and just returns back to the prompt. You can use systemctl status like you’ve done or you look st journalctl
If you’re using systemctl then you can check the service status by running:
sudo systemctl status mongodb.service

Mongo DB not working in Ubuntu0.16.04.2

I just installed mongodb by following the instructions at here.
When I try to start mongodb using command
sudo systemctl status mongodb
it goes to next command line and after that i run the command
sudo systemctl status mongodb
I got the following message
mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2016-08-13 16:37:29 IST; 2min 50s ago
Process: 10572 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 10572 (code=exited, status=14)
Aug 13 16:37:28 nagainfo-Lenovo-G50-70 systemd[1]: Started High-performance, schema-free document-oriented database.
Aug 13 16:37:29 nagainfo-Lenovo-G50-70 systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Aug 13 16:37:29 nagainfo-Lenovo-G50-70 systemd[1]: mongodb.service: Unit entered failed state.
Aug 13 16:37:29 nagainfo-Lenovo-G50-70 systemd[1]: mongodb.service: Failed with result 'exit-code'.
Please help me to resolve this. I have tried many things like giving permission to log and lib fies. But nothing work for me.
Thanks in advance :)