Awesome Infinity
Awesome Infinity

Reputation: 121

mongod : Failed to unlink socket file

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.

Upvotes: 1

Views: 4396

Answers (1)

Jonas Pauthier
Jonas Pauthier

Reputation: 511

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.

Upvotes: 6

Related Questions