Recommand · June 4, 2021 0

MONGODB-ORG not running on UBUNTU 20.04

I used to have mongodb (the unofficial package) installed on Ubuntu 20.04.
I decided to change to the official one.(version 4.4)
First, both packages got confilcted, but after wiping the old one, the install succeeded.

But, when I try to run the mongod service,it fails, and shows this:

myubuntu:~$ sudo systemctl start mongod
myubuntu:~$ (no prompts, all is ok so far)
myubuntu:~$ 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 2021-06-04 01:11:27 EDT; 14s ago
    Process: 21446 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
   Main PID: 21446 (code=exited, status=14)

jun 04 01:11:27 robb systemd[1]: Started MongoDB Database Server.
jun 04 01:11:27 robb systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
jun 04 01:11:27 robb systemd[1]: mongod.service: Failed with result 'exit-code'.

and :

myubuntu:~$ mongod
{"t":{"$date":"2021-06-04T01:18:08.279-04:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-06-04T01:18:08.283-04:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-06-04T01:18:08.283-04:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":21483,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"robb"}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.6","gitVersion":"72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

I’d also like to mention that I’ve followed the steps carefully, and repeatedly have wiped and reinstalled packages, and updated with (sudo apt-get update) as recommended in solutions (see mongodb official solutions)

I’ve found a related question where the same author found the solution, please click here to see:

As a side note, if you have the same error, and provided solutions does not work, please, follow the link and try this answer,but paying special attention to remove both lib and log files created by mongodb,

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

it’s extremely important to get these files erased.

also, try to use sudo service command instead sudo systemctl command for starting mongod

the troubleshooting from mongodb does not cover these steps, and they made the real difference for me.