13 / 13
Sep 2023

i am on centos 7 when i trying to run sudo service mongod start i got an error like this

Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.

The first thing to do when you get an error message that says

is to see “systemctl status mongod.service” and “journalctl -xe” for details.

Even us, we cannot help you without the details.

Any news on the details? If you were able to fix your issue by following the advice, please mark my post as the solution so that others follow your steps.

@Brijesh_Kalkani, please follow up on your post. Did you follow the tip I provided in my post? Did it help you find a solution? If so please mark it as the solution. This will help this forum to be efficient.

8 days later

Hi,
you can see what are the errors, by typing in the shell:
systemctl status mongod.service
journactl -xe
tail -f /path/to/log_file/mongod.log

Regards

27 days later

I had the same error as OP and this is the output of journactl -xe:

Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU5: Core temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU1: Core temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU1: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU5: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU0: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU6: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU4: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU2: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU7: Package temperature/speed normal Jan 18 15:31:33 rylan-ThinkPad-E590 kernel: CPU3: Package temperature/speed normal Jan 18 15:31:38 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:38:424] info: [RTM] (T2BRHD5EC) Processed 1 user_typing event(s) in channel(s) D02F5BU9B18 over 6.70ms Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:43:710] info: [MSG-SHARED-RTM] (TC98Y5AQ3) dispatch to single store 1 msgs Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:43:719] warn: (TC98Y5AQ3) Notification (message) suppressed because: Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: Channel is muted Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:43:720] info: [RTM] (TC98Y5AQ3) Processed 1 message:bot_message event(s) in channel(s) D02D5RQ95LL over 21.60ms Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:43:780] info: [COUNTS] (TC98Y5AQ3) Updated unread_cnt for D02D5RQ95LL: 894 Jan 18 15:31:43 rylan-ThinkPad-E590 slack.desktop[14549]: [01/18/22, 15:31:43:943] info: [RTM] (T2BRHD5EC) Processed 1 user_typing event(s) in channel(s) D02F5BU9B18 over 7.30ms Jan 18 15:31:46 rylan-ThinkPad-E590 sudo[13424]: rylan : TTY=pts/1 ; PWD=/home/rylan/Documents/physics-benchmarking-neurips2021/experiments/dominoes_redyellow_pilot ; USER=root ; COMMAND=/bin/systemctl start Jan 18 15:31:46 rylan-ThinkPad-E590 sudo[13424]: pam_unix(sudo:session): session opened for user root by (uid=0) Jan 18 15:31:46 rylan-ThinkPad-E590 systemd[1]: Starting LSB: An object/document-oriented database... -- Subject: Unit mongodb.service has begun start-up -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- Unit mongodb.service has begun starting up. Jan 18 15:31:46 rylan-ThinkPad-E590 mongodb[13427]: * Starting database mongodb Jan 18 15:31:47 rylan-ThinkPad-E590 mongodb[13427]: ...fail! Jan 18 15:31:47 rylan-ThinkPad-E590 systemd[1]: mongodb.service: Control process exited, code=exited status=1 Jan 18 15:31:47 rylan-ThinkPad-E590 systemd[1]: mongodb.service: Failed with result 'exit-code'. Jan 18 15:31:47 rylan-ThinkPad-E590 systemd[1]: Failed to start LSB: An object/document-oriented database. -- Subject: Unit mongodb.service has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- Unit mongodb.service has failed.

This is my output from looking at the first few lines of /var/log/mongodb/mongodb.log:

2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] MongoDB starting : pid=6332 port=27017 dbpath=/var/lib/mongodb 64-bit host=rylan-ThinkPad-E590 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] db version v3.6.3 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] allocator: tcmalloc 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] modules: none 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] build environment: 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] distarch: x86_64 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] target_arch: x86_64 2022-01-18T15:21:05.419-0800 I CONTROL [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "127.0.0.1", unixDomainSocket: { pathPrefix: "/run/mongodb" } }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongodb.log" } } 2022-01-18T15:21:05.420-0800 I STORAGE [initandlisten] 2022-01-18T15:21:05.420-0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2022-01-18T15:21:05.420-0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2022-01-18T15:21:05.420-0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7429M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress), 2022-01-18T15:21:06.112-0800 I CONTROL [initandlisten] 2022-01-18T15:21:06.112-0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2022-01-18T15:21:06.112-0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2022-01-18T15:21:06.112-0800 I CONTROL [initandlisten] 2022-01-18T15:21:06.113-0800 I STORAGE [initandlisten] createCollection: admin.system.version with provided UUID: 59618846-6a71-4606-b435-ec583269d327 2022-01-18T15:21:06.120-0800 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.6 2022-01-18T15:21:06.124-0800 I STORAGE [initandlisten] createCollection: local.startup_log with generated UUID: c5e16804-4ad9-4bf1-93e7-0282622efc94 2022-01-18T15:21:06.130-0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data' 2022-01-18T15:21:06.130-0800 I NETWORK [initandlisten] waiting for connections on port 27017 2022-01-18T15:22:27.230-0800 I CONTROL [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends 2022-01-18T15:22:27.231-0800 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets... 2022-01-18T15:22:27.231-0800 I NETWORK [signalProcessingThread] removing socket file: /run/mongodb/mongodb-27017.sock 2022-01-18T15:22:27.231-0800 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture 2022-01-18T15:22:27.232-0800 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down 2022-01-18T15:22:27.340-0800 I STORAGE [signalProcessingThread] shutdown: removing fs lock... 2022-01-18T15:22:27.340-0800 I CONTROL [signalProcessingThread] now exiting 2022-01-18T15:22:27.340-0800 I CONTROL [signalProcessingThread] shutting down with code:0
6 months later

I could see that the logs folder from /var/log was deleted and this caused the db to shut down.
The below steps resolved the issue -
- switch to root user “sudo su”
- cd /var/log/
- mkdir mongodb
- chown -R mongod:mongod mongodb
- systemctl start mongod.service

1 year later

For me its was the permission conflict on the sock file /tmp/mongodb-27017.sock

/tmp/mongodb-27017.sock was owned by root:root while mongod was not which cause permission denied error.
a quick fix was to
rm -rf /tmp/mongodb-27017.sock
and the rum
systemctl restart mongod