It worked for me on ubuntu 20.04: In my case, mongod.service file was locked so it was giving me the same error. To resolve the issue:- Step 1: Use following command to check if the mongod.service is present there
cd /usr/bin/systemd/system
ls
Step 2: If the file is present there then Run the following command to unlock the file mongod.service
sudo chmod 777 /usr/bin/systemd/system/mongod.service -R
Step 3: Now run the following commands:
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo systemctl enable mongod