I recently upgraded to Ubuntu 16.04 after which MongoDB 3.0.2 is not starting.
$ sudo service mongod start
which would throw error:
Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.
I saw these error logs by executing
systemctl status mongod.service
● mongod.service Loaded: loaded (/etc/init.d/mongod; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2016-04-29 10:48:02 IST; 10s ago Docs: man:systemd-sysv-generator(8) Process: 8624 ExecStart=/etc/init.d/mongod start (code=exited, status=1/FAILURE) mongod: Rather than invoking init scripts through /etc/init.d, use the service(8) mongod: utility, e.g. service mongod start mongod: initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection mongod: Since the script you are attempting to invoke has been converted to an mongod: Upstart job, you may also use the start(8) utility, e.g. start mongod mongod: start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection r systemd: mongod.service: Control process exited, code=exited status=1 systemd: Failed to start mongod.service. systemd: mongod.service: Unit entered failed state. systemd: mongod.service: Failed with result 'exit-code'.
I tried the below mentioned solutions, but none worked:
- Created a file /lib/systemd/system/mongodb.service with the following content:
[Unit] Description=High-performance, schema-free document-oriented database After=network.target
[Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
- Tried installing upstartv
sudo apt-get install upstart-sysv