Fix mongodb libcrypto error on ubuntu 22.04
Problem
As the time of writing this post (08/11/2022), mongodb doesn’t provide a release of mongod (communtiy editor) for ubuntu 22.04 LTS, if you download the 20.04 version and try to run under ubuntu 22.04, you will get an error:
error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
This is because ubuntu 22.04 is using libssl version 3.0, the libcrypto.so 1.1 is included in lib 1.1 which is not included in ubuntu 22.04 anymore:
1 | $ openssl version |
From the above you can see the openssl version is 3, and libcrypto.so.1.1 is missing.
Solution
Install libssl 1.1 manually can solve this problem, go to page: http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/?C=M;O=D to find the libssl 1.1. Find the latest version and download the .deb file, then use apt install to install it:
1 | $ wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb |
Now although openssl version still print 3.0, the libssl and libcrypto1.1 has been installed to the system:
1 | $ ldconfig -p | grep crypto |
Now you should be able to run mongod.
Summary
You can run mongod on ubuntu 22.04 with manually install the libssl 1.1 library. It is strange that after ubuntu 22.04 LTS released for almost 4 months, mongodb still doesn’t release a version that can run on it. While I am sure eventually a mongodb version run with libssl 3.0 will be release, you can track the progress here: https://jira.mongodb.org/browse/SERVER-62300