Mongodb will not start. libboost_filesystem.so.1.78.0: cannot open shared object file: No such file or directory - mongodb

Something must be broken, or maybe there is something I am not seeing.
I do:
sudo systemctl status mongodb.service
But I get this error:
Jan 26 10:47:49 MacBookPro systemd[1]: Starting MongoDB Database Server...
Jan 26 10:47:49 MacBookPro mongod[12272]: /usr/bin/mongod: error while loading shared libraries: libboost_filesystem.so.1.78.0: cannot>
Jan 26 10:47:49 MacBookPro systemd[1]: mongodb.service: Control process exited, code=exited, status=127/n/a
Jan 26 10:47:49 MacBookPro systemd[1]: mongodb.service: Failed with result 'exit-code'.
Jan 26 10:47:49 MacBookPro systemd[1]: Failed to start MongoDB Database Server.
I have been reading: https://wiki.archlinux.org/title/MongoDB
And because there is no mongod.lock file I do:
mongod --dbpath /var/lib/mongodb/ --repair
But the error persists:
mongod: error while loading shared libraries: libboost_filesystem.so.1.78.0: cannot open shared object file: No such file or directory
What do you guys think is happening? Thanks in advance. Btw I am using BlackArch.
I have tried a full update and upgrade. My system says it is fully updated, but maybe it is not?

Related

mongodb service fail after reinstalling it on ubuntu

i was using mongodb and it was fine.
then i wanted to convert it to replica set and i get into some problems and i uninstalled it.
after reinstalling (10 times and doing everything on internet xD) why i check status with systemctl status it say failed with exit_code ( i know my conf file dont have problem).
what can i do? i even installed the 3.3 version and even it doesnt start anymore.
i used anything that it came to my mind (purging config files & lot more...).
i really dont want to reinstall my os (really cant).
this is my 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 Thu 2021-02-18 20:05:20 +0330; 8s ago
Docs: https://docs.mongodb.org/manual
Process: 147513 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 147513 (code=exited, status=1/FAILURE)
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: Started MongoDB Database Server.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: about to fork child process, waiting until server is ready for connections.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147527]: forked process: 147527
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: ERROR: child process failed, exited with 1
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: To see additional information in this output, start without the "--fork" option.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Failed with result 'exit-code'.
I solved the problem by changing the default mongodb port from port 27017 to port 27018 in /etc/mongod.conf.
I'm sure this will come handy to a lot of people.
And for the last part, after uninstalling mongodb I removed mongod.service files (every file) in the system and systemd directories in root and installed mongodb again.
(so I think uninstalling mongodb wasn't complete at first time. And 2 instances interfere with each other. Now everything works fine in mongodb with port 27018).

MongoDB keeps crashing--is it running out of memory or CPU?

I have an issue where MongoDB keeps crashing on me:
$ sudo cat /var/log/syslog ->
Nov 28 14:06:58 ns557017 systemd[1]: mongod.service: Main process exited, code=killed, status=6/ABRT
Nov 28 14:06:58 ns557017 systemd[1]: mongod.service: Unit entered failed state.
Nov 28 14:06:58 ns557017 systemd[1]: mongod.service: Failed with result 'signal'.
Nov 28 14:06:59 ns557017 systemd[1]: mongod.service: Service hold-off time over, scheduling restart.
Nov 28 14:06:59 ns557017 systemd[1]: Stopped MongoDB Database Server.
I am using Mongo's free monitoring, and it points me towards the CPU being overused:
However if I look at htop, the CPU always seems fine:
How can I deduce what is causing Mongo to crash on me? Thanks

Why mongod.service is killed by my system?

I am using MongoDB 4.4 version on ubuntu 20.4, using 2 mongo instances on the same server. I encountered this problem:
Sep 03 10:45:25 mlnode systemd[1]: Stopping MongoDB Database Server...
Sep 03 10:45:25 mlnode systemd[1]: mongod.service: Succeeded.
Sep 03 10:45:25 mlnode systemd[1]: Stopped MongoDB Database Server.
Sep 03 10:45:25 mlnode systemd[1]: Started MongoDB Database Server.
Sep 03 10:55:46 mlnode systemd[1]: Stopping MongoDB Database Server...
Sep 03 10:55:46 mlnode systemd[1]: mongod.service: Succeeded.
Sep 03 10:55:46 mlnode systemd[1]: Stopped MongoDB Database Server.
Sep 03 10:55:46 mlnode systemd[1]: Started MongoDB Database Server.
Sep 03 11:05:05 mlnode systemd[1]: Stopping MongoDB Database Server...
Sep 03 11:05:05 mlnode systemd[1]: mongod.service: Succeeded.
Sep 03 11:05:05 mlnode systemd[1]: Stopped MongoDB Database Server.
Sep 03 11:05:05 mlnode systemd[1]: Started MongoDB Database Server.
Sep 03 11:13:20 mlnode systemd[1]: /lib/systemd/system/mongod.service:11: PIDFile= references a path below legacy directory /var/run/, updating /var/run/mongodb/mongod.pid → /run/mongodb/mongod.pid; please update the unit file accordingly.
Sep 03 11:25:47 mlnode systemd[1]: /lib/systemd/system/mongod.service:11: PIDFile= references a path below legacy directory /var/run/, updating /var/run/mongodb/mongod.pid → /run/mongodb/mongod.pid; please update the unit file accordingly.
Sep 03 11:56:47 mlnode systemd[1]: mongod.service: Main process exited, code=killed, status=6/ABRT
Sep 03 11:56:47 mlnode systemd[1]: mongod.service: Failed with result 'signal'
Wondering why the system is killing mongod.service, I don't have any clue. Then I checked my mongo logs:
{"t":{"$date":"2020-09-03T11:56:46.379+05:30"},"s":"F", "c":"-", "id":23083, "ctx":"conn10155","msg":"Invariant failure","attr":{"expr":"ret","error":"UnknownError: -31803: WT_NOTFOUND: item not found","file":"src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp","line":1598}}
{"t":{"$date":"2020-09-03T11:56:46.379+05:30"},"s":"F", "c":"-", "id":23084, "ctx":"conn10155","msg":"\n\n***aborting after invariant() failure\n\n"}
{"t":{"$date":"2020-09-03T11:56:46.379+05:30"},"s":"F", "c":"CONTROL", "id":4757800, "ctx":"conn10155","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}
First, stop mongodb if you restarted:
sudo systemctl stop mongod
Next, I detected the database corruption:
sudo mongod --repair --dbpath /var/lib/mongodb
Next, run commands:
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
Finally
sudo systemctl start mongod
From: https://sondnpt00343.medium.com/how-to-fix-mongod-service-32dbbe51a4ee
I figured out that my Linux ulimits were not set to the recommended values of mongod instance.
One of the limits ( locked-in-memory ) was 65536 and in /lib/systemd/system/mongod.service LimitMEMLOCK was infinity.
So I've changed that to 65536, restarted the service and it was working again.
This worked for me!
First, I detected the database corruption.
sudo mongod --repair --dbpath /var/lib/mongodb
Then, I restarted the service but I faced another problem (exit-code).
Next, I ran following commands on the terminal :
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
Finally, I restarted the mongodb service.
sudo systemctl restart mongod
And then this worked for me very well.

Error running mongodb as service on Centos 7

I've got a VPS with Centos 7, But when I try to run MongoDB as service I get the following message:
Apr 06 03:11:46 server.backupserver.com systemd[1]: Starting MongoDB Database Server...
Apr 06 03:11:46 server.backupserver.com mongod[3767]: about to fork child process, waiting until server is ready for connections.
Apr 06 03:11:46 server.backupserver.com mongod[3767]: forked process: 3769
Apr 06 03:11:49 server.backupserver.com systemd[1]: Can't open PID file /var/run/mongodb/mongod.pid (yet?) after start: Too many levels of symbolic links
Apr 06 03:13:17 server.backupserver.com systemd[1]: mongod.service start operation timed out. Terminating.
Apr 06 03:13:17 server.backupserver.com systemd[1]: Failed to start MongoDB Database Server.
Apr 06 03:13:17 server.backupserver.com systemd[1]: Unit mongod.service entered failed state.
Apr 06 03:13:17 server.backupserver.com systemd[1]: mongod.service failed.
I tested the responses from another topics, but it doesn't work yet.
The "var/run/mongodb" directory and the file "mongod.pid" has the right permissions and user (mongod).
Please, help
This seems to be a message that systemd can produce under a variety of conditions. To troubleshoot:
Start with a pristine Docker, Vagrant, VirtualBox etc. image of CentOS 7.
Follow the official MongoDB installation instructions.
If you succeed, follow the official installation instructions on your VPS.

Mongodb fails to start -> presents weird error logs

When I moved my environment from my local (mac) to my server (ubuntu) I unzipped my directory and the server installed with npm install with no errors or warnings, but my database was failing so I decided to reinstall it based on this tutorial (well, apt-remove mongo* first)
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
but then I get a
Job for mongodb.service failed because the control process exited with error code. See "systemctl status mongodb.service" and "journalctl -xe" for details.
Does anyone know what any of this means?
-- Unit mongodb.service has begun starting up.
Jun 20 03:54:18 ip-172-31-16-163 mongodb[25271]: * Starting database mongodb
Jun 20 03:54:19 ip-172-31-16-163 mongodb[25271]: ...fail!
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Control process exited, code=exited status=1
Jun 20 03:54:19 ip-172-31-16-163 sudo[25268]: pam_unix(sudo:session): session closed for user root
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: Failed to start LSB: An object/document-oriented database.
-- Subject: Unit mongodb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongodb.service has failed.
--
-- The result is failed.
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Unit entered failed state.
Jun 20 03:54:19 ip-172-31-16-163 systemd[1]: mongodb.service: Failed with result 'exit-code'.
Looks familiar. Check ownership of files. Files in dbPath, mongod.run -lock file, keyfile...
Basically all those files what are listed at your /etc/mongod.conf
Run the following command and Its works for me
sudo apt-get install --reinstall mongodb