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

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.

Related

Cant start mongo DB in ubuntu 20.04

mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-10-24 13:22:56 IST; 11s ago
Docs: https://docs.mongodb.org/manual
Process: 3811 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 3811 (code=exited, status=1/FAILURE)
CPU: 58ms
Oct 24 13:22:56 Nithyanandha systemd[1]: Started MongoDB Database Server.
Oct 24 13:22:56 Nithyanandha mongod[3811]: {"t":{"$date":"2022-10-24T07:52:56.619Z"},"s":"F", "c":"CONTROL", "id":205>
Oct 24 13:22:56 Nithyanandha systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 13:22:56 Nithyanandha systemd[1]: mongod.service: Failed with result 'exit-code'.
i am new to Mongodb i tried to install mongodb in ubuntu
at first it runs after some days it doest work
Mongodb Does't start it gives more error

mongodb not starting after upgrade to 5.0.4

I have upgraded my mongodb to 5.0 , but after upgrade mongodb startup got failed . below is the error ,
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Wed 2021-12-01 13:54:17 EST; 23s ago
Docs: https://docs.mongodb.org/manual
Process: 245014 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dumped, signal=ILL)
Main PID: 245014 (code=dumped, signal=ILL)
Dec 01 13:54:16 JAXDBA1 systemd[1]: Started MongoDB Database Server.
Dec 01 13:54:17 JAXDBA1 systemd[1]: mongod.service: Main process exited, code=dumped, status=4/ILL
Dec 01 13:54:17 JAXDBA1 systemd[1]: mongod.service: Failed with result 'core-dump'.

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.

service mongod status "Active: failed ..."

When i tape this command to show the status of mongodb
sudo service mongod status
i have this error output
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-07-06 12:57:03 CEST; 3min 52s ago
Docs: https://docs.mongodb.org/manual
Process: 6233 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=100)
Main PID: 6233 (code=exited, status=100)
Jul 06 12:57:03 ns3067256.ip-94-23-35.eu systemd[1]: Started High-performance, schema-free document-oriented database.
Jul 06 12:57:03 ns3067256.ip-94-23-35.eu mongod[6233]: 2017-07-06T12:57:03.090+0200 I CONTROL [main] WARNING: Cannot detect if NUMA interleaving is enabled. Failed to pr
Jul 06 12:57:03 ns3067256.ip-94-23-35.eu systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
Jul 06 12:57:03 ns3067256.ip-94-23-35.eu systemd[1]: mongod.service: Unit entered failed state.
Jul 06 12:57:03 ns3067256.ip-94-23-35.eu systemd[1]: mongod.service: Failed with result 'exit-code'.
so what is the solution !?
Go to /etc/mongod.conf and look for dbPath: /xyz/xyz
Use the following command to provide the rights to mongodb
sudo chown -R mongodb:mongodb /xyz/xyz

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 :)