As a sidenote, you can still download some of the mongodb binaries from the official ubuntu repo (not recommended by mongodb though), if you just playing around it is fine imho. Example:
Hi folks! Ubuntu 22.04 has been out for almost 3 months now, when will we be able to install the official version of mongo without all sorts of hacks and tweaks?
My bash script (that’s added below) will open the ‘nano’ editor and offer you to edit the control file specifying the deps. Your are looking for a line like this (starting with “Depends” and containing a reference to “libssl1.1”):
Hint: You don’t need ‘mongodb-mongosh’ from the deps as it’s being replaced by ‘mongodb-mongosh-shared-openssl3’.
Afterwards I couldn’t start the mongod service:
Jun 11 18:14:11 systemd[1]: Started MongoDB Database Server.
Jun 11 18:14:11 systemd[48437]: mongod.service: Failed to determine user credentials: No such process
Jun 11 18:14:11 systemd[48437]: mongod.service: Failed at step USER spawning /usr/bin/mongod: No such process
Jun 11 18:14:11 systemd[1]: mongod.service: Main process exited, code=exited, status=217/USER
Jun 11 18:14:11 systemd[1]: mongod.service: Failed with result 'exit-code'.
Which was because of a missing user (after looking at ‘/etc/systemd/system/mongod.service’), so I added it:
sudo adduser mongodb
Edit, try, fail, repeat:
Jun 11 18:15:53 systemd[1]: Started MongoDB Database Server.
Jun 11 18:15:53 mongod[48504]: /usr/bin/mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
Jun 11 18:15:53 systemd[1]: mongod.service: Main process exited, code=exited, status=127/n/a
Jun 11 18:15:53 systemd[1]: mongod.service: Failed with result 'exit-code'.
Jun 11 18:23:59 mongod[48822]: /usr/bin/mongod: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
Jun 11 18:26:29 systemd[1]: Started MongoDB Database Server.
Jun 11 18:26:29 mongod[48845]: /usr/bin/mongod: /lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/bin/mongod)
Jun 11 18:26:29 mongod[48845]: /usr/bin/mongod: /lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/bin/mongod)
Jun 11 18:26:29 mongod[48845]: /usr/bin/mongod: /lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/bin/mongod)
But didn’t I see a snap with 1.1 libs on the system when running the find commands? - Sure did!
$ sudo find / -type f -name libcrypto.so*
/usr/lib/x86_64-linux-gnu/libcrypto.so.3
/snap/core20/1518/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
$ sudo find / -type f -name libssl.so.*
/usr/lib/x86_64-linux-gnu/libssl.so.3
/snap/core20/1518/usr/lib/x86_64-linux-gnu/libssl.so.1.1
$ 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: active (running) since Sat 2022-06-11 18:32:20 CEST; 49ms ago
Docs: https://docs.mongodb.org/manual
Main PID: 48894 (mongod)
Memory: 760.0K
CPU: 16ms
CGroup: /system.slice/mongod.service
└─48894 /usr/bin/mongod --config /etc/mongod.conf
Jun 11 18:32:20 systemd[1]: Started MongoDB Database Server.
Script:
#!/bin/bash
# name: debedit.sh
# author: showp1984
# description: unpacks, edits control file and repacks deb-files with gz or xz compression
# prerequisites: xz-utils && nano
# No guarantees. Use at your own peril.
unset DECOMPXZ
unset DECOMPGZ
FILES="{post,pre}{inst,rm} conffiles md5sums control"
echo "Uncompressing deb..."
ar x $*
FILEXZ="control.tar.xz"
if [ -f "$FILEXZ" ]; then
DECOMPXZ=1
echo "Found: $FILEXZ | using XZ decomp..."
tar --xz -xvf $FILEXZ
fi
FILEGZ="control.tar.gz"
if [ -f "$FILEGZ" ]; then
DECOMPGZ=1
echo "$FILEGZ exists."
tar xzf $FILEGZ
fi
nano control
if [[ "$DECOMPXZ" == 1 ]]; then
echo "Repacking $FILEXZ..."
tar --ignore-failed-read -cvJf $FILEXZ $FILES
echo "Repacking deb with xz files..."
ar rcs "${*}-newpackage.deb" debian-binary $FILEXZ data.tar.xz
fi
if [[ "$DECOMPGZ" == 1 ]]; then
echo "Repacking $FILEGZ..."
tar --ignore-failed-read -cvzf $FILEGZ $FILES
echo "Repacking deb with gz files..."
ar rcs "${*}-newpackage.deb" debian-binary $FILEGZ data.tar.gz
fi
echo "Cleanup..."
rm -r control md5sums debian-binary control.tar.xz data.tar.xz control.tar.gz data.tar.gz postrm preinst prerm conffiles postinst
echo "Done!"
For those who only need the shell and some tools like mongodum/restore, you just have to install those two packages witch are included in the officiel mongo repo:
We found this really annoying but solved the problem by witching to AWS DocumentDB. Now everything works again under 22.04, we save some money by handing off the whole replication problem to AWS, and our searches are faster to boot. If the real MongoDB had gotten its act together sooner we would never have known.
It is because of the missing dependencies mongodb not installing on ubuntu 22.04.
The main reason is the missing of libssl1.1 dependency. So we need to install it seperately.