1

I am trying to start mongod. I run

sudo service mongod start

but I get:

Failed to unlink socket file /tmp/mongodb-27017.sock Unknown error Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 685

Theres a question here but I have tried all solutions to no avail

Os: Ubuntu 16.04 When I run

ls -lsah /tmp/mongodb-27017.sock

I see:

0 srwx------ 1 mongodb mongodb 0 Jun 14 11:45 /tmp/mongodb-27017.sock

Then I run

rm /tmp/mongodb-27017.sock 
sudo service mongod start

When I run

ls -lsah /tmp/mongodb-27017.sock

again, I see:

0 srwx------ 1 mongodb mongodb 0 Jun 14 11:45 /tmp/mongodb-27017.sock

When I run mongod, it gives me the same error.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Awesome Infinity
  • 121
  • 1
  • 2
  • 6

1 Answers1

6

I had the same problem and noticed this old answer: https://stackoverflow.com/a/34290982/2683681.

You can use their command:

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

But if you're using root then you'd better be doing:

sudo chown mongodb:mongodb /tmp/mongodb-27017.sock

My problem stemmed from the fact that root owned the socket.

Jonas Pauthier
  • 469
  • 3
  • 12