-1

I am using debian 9
After enter this command sudo systemctl start mongod.service it shows:

 Failed to connect to bus: No such file or directory 

But This command is working:

sudo systemctl enable mongod 

How to solve this problem?

And After entering this command mongo --eval 'db.runCommand({ connectionStatus: 1 })' it shows:

MongoDB shell version v4.0.17
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2020-03-27T01:42:18.705+0530 E QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
New contributor
user3245587 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Debian 9 is neither Xubuntu. Lubuntu or or flavor of Ubuntu, thus off-topic on this site. Refer askubuntu.com/help/on-topic for site rules, and also alternate SE sites where you question will be on-topic. – guiverc Mar 26 at 22:50
0

Type not sudo systemctl start mongod.service but sudo systemctl start mongodb.service. Maybe in the second command it autocompletes command to mongodb.service.

You've inputed the service name incorrectly. But to check, what is its name, use

systemctl list-units --type=service | grep mongo

During installation on Ubuntu 19.10 apt says:

Created symlink /etc/systemd/system/multi-user.target.wants/mongodb.service → /lib/systemd/system/mongodb.service.

Your command also shows correct output:

$ mongo --eval 'db.runCommand({ connectionStatus: 1})'
MongoDB shell version v3.6.8
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("88af9e26-ed2f-4fe7-a898-b921acdc5652") }
MongoDB server version: 3.6.8
{
    "authInfo" : {
        "authenticatedUsers" : [ ],
        "authenticatedUserRoles" : [ ]
    },
    "ok" : 1
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.