Trying to setup MongoDB in Khadas board

Hello,

I want to setup a mongo DB inside a Khadas VIM3 board, with Ubuntu 20.04. I want to implement MongoDB as the database for my C++ program.

Khadas boards have arm64 architecture

These are the steps I followed:

Installation of drivers

According to mongo’s official manual for mongo C++, I started installing drivers for C, then for cxx.

  1. I started by installing libmongoc driver

apt-get --no-install-recommends install libmongoc-dev

apt-get --no-install-recommends install cmake

I see this warning, judged it not critical (I am no expert, please don’t value my judgement :sweat_smile:):

/sbin/ldconfig.real: /lib/ is not a symbolic link


sudo apt-get --no-install-recommends install libssl-dev

sudo apt-get --no-install-recommends install libsas12-dev

mkdir downloads/installers

cd downloads/installers

wget https://github.com/mongodb/mongo-c-driver/releases/download/1.24.4/mongo-c-driver-1.24.4.tar.gz

tar xzf mongo-c-driver-1.24.4.tar.gz

cd mongo-c-driver-1.24.4

mkdir cmake-build

cd cmake-build

cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..

  1. My g++ is based in c++14, so I chose polyfill MNMLSTC, adding " -DBSONCXX_POLY_USE_MNMLSTC=1 " cmake option

I installed libmongocxx driver

  1. Executing “apt-cache policy libmongoc-dev”, I get “Installed: 1.16.1-1build2”. Given compatibility table, I go for mongocxx-3.5.x

curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.5.1/mongo-cxx-driver-r3.5.1.tar.gz

tar -xzf mongo-cxx-driver-r3.5.1.tar.gz

cd mongo-cxx-driver-r3.5.1/build

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBSONCXX_POLY_USE_MNMLSTC=1

As I’m using MNMLSTC


sudo cmake --build . --target EP_mnmlstc_core

Polyfill successfully installed, let’s build and install cxx driver:


cmake --build .

sudo cmake --build . --target install

I have all the logs from this, stored using ubuntu’s “script” command. I can provide them if necessary.

Thank you for taking your time to read and maybe help me, you are wonderful. Let’s keep going.

Installation of MongoDB 4.4

Following https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-ubuntu/

´´´

sudo apt-get install gnupg curl

echo “deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] MongoDB Repositories 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.24 mongodb-org-server=4.4.24 mongodb-org-shell=4.4.24 mongodb-org-mongos=4.4.24 mongodb-org-tools=4.4.24

echo “mongodb-org 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

´´´

No errors returned (appart from “/sbin/ldconfig.real: /lib/ is not a symbolic link” )

My system uses systemctl, so:

´´´

khadas@Khadas:~$ sudo systemctl status mongod

● mongod.service - MongoDB Database Server

Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)

Active: failed (Result: signal) since Thu 2023-09-14 09:50:34 UTC; 13s ago

Process: 8600 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)

Main PID: 8600 (code=killed, signal=ILL)

Sep 14 09:50:34 Khadas systemd[1]: Started MongoDB Database Server.

Sep 14 09:50:34 Khadas systemd[1]: mongod.service: Main process exited, code=killed, status=4/ILL

Sep 14 09:50:34 Khadas systemd[1]: mongod.service: Failed with result ‘signal’.

´´´

Configuration tweaks

I checked “ulimit -a”. It seems fine, but this is not a performance issue.

I see there’s no log file created, so I modify /etc/mongod.conf to raise log verbose. Still no log file created.

If you reached this point, I admire your effort. Thank you

May you have a great day.

Gabriel

Hi @MetolaEtra_N_A !
Welcome to the MongoDB community forums.

Thanks for the detailed steps. If I understand correctly, you are not able to run the MongoDB server that you installed. I see that call to start the mongod service is missing in your steps. Could you try executing it?

sudo systemctl start mongod

1 Like

Hi @MetolaEtra_N_A

Welcome to the forums.

Check that this system is a supported platform, the ILL signal suggests that it does not.

ARM64

MongoDB on arm64 requires the ARMv8.2-A or later microarchitecture.

Starting in MongoDB 5.0, mongod, mongos, and the legacy mongo shell no longer support arm64 platforms which do not meet this minimum microarchitecture requirement.

1 Like

Thank you both for your answers.

Chris was on the right track, the problem was on the ARM microarchitecture.

Khadas VIM3 has: A311D big-little architecture. x4 2.2Ghz Cortex-A73 cores, paired with x2 1.8Ghz Cortex-A53 cores. (source)

MongoDB requieres ARMv8.2-A or later
ARM Cores Cortex-A73 and Cortex-A53 implement a lower ARM version, the ARMv8-A 64-bit instruction set (source A73, source A53)

Thus, MongoDB cannot run in Khadas VIM3.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.