MONGODB-ORG not running on UBUNTU 20.04 - linux

I used to have mongodb (the unofficial package) installed on Ubuntu 20.04.
I decided to change to the official one.(version 4.4)
First, both packages got confilcted, but after wiping the old one, the install succeeded.
But, when I try to run the mongod service,it fails, and shows this:
myubuntu:~$ sudo systemctl start mongod
myubuntu:~$ (no prompts, all is ok so far)
myubuntu:~$ sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2021-06-04 01:11:27 EDT; 14s ago
Docs: https://docs.mongodb.org/manual
Process: 21446 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
Main PID: 21446 (code=exited, status=14)
jun 04 01:11:27 robb systemd[1]: Started MongoDB Database Server.
jun 04 01:11:27 robb systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
jun 04 01:11:27 robb systemd[1]: mongod.service: Failed with result 'exit-code'.
and :
myubuntu:~$ mongod
{"t":{"$date":"2021-06-04T01:18:08.279-04:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-06-04T01:18:08.283-04:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-06-04T01:18:08.283-04:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":21483,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"robb"}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.6","gitVersion":"72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7","openSSLVersion":"OpenSSL 1.1.1f 31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-06-04T01:18:08.284-04:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-06-04T01:18:08.285-04:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
I'd also like to mention that I've followed the steps carefully, and repeatedly have wiped and reinstalled packages, and updated with (sudo apt-get update) as recommended in solutions (see mongodb official solutions)

I've found a related question where the same author found the solution, please click here to see:
As a side note, if you have the same error, and provided solutions does not work, please, follow the link and try this answer,but paying special attention to remove both lib and log files created by mongodb,
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
it's extremely important to get these files erased.
also, try to use sudo service command instead sudo systemctl command for starting mongod
the troubleshooting from mongodb does not cover these steps, and they made the real difference for me.

Related

How to fix permission denied issue RedisJson?

When I try to load a redis module with loadmodule in redis.conf, redis-server crashes.
The log shows
Module /etc/modules/librejson.so failed to load: /etc/modules/librejson.so: unable to open shared objects file: Permission denied.
I have read the documentation to install RedisJson, but it does not work for me.
If I comment loadmodule line, the server works fine.
Installation process
sudo dnf update
sudo dnf upgrade
sudo dnf install redis
Configuration
cd /etc/redis
nvim /redis.conf
loadmodule loadmodule /etc/modules/librejson.so
supervised systemd
The rest of the file is kept by default
What I did
I created modules folder inside etc folder
I ran chown redis:root over modules folder
I moved the module to /etc/modules because I had read that homeprotection can block redis when trying to read the module in the /home path.
Then I used ls -l to check permissions and owners:
-rwxr-xr-x. 2 user user user 23668904 Feb 15 09:10 librejson.so
after that, I ran chown redis:root (as redis.conf owners): -rwxr-xr-xr-x. 2 redis root 23668904 Feb 15 09:10 librejson.so
and when I ran sudo systemctl restart redis.service:
Job for redis.service failed because the control process exited with error code.
See "systemctl status redis.service" and "journalctl -xeu redis.service" for details.
systemctl status redis.service:
redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: failed (Result: exit-code) since Thu 2023-02-16 13:21:58 CST; 6min ago
Process: 28947 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --daemonize no --supervised systemd (code=exited, status=1/FAILURE)
Main PID: 28947 (code=exited, status=1/FAILURE)
Status: "Redis is loading..."
CPU: 10ms
Feb 16 13:21:58 fedora systemd[1]: Starting redis.service - Redis persistent key-value database...
Feb 16 13:21:58 fedora systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Feb 16 13:21:58 fedora systemd[1]: redis.service: Failed with result 'exit-code'.
Feb 16 13:21:58 fedora systemd[1]: Failed to start redis.service - Redis persistent key-value database.
and nothing, I ran out of ideas.
System specs
Fedora 37
Redis server v=7.0.8

Mongod does not start (mongod.service: Failed with result 'signal')

After command sudo service mongod start && sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Wed 2021-08-18 11:58:29 MSK; 4s ago
Docs: https://docs.mongodb.org/manual
Process: 13899 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)
Main PID: 13899 (code=killed, signal=ILL)
авг 18 11:58:29 400sk systemd[1]: Started MongoDB Database Server.
авг 18 11:58:29 400sk systemd[1]: mongod.service: Main process exited, code=killed, status=4/ILL
авг 18 11:58:29 400sk systemd[1]: mongod.service: Failed with result 'signal'.
Does not write logs in /var/logs
Debian 10, try MongoDB 4.2 and 5.0, Intel(R) Xeon(R) E5540 # 2.53GHz
Installation from official site (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/)
Signal "ILL" is illegal instruction.
MongoDB 5.0 requires Advanced Vector Extensions, Xeon E5540 does not have them.
For a list of processors that support AVX, see https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX
Make sure libmkl-dev and lib-avx2 are installed and available on your OS. On Debian 10, these packages are in Nonfree amd64 repository. Add the repo to your /etc/apt/sources.list Enable the repo then do apt-get update followed by:
apt-get install libmkl-dev libmkl-avx2 mongodb-org

Unable to run mongoDB after installation

I'm On fedora 34 and trying to install mongoDB on this machine.
I followed installation instruction from official Docs from here. Everything installed correctly, but now i'm unable to start the service.
I executed sudo systemctl start mongod and it showed
root#fedora /v/l/mongodb [100]# systemctl start mongod
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xeu mongod.service" for details.
This is the source for mongod.service in /usr/lib/systemd/system/mongod.service
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target
[Service]
User=mongod
Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings
[Install]
WantedBy=multi-user.target
I think problem begins here
12 ExecStart=/usr/bin/mongod $OPTIONS
I'm a noob in systemd and daemons and services
This is the log from systemctl status mongod.service
root#fedora /v/l/mongodb [1]# systemctl status mongod.service
× mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-08-01 11:18:36 IST; 16min ago
Docs: https://docs.mongodb.org/manual
Process: 8116 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8117 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8118 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8119 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
CPU: 149ms
Aug 01 11:18:36 fedora systemd[1]: Starting MongoDB Database Server...
Aug 01 11:18:36 fedora mongod[8119]: about to fork child process, waiting until server is ready for connections.
Aug 01 11:18:36 fedora mongod[8122]: forked process: 8122
Aug 01 11:18:36 fedora mongod[8119]: ERROR: child process failed, exited with 14
Aug 01 11:18:36 fedora mongod[8119]: To see additional information in this output, start without the "--fork" option.
Aug 01 11:18:36 fedora systemd[1]: mongod.service: Control process exited, code=exited, status=14/n/a
Aug 01 11:18:36 fedora systemd[1]: mongod.service: Failed with result 'exit-code'.
Aug 01 11:18:36 fedora systemd[1]: Failed to start MongoDB Database Server.
Your mongodb exited with status code 14 as systemctl status says.
Here you can find the answer

MongoDB not starting properly on Ubuntu 18.04.2 LTS

root#HangoutRoot:/Bot# sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-08 08:57:25 PDT; 5s ago
Docs: https://docs.mongodb.org/manual
Process: 2241 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 2241 (code=exited, status=48)
Jun 08 08:57:25 HangoutRoot systemd[1]: Started MongoDB Database Server.
That's what I get when I check the status of the mongodb server using sudo systemctl status mongod
Try this command : sudo systemctl enable mongod
After this:
run this command
sudo service mongod restart
If this still do not work I think reinstalling mongo would be a better solution.
To re-install mongo follow the the process of accepted answer from this link:
https://askubuntu.com/questions/884541/cant-start-mongodb-service

Unable to start postgresql service on CentOS 7

Unable to start postgresql-9.5 on CentOS 7.
I followed this page - https://wiki.postgresql.org/wiki/YUM_Installation - for installing the database server on CentOS.
I tried the same after setting setenforce 0, and that did not help either.
I am doing all operations as root.
systemctl start postgresql-9.5.service
Job for postgresql-9.5.service failed because the control process exited with error
code. See "systemctl status postgresql-9.5.service" and "journalctl -xe" for details.
And here is what I get for status -
Redirecting to /bin/systemctl status postgresql-9.5.service
● postgresql-9.5.service - PostgreSQL 9.5 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.5.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-02-18 15:20:30 EST; 2min 28s ago
Process: 15041 ExecStartPre=/usr/pgsql-9.5/bin/postgresql95-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Feb 18 15:20:30 myserver systemd[1]: Starting PostgreSQL 9.5 database server...
Feb 18 15:20:30 myserver systemd[1]: postgresql-9.5.service: control process exited, code=exited status=1
Feb 18 15:20:30 myserver systemd[1]: Failed to start PostgreSQL 9.5 database server.
Feb 18 15:20:30 myserver systemd[1]: Unit postgresql-9.5.service entered failed state.
Feb 18 15:20:30 myserver systemd[1]: postgresql-9.5.service failed.
And the contents of the different conf files are as follows -
[root#myserver /]# cat /etc/ld.so.conf.d/postgresql-pgdg-libs.conf
/usr/pgsql-9.5/lib/
[root#myserver /]# cat /usr/lib/tmpfiles.d/postgresql-9.5.conf
d /var/run/postgresql 0755 postgres postgres -
[root#myserver /]# cat /usr/pgsql-9.5/share/postgresql-9.5-libs.conf
/usr/pgsql-9.5/lib/
[root#myserver /]# cat /etc/alternatives/pgsql-ld-conf
/usr/pgsql-9.5/lib/
[root#myserver /]# cat /var/lib/alternatives/pgsql-ld-conf
auto
/etc/ld.so.conf.d/postgresql-pgdg-libs.conf
/usr/pgsql-9.5/share/postgresql-9.5-libs.conf
950
Googled for the error that I am seeing.
A number of folks have seen the same error, and the underlying cause is different in each case. Reading through those posts, it is not clear that I am seeing any of the already reported causes.
Make sure you have installed all packages correctly and updated yum repository sections [base] and [updates] before installation as it mentioned in the guide . We have CentOS 7 with PostgreSQL 9.5 and it works perfectly fine with following steps:
vi /etc/yum.repos.d/CentOS-Base.repo
yum localinstall http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
yum list postgres*
yum install -y postgresql95-server.x86_64 postgresql95-contrib.x86_64 postgresql95-libs.x86_64
/usr/pgsql-9.5/bin/postgresql95-setup initdb
systemctl enable postgresql-9.5.service
systemctl start postgresql-9.5.service
and finally, systemctl status postgresql-9.5.service should show you something like this:
postgresql-9.5.service - PostgreSQL 9.5 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.5.service; enabled)
Active: active (running) since Fri 2016-02-19 00:01:13 UTC; 6min ago
Process: 10809 ExecStart=/usr/pgsql-9.5/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=0/SUCCESS)
Process: 10802 ExecStartPre=/usr/pgsql-9.5/bin/postgresql95-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 10811 (postgres)
CGroup: /system.slice/postgresql-9.5.service
├─10811 /usr/pgsql-9.5/bin/postgres -D /var/lib/pgsql/9.5/data
├─10812 postgres: logger process
├─10814 postgres: checkpointer process
├─10815 postgres: writer process
├─10816 postgres: wal writer process
├─10817 postgres: autovacuum launcher process
└─10818 postgres: stats collector process
The most common issue is that the database cluster was not initialized. You can initialize it easily by running the postgresql-XX-setup script with the initdb command, e.g.
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
Then start the Postgres service, e.g.
sudo systemctl start postgresql-11
These steps helped me on our test server.
Connect your server via SSH.
Then switch user:
sudo su - postgres
Check Postgres status:
pg_ctl status
Stop DB:
pg_ctl stop
Check if no server processes exist:
ps axf | grep postg
Start Postgres service:
sudo systemctl start postgresql.service
OR
sudo systemctl start postgresql
Then check status:
systemctl status postgresql.service ИЛИ systemctl status postgresql

Resources