It’s generated with the incorrect permissions.

I’m not too sure how systemctl works but the sock file is only created when utilizing systemctl, so I’m not sure if mongodb is supposed to generate it or if it’s only there because it’s a requirement of systemctl kind of thing.

I did try the following to see if it made a difference since it seems to have made a difference for others but that didn’t work.

sudo chown `whoami` /tmp/mongodb-27017.sock

I even tried adding sudo in the service file but didn’t work too well as it’d require a password to function and even if I fed it the password within the file it didn’t recognize it.

Here’s the last bit of commands that I’ve trie

   56  sudo systemctl daemon-reload
   57  sudo systemctl restart mongod
   58  sudo systemctl status mongod
   59  sudo rm -rf /tmp/mongodb-27017.sock
   60  sudo systemctl daemon-reload
   61  sudo systemctl restart mongod
   62  sudo systemctl status mongod
   63  sudo rm -rf /tmp/mongodb-27017.sock
   64  sudo systemctl daemon-reload
   65  sudo systemctl start mongod
   66  sudo systemctl status mongod
   67  sudo rm -rf /tmp/mongodb-27017.sock
   68  sudo systemctl daemon-reload
   69  sudo service mongod start && mongod
   70  sudo systemctl status mongod
   71  sudo systemctl restart mongod
   72  sudo systemctl status mongod

Current Status of systemctl mongod service

 ESCOD
× mongod.service - MongoDB Database Server
     Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Thu 2024-06-06 06:43:07 CDT; 1min 46s ago
   Duration: 65ms
       Docs: https://docs.mongodb.org/manual
    Process: 4191 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
   Main PID: 4191 (code=exited, status=14)
        CPU: 62ms

Jun 06 06:43:07 ubuntu systemd[1]: Started mongod.service - MongoDB Database Server.
Jun 06 06:43:07 ubuntu mongod[4191]: {"t":{"$date":"2024-06-06T11:43:07.088Z"},"s":"I",  "c":"CONTROL",  "id":7484500, "ctx":"main","msg":"Environment varia>
Jun 06 06:43:07 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Jun 06 06:43:07 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.