25

I'm trying to install kaa(IOT platform) on installing the dependencies getting an error on executing the command-

$ sudo systemctl start mongodb
error- Failed to start mongodb.service: Unit mongodb.service is masked.
Rinzwind
  • 293,910
  • 41
  • 570
  • 710
tarun kumar
  • 353
  • 1
  • 3
  • 6

2 Answers2

44

Unit mongodb.service is masked.

So unmask it:

sudo systemctl unmask mongodb

Why are some systemd services in the "masked" state? explains masking.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
  • 4
    I also received this error after installing mongodb-org. Why was it masked by default? What does that mean to be masked? – Cerin Feb 06 '18 at 18:24
  • sorry. no it does not, is UNMASKS the service file. where do you see an "rm" in this command? Please read up on what masks/unmasks means And the topic starter agrees with me ;-) – Rinzwind Jun 26 '19 at 12:12
  • Just another stupid systemd "feature". Systemd is full of charming "surprises". Like [PrivateTmp](https://unix.stackexchange.com/questions/448056/systemd-private-tmp-on-debian-cant-disable-it-on-the-right-way), which silently writes things you intend to go into `/tmp` into some "magic" directory in Never-Never Land... – FoggyDay Oct 17 '19 at 18:24
9

With 3+ version of mongodb. You dont have to start mongodb but you just have to start mongod. So proper way to start mongod will be

sudo systemctl start mongod

Hammad
  • 191
  • 1
  • 4
  • 5
    `Failed to start mongod.service: Unit mongod.service not found`. Change `mongod `to `mongodb` and hte result is `Failed to start mongodb.service: Unit mongodb.service is masked.` – Craig Hicks Jun 10 '18 at 17:06
  • Yup. By default, you still have to "unmask" it: `sudo systemctl unmask mongodb`. Silly, silly, silly. But at least it's documented. Sort of... – FoggyDay Oct 17 '19 at 18:28