MongoDB failed (result: core-dump)?

Viewed 10585

I'm attempting to setup MongoDB on Ubuntu 20.04.02 LTS by following the documentation. I have ensured this is a fresh install. However an error persists when I verify if the MongoDB install started succesfully by typing in:

sudo systemctl status mongod

ā— mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor prese> Active: failed (Result: core-dump) since Wed 2021-08-11 12:59:20 UTC; 49s > Docs: https://docs.mongodb.org/manual Process: 3190 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dum> Main PID: 3190 (code=dumped, signal=ILL)

Aug 11 12:59:19 discorddomagoj systemd1: Started MongoDB Database Server. Aug 11 12:59:20 discorddomagoj systemd1: mongod.service: Main process exited,> Aug 11 12:59:20 discorddomagoj systemd1: mongod.service: Failed with result '>

Picture of problem for clarity: picture of problem

9 Answers

1.Stop the mongod process by issuing the following command:-

    sudo service mongod stop
    

2.Remove any MongoDB packages that you had previously installed:-

    sudo apt-get purge mongodb-org*
    

3.Remove MongoDB databases and log files:-

    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb
    

4.Then reinstall mangodb 4.4.8

5.Import the public key used by the package management system:-

    wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    

6.The following instruction is for Ubuntu 20.04 (Focal):-

    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
    

7.Update Apt

    sudo apt-get update
    

8.Install mongodb

    sudo apt-get install mongodb-org=4.4.8 mongodb-org-server=4.4.8 mongodb-org-shell=4.4.8 mongodb-org-mongos=4.4.8 mongodb-org-tools=4.4.8
    

9.Use mongod --version to check its succesfully installed

10.If u encounter any error while using mongod

    sudo mkdir /data
    cd /data
    sudo mkdir db
    sudo pkill -f mongod
    

11.Then use sudo mongod command.

This error show CPU incompatibly with mongodb. if use proxmox set cpu mode to "HOST".

latest version of mongo have issue so uninstall it and try lower version

sudo service mongod stop 

sudo apt purge mongo*

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

sudo apt-get update

sudo apt-get install -y mongodb-org=4.4.11 mongodb-org-server=4.4.11 mongodb-org-shell=4.4.11 mongodb-org-mongos=4.4.11 mongodb-org-tools=4.4.11

sudo systemctl start mongod

sudo systemctl status mongod

all done

stop the db

sudo service mongod stop

uninstall it:

sudo apt-get purge mongodb-org*

Import the public key used by the package management system

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

Create a list file for MongoDB.

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

Reload local package database

sudo apt-get update

Install a specific release of the MongoDB packages(this was the reason I had that similar error for not specifying the package)

sudo apt-get install -y mongodb-org=5.0.7 mongodb-org-database=5.0.7 mongodb-org-server=5.0.7 mongodb-org-shell=5.0.7 mongodb-org-mongos=5.0.7 mongodb-org-tools=5.0.7

lastly, on one tab of the terminal run:

sudo mongod

on another open the db:

mongo

I have same issue when installing mongodb on virtual machine with proxmox. Changing processor from kvm to host or sandybridge(my actual pc) solved this problem. Reference link

This is an addition to @AbdulWahhab 's answer. I have recently seen many questions of same type: 'can't start mongodb@5.0.x server on ubuntu@20.0.4'. Having faced this issue myself, I found installing mongodb@4.4.8 version only way out. In addition consider that sudo apt-get update updates all packages including mongodb. Newer version of mongodb gets installed and server does not work anymore(as of 10th december 2021). To prevent unintended upgrades, you can pin the package at the currently installed version:

echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-database hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

A possible reason for the dump is a change in the microarchitecture requirements of MongoDB introduced with version 5.0. This causes this exact issue on a Raspberry Pi for instance (see: MongoDB Forum).

This issue might be mitigated by building from source as described in the forum post. I haven't tried this though personally. Installing versions prior to 5.0 (as described by Abdul Wahhab) will solve the problem as well.

If you have tried all of the above solutions, and still can't help, please try to reboot the VM.

I am using 18.04 and initially installed 6.0 mongoDB and it just showed the core-dump error after issuing "sudo systemctl status mongod".

After doing some research, I tried to uninstall the 6.0 and then re-install 4.4, it still couldn't help. Then I tried to re-install 4.2, it still couldn't help.

Finally, I tried to reboot the VM, then it works..

Just for future help in case of someone else need help.

check if you have the java runtime environment (JRE), if not then install it:

sudo apt install default-jre

That' s all =)

Related