How To Fix Failed To Unlink Socket File Error When Start Mongo on RHEL 7/CENTOS 7

Linuxfault

When I start mongo DB on Redhat console by running the command mongod, I got below error message.

 {"t":{"$date":"2022-08-25T12:45:23.666+07: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"}}

To fix this error is very easy, you just need to go to /tmp folder, and remove the mongodb-27017.sock file, then you can restart the mongo DB in terminal again. When you remove the mongodb-27017.sock file, you need to take care about the file owner and permission. If only root user can remove this file, then you need to change to the root user to remove it.

# rm /tmp/mongodb-27017.sock
Restart mongod service.

# systemctl restart mongod
That's it. 

Post a Comment

© LinuxFault. All rights reserved. Developed by Jago Desain