Raspberry Pi 3 B と Ubuntu Server 23.04 で MongoDB を実行しようとすると失敗する

Raspberry Pi 3 B と Ubuntu Server 23.04 で MongoDB を実行しようとすると失敗する

Ubuntu を実行している Raspberry Pi 3 B に MongoDB をインストールして実行しようとしています。

インストールして起動しようとすると、次のステータスが表示されます。

srv_user@raspserver:~$ sudo systemctl start mongod
srv_user@raspserver:~$ sudo systemctl status mongod
× mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; preset: enabled)
     Active: failed (Result: core-dump) since Sat 2023-07-08 01:23:51 CEST; 3s ago
   Duration: 1.448s
       Docs: https://docs.mongodb.org/manual
    Process: 36515 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dumped, signal=ILL)
   Main PID: 36515 (code=dumped, signal=ILL)
        CPU: 120ms
srv_user@raspserver:~$ mongo
Illegal instruction (core dumped)

OS情報は次のとおりです。

srv_user@raspserver:~$ uname -a
Linux raspserver 6.2.0-1007-raspi #9-Ubuntu SMP PREEMPT Wed Jun 21 18:54:19 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

srv_user@raspserver:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:        23.04
Codename:       lunar

MongoDB をインストールするために使用したコマンドは次のとおりです。

#####Removing old files#####
sudo rm /etc/apt/sources.list.d/mongodb*.list

sudo service mongod stop

sudo apt-get purge mongodb-org*

sudo apt autoremove

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

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 --allow-insecure-repositories

sudo apt-get install -y mongodb-org

sudo systemctl start mongod

sudo systemctl status mongod

出力は次のようになります:

srv_user@raspserver:~$ sudo rm /etc/apt/sources.list.d/mongodb*.list
rm: cannot remove '/etc/apt/sources.list.d/mongodb*.list': No such file or directory
srv_user@raspserver:~$ sudo service mongod stop
srv_user@raspserver:~$ sudo apt-get purge mongodb-org*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'mongodb-org-database-tools-extra' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-server' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-shell' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-mongos' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-shell' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-server' for glob 'mongodb-org*'
Note, selecting 'mongodb-org' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-tools' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-mongos' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-tools' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-tools-unstable' for glob 'mongodb-org*'
Package 'mongodb-org-tools' is not installed, so not removed
Package 'mongodb-org-tools-unstable' is not installed, so not removed
Package 'mongodb-org-unstable' is not installed, so not removed
Package 'mongodb-org-unstable-mongos' is not installed, so not removed
Package 'mongodb-org-unstable-server' is not installed, so not removed
Package 'mongodb-org-unstable-shell' is not installed, so not removed
Package 'mongodb-org-unstable-tools' is not installed, so not removed
Package 'mongodb-org-database-tools-extra' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  mongodb-database-tools mongodb-mongosh
Use 'sudo apt autoremove' to remove them.
(Reading database ... 140652 files and directories currently installed.)
Removing mongodb-org-mongos (4.4.22) ...
Removing mongodb-org-server (4.4.22) ...
Removing mongodb-org-shell (4.4.22) ...
Processing triggers for man-db (2.11.2-1) ...
(Reading database ... 140629 files and directories currently installed.)
Purging configuration files for mongodb-org-server (4.4.22) ...
Purging configuration files for mongodb-org (4.4.22) ...
srv_user@raspserver:~$ sudo apt autoremove
[sudo] password for srv_user:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  mongodb-database-tools mongodb-mongosh
0 upgraded, 0 newly installed, 2 to remove and 2 not upgraded.
After this operation, 180 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 140628 files and directories currently installed.)
Removing mongodb-database-tools (100.7.3) ...
Removing mongodb-mongosh (1.10.1) ...
Processing triggers for man-db (2.11.2-1) ...
srv_user@raspserver:~$ sudo rm -r /var/log/mongodb
srv_user@raspserver:~$ sudo rm -r /var/lib/mongodb
srv_user@raspserver:~$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
srv_user@raspserver:~$ 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
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse
srv_user@raspserver:~$ sudo apt-get update --allow-insecure-repositories
Hit:1 http://ports.ubuntu.com/ubuntu-ports lunar InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports lunar-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports lunar-backports InRelease
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports lunar-security InRelease
Get:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release [3094 B]
Get:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release.gpg [866 B]
Get:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse amd64 Packages [49.5 kB]
Get:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse arm64 Packages [40.5 kB]
Fetched 93.9 kB in 6s (16.8 kB/s)
Reading package lists... Done
W: https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/4.4/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
srv_user@raspserver:~$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  mongodb-database-tools mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell
  mongodb-org-tools
The following NEW packages will be installed:
  mongodb-database-tools mongodb-org mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server
  mongodb-org-shell mongodb-org-tools
0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded.
Need to get 95.4 MB/95.4 MB of archives.
After this operation, 194 MB of additional disk space will be used.
Get:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse arm64 mongodb-database-tools arm64 100.7.3 [49.1 MB]
Get:2 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse arm64 mongodb-org-shell arm64 4.4.22 [12.3 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse arm64 mongodb-org-server arm64 4.4.22 [18.9 MB]
Get:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse arm64 mongodb-org-mongos arm64 4.4.22 [15.1 MB]
Fetched 95.4 MB in 13s (7393 kB/s)
Selecting previously unselected package mongodb-database-tools.
(Reading database ... 140607 files and directories currently installed.)
Preparing to unpack .../0-mongodb-database-tools_100.7.3_arm64.deb ...
Unpacking mongodb-database-tools (100.7.3) ...
Selecting previously unselected package mongodb-org-shell.
Preparing to unpack .../1-mongodb-org-shell_4.4.22_arm64.deb ...
Unpacking mongodb-org-shell (4.4.22) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../2-mongodb-org-server_4.4.22_arm64.deb ...
Unpacking mongodb-org-server (4.4.22) ...
Selecting previously unselected package mongodb-org-mongos.
Preparing to unpack .../3-mongodb-org-mongos_4.4.22_arm64.deb ...
Unpacking mongodb-org-mongos (4.4.22) ...
Preparing to unpack .../4-mongodb-org-database-tools-extra_4.4.22_arm64.deb ...
Unpacking mongodb-org-database-tools-extra (4.4.22) ...
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../5-mongodb-org-tools_4.4.22_arm64.deb ...
Unpacking mongodb-org-tools (4.4.22) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../6-mongodb-org_4.4.22_arm64.deb ...
Unpacking mongodb-org (4.4.22) ...
Setting up mongodb-org-server (4.4.22) ...
Setting up mongodb-org-shell (4.4.22) ...
Setting up mongodb-database-tools (100.7.3) ...
Setting up mongodb-org-mongos (4.4.22) ...
Setting up mongodb-org-database-tools-extra (4.4.22) ...
Setting up mongodb-org-tools (4.4.22) ...
Setting up mongodb-org (4.4.22) ...
Processing triggers for man-db (2.11.2-1) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

Failed to check for processor microcode upgrades.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

現時点では、Ubuntu のリリースに問題があるのではないかと推測していますが、古いバージョンをクリーン インストールする前に、同様の経験をした人がいるかどうか尋ねてみたいと思います。

答え1

@natiiix のおかげで、mongodb を正常にインストールして起動することができました。これは、以前使用していた特定のバージョン 4.4.22 と関係があります。

3.2、2.4 などの他のバージョンも試しましたが、まったく機能しませんでした。バージョン 4.4.1 のみが機能します。

私が使用したコマンドは次のとおりです。

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    
echo "deb [ arch=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 --allow-insecure-repositories

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

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

答え2

MongoDBは現在Piプラットフォームをサポートしていません。MongoDBの最新バージョンを実行したい場合は、ここベストエフォートで提供される非公式バイナリ。

関連情報