/etc/init.d/mongod: 1: nit.d: not found on Ubuntu22.0.4 - mongodb

After installing MongoDB on Ubuntu, I tried to run it, but the execution failed with the following statement.
sudo service mongod start  ✔  12:27:30 
[sudo] password for dlwjdgus:
/etc/init.d/mongod: 1: nit.d: not found
* Starting database mongod
What can I do to solve the error?

Related

Failed to start PostgreSQL Cluster 10-main when booting

when I try to boot Ubuntu, it never finishes the boot process because it appears the message "Failed to start PostgreSQL Cluster 10-main." I also get the same message with 9.5-main. But lets focus on 10.
When I execute:
systemctl status postgresql#10-main.service
I get the following message:
postgresql#10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql#.service; indirect; vendor preset: enabled)
Active: failed (Result: protocol) since Wed 2020-02-19 17:57:22 CET; 30 min ago
Process: 1602 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code_exited, status=1/FAILURE)
PC_info systemd[1]: Starting PostgreSQL Cluster 10-main...
PC_info postgresql#10-main[1602]: Error: /usr/lib/postgresql/10/bin/pg_ctl /usr/lib/postgresql/10/bin/pg_ctl start -D /var/lib/postgresql/10/main -l /var/log/postgresql/postgresql-19-main.log -s -o -c config_file="/etc/postgresql/10/main/postgresql.conf" exit with status 1:
PC_info systemd[1]: postgresql#10-main.service: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
PC_info systemd[1]: postgresql#10-main.service: Failed with result 'protocol'.
PC_info systemd[1]: Failed to start PostgreSQL Cluster 10-main.
PC_info is information about my computer (user, date..) not relevant
I got this error from one day to an other without touching anything related to Database Servers.
I tried to fix it by my self but nothing worked
Writing the command
service postgresql#10-main start
I get
Job for postgresql#10-main.service failed because the service did not take the steps required by its unit configuration
See "systemctl status postgresql#10-main.service" and "journalctl -xe" for details.
Running this two command I get the message from the beginning.
Anyone has an idea of what is happening? How I can fix it?
I had same issue, I followed below steps,
Error status :
pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/postgresql/10/main
/var/log/postgresql/postgresql-10-main.log
Applied Solution :
sudo chmod 700 -R /var/lib/postgresql/10/main
sudo -i -u postgres
postgres#abc:~$ /usr/lib/postgresql/10/bin/pg_ctl restart -D /var/lib/postgresql/10/main
After Solution status :
pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 online postgres /var/lib/postgresql/10/main
/var/log/postgresql/postgresql-10-main.log
as mentioned by #gruentee in comment above,
/usr/lib/postgresql/10/bin/pg_ctl restart -D /var/lib/postgresql/10/main -l /var/log/postgresql/postgresql-10-main.log -s -o '-c config_file="/etc/postgresql/10/main/postgresql.conf"'
started the postgresSql DB. Dont forget to
sudo -i -u postgres
before issuing above command
I was facing the same challenge, I try a lot of methods but none work for me till I try these commands below
sudo apt-get -y install postgresql
sudo systemctl start postgresql#15-main.service
pg_lsclusters
then everything started working fine, but please the version of postgresql i'm using is 15 that's you are seeing 15 in the second command so in your case you substitute it with the version you are using

Not able to run mongodb version 4.0 on my local machine

Getting this error when I try to run command mongo:
MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
2018-07-24T13:08:13.968+0800 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
After run this command sudo service mongod status Its giving me output something like this :
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Sel 2018-07-24 13:18:18 +08; 45s ago
Docs: https://docs.mongodb.org/manual
Process: 18153 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dumped, signal=ABRT)
Main PID: 18153 (code=dumped, signal=ABRT)
root#him: systemd[1]: Started MongoDB Database Server.
root#him: mongod[18153]: 2018-07-24T13:18:18.777+0800 I CONTROL [main] Automatically disabling TLS 1.0, to f
root#him: mongod.service: Main process exited, code=dumped, status=6/ABRT
root#him: mongod.service: Unit entered failed state.
root#him: mongod.service: Failed with result 'core-dump'.
The data files are created under root not the mongodb user when you run from the terminal.
You need to give permissions:
cd /var/lib/mongodb
sudo chown -R mongodb:mongodb *
Hope this helps.
I had the same error, maybe because of ubuntu upgrade from 18.04 to 20.04. Could not start mongod manually, the reason was absence of /data/db and its permissions. Then mongod would start manually but still errorring on mongodb.service. At the end reinstalling mongodb worked. It was a new install so did not care about backups.
$ sudo apt remove mongodb mongo-tools mongodb-clients mongodb-server mongodb-server-core
$ sudo apt autoremove
$ sudo rm -rf /var/lib/mongodb/
$ sudo apt install mongodb

Installing Mongo DB and get this error when start

I have followed this steps and install MongoDB in my Linux mint and finally run this command
mongo --host 127.0.0.1:27017
But got this error after run this command.
MongoDB shell version: 3.2.18
connecting to: 127.0.0.1:27017/test
2017-12-21T13:16:20.693+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-12-21T13:16:20.693+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:231:14
#(connect):1:6
exception: connect failed
I have already run this command also
sudo service mongod start
But after this command,
mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset:
Active: failed (Result: exit-code) since Thu 2017-12-21 13:35:28 IST; 6s ago
Docs: https://docs.mongodb.org/manual
Process: 4891 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (cod
Main PID: 4891 (code=exited, status=100)
I found many solution but did not get it resolved. Thanks in advance.
Make sure mongod service is running locally
sudo service mongod status
and if it's not, run sudo service mongod start
If that doesn't help, try this:
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --repair
and run service mongod start again
EDIT
Try changing permissions in the mongodb folder
cd /var/lib/mongodb
sudo chown -R mongodb:mongodb *
Also, If that doesn't help, run this
sudo /usr/bin/mongod --config /etc/mongodb.conf
and tell me the output (If it works is doesn't solve your problem, the service startup still needs to be fixed, just curious)

Error running PostgreSQL on Docker-io

When attempting to initialise the PostgreSQL database after installing on a Docker-io Fedora 19 container I get the following error:
bash-4.2# postgresql-setup initdb
Failed to get D-Bus connection: No connection to service manager.
failed to find PGDATA setting in postgresql.service
Looks like an environmental issue but any help would be appreciated.

MongoDB server won't start

I just installed Arch Linux today. I'm setting up my development stack, and I'm stuck with mongodb.
I have followed this wiki when installing:
https://wiki.archlinux.org/index.php/MongoDB#Installing_MongoDB
When I try to get into mongo console, I get this:
jan#arch:~$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Tue Jul 9 19:38:13.365 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
jan#arch:~$
What am I missing here?
EDIT: I figured out when I run mongod directly from terminal, it starts server fine. However the systemctl start mongodb doesn't start it.
Okay, I've figured it out by scanning journalctl output:
ul 09 19:49:33 arch mongod[1122]: all output going to: /var/log/mongodb/mongod.log Jul 09 19:49:33 arch mongod[1122]: can't open [/var/log/mongodb/mongod.log] for log file: errno:13 Permission denied Jul 09 19:49:33 arch mongod[1122]: Bad logpath value: "/var/log/mongodb/mongod.log"; terminating.
So I searched for user that might be utilized by mongodb:
jan#arch:~$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
...
mongodb:x:998:2::/var/lib/mongodb:/bin/bash
And chowned required folders:
jan#arch:~$ sudo chown -R mongodb:x /var/log/mongodb/
jan#arch:~$ sudo chown -R mongodb:x /var/lib/mongodb/
Started it again:
jan#arch:~$ sudo systemctl start mongodb
It works now.
jan#arch:~$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>