Failed to start mongod.service: Unit mongod.service not found

Rahul picture Rahul · Jan 4, 2018 · Viewed 154.2k times · Source

I follow all the steps mention in MongoDB installation documents for Ubuntu 16.04.

Steps 1:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

Steps 2:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

Steps 3:

sudo apt-get update

Steps 4:

sudo apt-get install -y mongodb-org

Steps 5:

sudo service mongod start

when I started MongoDB got an error as:

Failed to start mongod.service: Unit mongod.service not found.

Answer

Jehanzeb.Malik picture Jehanzeb.Malik · Feb 19, 2018

Most probably unit mongodb.service is masked. Use following command to unmask it.

sudo systemctl unmask mongod

and re-run

sudo service mongod start