Learn how to resolve “Failed to start mongod.service: Unit mongod.service not found” on Ubuntu with complete commands, clean reinstall, and practical troubleshooting. Our Live Support Team is always here to help you.

How To Fix Failed to start mongod.service: Unit mongod.service not found” on Ubuntu

MongoDB is one of those tools that developers rely on daily, fast, flexible, and built for scale. But sometimes, Ubuntu users hit a frustrating wall with this message: “Failed to start mongod.service: Unit mongod.service not found.”
It’s a common problem, and it usually means your MongoDB installation didn’t register correctly with systemd, or something’s missing. Let’s go through how to fix this cleanly so you can get MongoDB up and running again.

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

Understanding the Error

When you see “Failed to start mongod.service: Unit mongod.service not found”, it simply means the service file MongoDB needs is missing, corrupted, or never got installed properly. Because of that, the service can’t start, which makes MongoDB unusable.

Here’s what generally causes it:

  • Incomplete Installation: MongoDB didn’t install fully or correctly.
  • Missing Service File: The mongod.service file is missing or damaged.
  • Outdated Package Database: The local package index might not be synced with MongoDB’s repository.

How to Get MongoDB Running Again

Let’s walk through the process of completely reinstalling and restoring your MongoDB service. Follow the commands exactly as shown.

1. Remove Existing MongoDB Installation

Make sure you remove any old or partial installations to prevent conflicts.

sudo apt-get purge mongodb-org*
sudo apt-get autoremove
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
2. Import the MongoDB Public Key

Ensure you have the required tools, then add MongoDB’s official GPG key:

sudo apt-get install gnupg curl
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
3. Create a MongoDB Source List

Depending on your Ubuntu version, create the right repository list. For Ubuntu 22.04 (Jammy):

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
4. Reload the Package Database
sudo apt-get update
5. Install MongoDB Packages
sudo apt-get install -y mongodb-org
6. Start the MongoDB Service

Now try to start it:

sudo systemctl start mongod

If you still see “Failed to start mongod.service: Unit mongod.service not found”, run:

sudo systemctl daemon-reload
sudo systemctl start mongod
7. Check MongoDB Service Status

Make sure the service is active:

sudo systemctl status mongod
8. Enable MongoDB on Boot

Keep it running automatically at startup:

sudo systemctl enable mongod
9. Additional Useful Commands

Stop MongoDB:

sudo systemctl stop mongod

Restart MongoDB:

sudo systemctl restart mongod

Monitor logs for any issues:

tail -f /var/log/mongodb/mongod.log
10. Start Using MongoDB

Finally, open the shell to begin working with MongoDB:

Get MongoDB Running Again Now!

Chat animation


Still Seeing the Same Error?

Sometimes the “Failed to start mongod.service: Unit mongod.service not found” message pops up even after reinstalling. Here are two more quick checks:

If your system can’t find mongod.service when you run:

sudo service mongod status

Try this:

sudo systemctl enable mongod

Then copy your correct config file to /etc/mongod.conf and restart:

sudo service mongod restart

Or, if the unit is masked, unmask it:

sudo systemctl unmask mongod
sudo service mongod start

Clean Reinstall (Alternative Method)

If it still doesn’t work, go for a complete uninstall and reinstall using the official steps:

sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

Then import the key:

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

Add the repository for Ubuntu 16.04:

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

Update and install:

sudo apt-get update
sudo apt-get install -y mongodb-org

Start MongoDB again:

sudo service mongod start
mongo

Conclusion

That’s it, by following these commands, you can easily bring MongoDB back online after the error. The key is ensuring a clean setup and letting Ubuntu recognize MongoDB properly. Once it’s running, you’re all set to continue building without interruptions.