Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.08 KB

fix-mongodb-common-errors-ubuntu.md

File metadata and controls

44 lines (29 loc) · 1.08 KB

Fix MongoDB Common Errors on Ubuntu

Failed to Unlink Socket mongodb-27017.sock.

Error message : Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted.

  • Remove mongodb-27017.sock and reload mongod.

    $ sudo rm -rf /tmp/mongodb-27017.sock
    $ ls -lsah /tmp/mongodb-27017.sock  
    $ sudo systemctl restart mongod

    and/or if that doesn't work you can do as below.

  • Add owner to mongodb-27017.sock.

    $ sudo chown -R $USER /tmp/mongodb-27017.sock
    $ sudo systemctl restart mongod

    and/or if that doesn't work you can do as below.

  • Run mongod with sudo.

    $ sudo mongod

Attempted to create a lock file on a read-only directory: /data/db.

Error message : exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating.

  • Create folder /data/db and add owner.

    $ sudo mkdir /data/db
    $ sudo chown -R $USER /data/db 
    $ sudo systemctl restart mongod