Get the App
SLTechnology News&Howtos  ›  Database  › 

MongoDB error mongorestore: error while loading shared libraries: libsasl2.so.2

Shulou Source: shulou.com Published: 2022-06-01 06:06:41 09月23日 Update

MongoDB uses the command mongostore: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory

Background of the problem:

MongoDB 3.20 deployed on CentOS 7.4, error occurred when recovering data using mongostore

[root@server6 dump]# mongorestore

mongorestore: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory

[root@server6 dump]# find / -name mongorestore

^C

[root@server6 dump]#

[root@server6 dump]#

[root@server6 dump]# vi /etc/profile

[root@server6 dump]# ls /data/mongodb/bin

bsondump mongo mongod mongodump mongoexport mongofiles mongoimport mongooplog mongoperf mongorestore mongos mongostat mongotop

[root@server6 dump]# mongorestore

mongorestore: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory

[root@server6 dump]# /data/mongodb/bin/mongorestore

/data/mongodb/bin/mongorestore: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory

[root@server6 dump]#

After verification, there is no such library file in the system.

Download libsasl2.so.2 library file from CentOS6.8 system and transfer it to the corresponding path on CentOS7

CentOS 6.8:

[root@test02 ~]# find / -name libsasl*

/usr/lib64/libsasl2.so.2

/usr/lib64/libsasl2.so.2.0.23

/usr/lib64/sasl2/libsasldb.so.2.0.23

/usr/lib64/sasl2/libsasldb.so.2

/usr/lib64/sasl2/libsasldb.so

[root@test02 ~]# ll /usr/lib64/libsasl2.so.2

lrwxrwxrwx. 1 root root 18 Feb 23 2017 /usr/lib64/libsasl2.so.2 -> libsasl2.so.2.0.23

[root@test02 ~]# ll /usr/lib64/libsasl2.so.2.0.23

-rwxr-xr-x. 1 root root 106160 Mar 25 2015 /usr/lib64/libsasl2.so.2.0.23

[root@test02 ~]# ll /usr/lib64/sasl2/libsasldb.so

lrwxrwxrwx. 1 root root 19 Feb 23 2017 /usr/lib64/sasl2/libsasldb.so -> libsasldb.so.2.0.23

[root@test02 ~]# ll /usr/lib64/sasl2/libsasldb.so.2

lrwxrwxrwx. 1 root root 19 Feb 23 2017 /usr/lib64/sasl2/libsasldb.so.2 -> libsasldb.so.2.0.23

[root@test02 ~]# ll /usr/lib64/sasl2/libsasldb.so.2.0.23

-rwxr-xr-x. 1 root root 22784 Mar 25 2015 /usr/lib64/sasl2/libsasldb.so.2.0.23

[root@test02 ~]# sz /usr/lib64/libsasl2.so.2

[root@test02 ~]# 0

[root@test02 ~]#

[root@test02 ~]# sz /usr/lib64/libsasl2.so.2.0.23

[root@test02 ~]# 0

[root@test02 ~]# ll -h /usr/lib64/libsasl2.so.2.0.23

-rwxr-xr-x. 1 root root 104K Mar 25 2015 /usr/lib64/libsasl2.so.2.0.23

[root@test02 ~]# ll -h /usr/lib64/sasl2/libsasldb.so.2.0.23

-rwxr-xr-x. 1 root root 23K Mar 25 2015 /usr/lib64/sasl2/libsasldb.so.2.0.23

[root@test02 ~]# sz /usr/lib64/sasl2/libsasldb.so.2.0.23

[root@test02 ~]# 0

[root@test02 ~]#

On CentOS7:

[root@server6 dump]# find / -name libsasl*

……

/usr/lib64/libsasl2.so.3.0.0

/usr/lib64/libsasl2.so.3

/usr/lib64/sasl2/libsasldb.so

/usr/lib64/sasl2/libsasldb.so.3

/usr/lib64/sasl2/libsasldb.so.3.0.0

/usr/lib64/libsaslwrapper.so.1

/usr/lib64/libsaslwrapper.so.1.0.0

[root@server6 dump]# cd /usr/lib64/

[root@server6 lib64]# ll libsasl2.so*

lrwxrwxrwx 1 root root 17 Jan 9 17:47 libsasl2.so.3 -> libsasl2.so.3.0.0

-rwxr-xr-x 1 root root 121328 August 3 2017 libsasl2.so.3.0.0

[root@server6 lib64]# rz

z waiting to receive.** B0100000023be50

[root@server6 lib64]# ll libsasl2.so*

-rw-r--r-- 1 root root 106160 March 25 2015 libsasl2.so.2.0.23

lrwxrwxrwx 1 root root 17 Jan 9 17:47 libsasl2.so.3 -> libsasl2.so.3.0.0

-rwxr-xr-x 1 root root 121328 August 3 2017 libsasl2.so.3.0.0

[root@server6 lib64]# ln -s libsasl2.so.2 libsasl2.so.2.0.23

ln: Unable to create symbolic link 'libsasl2.so.2.0.23': File already exists

[root@server6 lib64]# ll libsasl2.so*

-rw-r--r-- 1 root root 106160 March 25 2015 libsasl2.so.2.0.23

lrwxrwxrwx 1 root root 17 Jan 9 17:47 libsasl2.so.3 -> libsasl2.so.3.0.0

-rwxr-xr-x 1 root root 121328 August 3 2017 libsasl2.so.3.0.0

[root@server6 lib64]# ln -s libsasl2.so.2.0.23 libsasl2.so.2

[root@server6 lib64]# ll libsasl2.so*

lrwxrwxrwx 1 root root 18 Mar 5 17:17 libsasl2.so.2 -> libsasl2.so.2.0.23

-rw-r--r-- 1 root root 106160 March 25 2015 libsasl2.so.2.0.23

lrwxrwxrwx 1 root root 17 Jan 9 17:47 libsasl2.so.3 -> libsasl2.so.3.0.0

-rwxr-xr-x 1 root root 121328 August 3 2017 libsasl2.so.3.0.0

[root@server6 lib64]# chmod a+x libsasl2.so.2.0.23

[root@server6 lib64]# ll libsasl2.so*

lrwxrwxrwx 1 root root 18 Mar 5 17:17 libsasl2.so.2 -> libsasl2.so.2.0.23

-rwxr-xr-x 1 root root 106160 March 25 2015 libsasl2.so.2.0.23

lrwxrwxrwx 1 root root 17 Jan 9 17:47 libsasl2.so.3 -> libsasl2.so.3.0.0

-rwxr-xr-x 1 root root 121328 August 3 2017 libsasl2.so.3.0.0

[root@server6 lib64]# mongorestore

2018-03-05T17:18:19.311+0800 using default 'dump' directory

2018-03-05T17:18:19.312+0800 Failed: can't create ActualPath object from path dump: stat dump: no such file or directory

[root@server6 lib64]#

Reference: Error running yum, missing libsasl2.so.2 file

2014-12-24

Error running yum, missing libsasl2.so.2 file

[root@localhost /]# yum repolist

There was a problem importing one of the Python modules

required to run yum. The error leading to this problem was:

libsasl2.so.2: cannot open shared object file: No such file or directory

Please install a package which provides this module, or

verify that the module is installed correctly.

It's possible that the above module doesn't match the

current version of Python, which is:

2.6.6 (r266:84292, Oct 12 2012, 14:23:48)

[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

If you cannot solve this problem yourself, please go to

the yum faq at:

http://yum.baseurl.org/wiki/Faq

Missing libsasl2.so.2 file, reinstall or find a computer with this file directly copied to the past.

My solution:

[root@localhost ~]# scp /usr/lib64/libsasl2.so.2 root@192.168.1.253:/usr/lib64/

[root@localhost ~]# yum repolist

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

repo id repo name status

local balack 3,648

repolist: 3,648

[root@localhost ~]#

Error running yum, missing libsasl2.so.2 file

Original address: www.cnblogs.com/xfan1982/p/4182039.html

Source: www.mamicode.com/info-detail-386519.html

Tags: File missing error timeout run library file system context text command address data method times source computer symbol background path link Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MariaDB Apple Shulou Information Redmi