Error while loading shared libraries libwbclient so 0

Новые и опытные пользователи Linux могут сталкиваться с ошибкой error loading shared libraries во время запуска программ, также с ней могут сталкиваться

Новые и опытные пользователи Linux могут сталкиваться с ошибкой error loading shared libraries во время запуска программ, также с ней могут сталкиваться программисты и все желающие компилировать программное обеспечение в своей системе. Эта ошибка в дословном переводе означает что возникла проблема во время загрузки общей библиотеки. О том что такое библиотеки и зачем они нужны вы можете узнать из статьи библиотеки Linux.

В этой же статье мы рассмотрим что значит ошибка error while loading shared libraries более подробно, а главное, как ее решить.

Даже если вы не компилируете свои программы, то вы можете увидеть ошибку error while loading shared libraries: имя_библиотеки: cannot open shared object file: No such file or directory достаточно часто во время установки новых программ не через пакетный менеджер или программ, предназначенных для другого дистрибутива. Как я уже говорил, она возникает потому, что система не может найти библиотеку.

А вот почему ее нельзя найти и загрузить, это уже интересно. Этому может быть несколько причин:

  • Библиотека не установлена в системе;
  • Библиотека установлена, но неизвестно куда;
  • Библиотека установлена правильно, но имеет не ту версию.

При решении проблемы мы будем руководствоваться именно этими причинами и пытаться их решить.

Как исправить ошибку?

1. Библиотека не установлена

Первый вариант, тут все понятно, библиотеки просто нет в системе, поэтому мы и получаем такую ошибку. Верный способ ее решения — просто найти пакет библиотеки с помощью пакетного менеджера и установить ее. Обычно, пакеты с библиотеками называются так же, как и сами библиотеки с префиксом lib.

Например, если нам не хватает библиотеки libfuse2.so, то мы можем найти ее в Ubuntu такой командой:

sudo apt search libfuse2

Затем осталось только установить ее:

sudo apt install libfuse2

Если перед вами стоит задача собрать программу из исходников, то вам понадобится не только установить саму библиотеку, но и заголовочные файлы для нее:

sudo apt install libfuse-dev

И так для любой библиотеки. Но это не всегда помогает.

2. Библиотека находится не в том каталоге

Бывает что библиотека установлена, мы установили ее или она поставлялась вместе с программой, но ошибка как была, так и есть. Причиной этому может быть то, что загрузчик Linux не может найти библиотеку.

Поиск библиотек выполняется по всех папках, которые указаны в конфигурационных файлах /etc/ld.conf.d/. По умолчанию, это такие каталоги, как /usr/lib, /lib, /usr/lib64, /lib64. Если библиотека установлена в другой каталог, то, возможно, это и есть причина проблемы.

Вы можете посмотреть какие библиотеки сейчас доступны загрузчику с помощью команды:

ldconfig -p

Найти, где находится ваша библиотека можно с помощью команды locate. Например, нас интересует библиотека librtfreader.so:

 locate librtfreader

Теперь мы знаем, что она находится по адресу /opt/kingsoft/wps-office/office6/. А значит, для работы программы необходимо сделать чтобы загрузчик библиотек ее видел. Для этого можно добавить путь в один из файлов /etc/ld.so.conf.d/ или же в переменную LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/opt/kingsoft/wps-office/office6/

Опять же, так вы можете поставить с любой библиотекой, которая взывает ошибку. Еще один более простой метод — это просто создать символическую ссылку на нужную библиотеку в правильной папке:

ln -s /opt/kingsoft/wps-office/office6/librtfreader.so /usr/lib/librtfreader.so

3. Неверная версия библиотеки

Эта причина ошибки довольно часто встречается при использовании программ не для вашего дистрибутива. Каждая библиотека имеет дополнительную версию, так называемую ревизию, которая записывается после расширения .so. Например, libav.so.1. Так вот, номер версии меняется всякий раз, когда в библиотеку вносятся какие-либо исправления.

Часто возникает ситуация, когда в одном дистрибутиве программа собирается с зависимостью от библиотеки, например, libc.so.1, а в другом есть только libc.so.2. Отличия в большинстве случаев здесь небольшие и программа могла бы работать на второй версии библиотеки. Поэтому мы можем просто создать символическую ссылку на нее.

Например, библиотеки libusb-1.0.so.1 нет. Но зато есть libusb-1.0.so.0.1, и мы можем ее использовать:

Для этого просто создаем символическую ссылку на библиотеку:

sudo ln -s /usr/lib/libusb-1.0.so.0.1 /usr/lib/libusb-1.0.so.1

В большинстве случаев программа не заметит подмены и будет работать, как и ожидалось. Также для решения этой проблемы можно попытаться найти нужную версию библиотеки в интернете для своей архитектуры и поместить ее в папку /usr/lib/ или /usr/lib64/. Но после этого желательно обновить кэш:

sudo ldconfig

Выводы

В этой статье мы рассмотрели почему возникает ошибка Error while loading shared libraries, а также как ее решить. В большинстве случаев проблема решается довольно просто и вы получите работоспособную программу. Надеюсь, эта информация была полезной для вас.

Creative Commons License

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

View previous topic :: View next topic  
Author Message
kiboko
n00b
n00b

Joined: 29 May 2003
Posts: 59

PostPosted: Wed Jul 01, 2009 6:08 pm    Post subject: samba and libwbclient.so.0 errors [solved] Reply with quote

I have net-fs/samba-3.2.13 installed and unable to start it.

Code:
# smbd

smbd: error while loading shared libraries: libwbclient.so.0: cannot open shared object file: No such file or directory

ldd reports

Code:
# ldd /usr/sbin/smbd

        linux-vdso.so.1 =>  (0x00007fff77f4d000)

        libldap-2.3.so.0 => /usr/lib64/libldap-2.3.so.0 (0x00007f286f467000)

        liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0 (0x00007f286f258000)

        libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007f286f029000)

        libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007f286ed88000)

        libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007f286eb5d000)

        libcom_err.so.2 => /lib/libcom_err.so.2 (0x00007f286e959000)

        libresolv.so.2 => /lib/libresolv.so.2 (0x00007f286e742000)

        libdl.so.2 => /lib/libdl.so.2 (0x00007f286e53e000)

        libcups.so.2 => /usr/lib64/libcups.so.2 (0x00007f286e303000)

        libssl.so.0.9.8 => /usr/lib64/libssl.so.0.9.8 (0x00007f286e0a9000)

        libcrypto.so.0.9.8 => /usr/lib64/libcrypto.so.0.9.8 (0x00007f286dd0f000)

        libz.so.1 => /lib/libz.so.1 (0x00007f286daf8000)

        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f286d8dc000)

        libm.so.6 => /lib/libm.so.6 (0x00007f286d659000)

        libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007f286d421000)

        libpam.so.0 => /lib/libpam.so.0 (0x00007f286d213000)

        libacl.so.1 => /lib/libacl.so.1 (0x00007f286d00a000)

        libattr.so.1 => /lib/libattr.so.1 (0x00007f286ce04000)

        libcap.so.2 => /lib/libcap.so.2 (0x00007f286cbfe000)

        libnsl.so.1 => /lib/libnsl.so.1 (0x00007f286c9e6000)

        libdns_sd.so.1 => /usr/lib64/libdns_sd.so.1 (0x00007f286c7dd000)

        libpopt.so.0 => /usr/lib64/libpopt.so.0 (0x00007f286c5d3000)

        libtalloc.so.1 => /usr/lib64/libtalloc.so.1 (0x00007f286c3ca000)

        libtdb.so.1 => /usr/lib64/libtdb.so.1 (0x00007f286c1bc000)

        libwbclient.so.0 => not found

        libc.so.6 => /lib/libc.so.6 (0x00007f286be61000)

        libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007f286bc58000)

        /lib64/ld-linux-x86-64.so.2 (0x00007f286f6a4000)

        libavahi-client.so.3 => /usr/lib/libavahi-client.so.3 (0x00007f286ba46000)

        libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007f286b806000)

        libavahi-common.so.3 => /usr/lib/libavahi-common.so.3 (0x00007f286b5f9000)

showing that libwbclient.so.0 is not found. A look at the package install via equery reveals that libwbclient is being installed:

Code:
# equery f net-fs/samba|grep libwbclient.so.0

/usr/lib64/samba/libwbclient.so.0

So what has broken ldd such that it cannot find libwbclient? I cannot tell if libwbclient being installed in /usr/lib64/samba is the right place, as looking over /etc/ld.so.conf show that /usr/lb64/samba is searched by ldd. So hows was this working before?

I even downgraded to net-fs/samba-3.2.11 and found the same results, so something recently changed since samba has been working fine until recently. There are no files in /etc/env.d that add an LDPATH for /usr/lib64/samba and I do not know if one was is needed or how it’s supposed to work.

My samba USE flags are

Code:
# equery u net-fs/samba

 * Searching for net-fs/samba …

[ Legend : U — flag is set in make.conf       ]

[        : I — package is installed with flag ]

[ Colors : set, unset                         ]

 * Found these USE flags for net-fs/samba-3.2.13:

 U I

 + + acl          : Adds support for Access Control Lists

 + — ads          : Enable Active Directory support

 — — async        : Enables asynchronous input/output

 + — automount    : Enables automount support

 + + caps         : Use Linux capabilities library to control privilege

 + + cups         : Add support for CUPS (Common Unix Printing System)

 + + doc          : Adds extra documentation (API, Javadoc, etc)

 — — examples     : Install examples, usually source code

 + + fam          : Enable FAM (File Alteration Monitor) support

 + + ipv6         : Adds support for IP version 6

 + + kernel_linux : KERNEL setting for system using the Linux kernel

 + + ldap         : Adds LDAP support (Lightweight Directory Access Protocol)

 — — linguas_ja   : Japanese locale

 — — linguas_pl   : Polish locale

 + + pam          : Adds support PAM (Pluggable Authentication Modules) — DANGEROUS to arbitrarily flip

 — — quotas       : Enables support for user quotas

 + + readline     : Enables support for libreadline, a GNU line-editing library that almost everyone wants

 — — selinux      : !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur

 + — swat         : Enables support for swat configuration gui

 — — syslog       : Enables support for syslog

 + — winbind      : Enables support for the winbind auth daemon

Suggestions welcome.

Last edited by kiboko on Thu Jul 02, 2009 5:57 am; edited 1 time in total

Back to top

View user's profile Send private message

kiboko
n00b
n00b

Joined: 29 May 2003
Posts: 59

PostPosted: Thu Jul 02, 2009 5:57 am    Post subject: Reply with quote

Love it when you can answer your own queries…..

It turns out that for some exotic arrangement of circumstances, my emerge sync cron job stopped working recently. After manually emerge —sync’ing I found I could upgrade to samba-3.2.13-r2 which works as it should with libwbclient installed in /usr/lib64 for my ~amd box.

I do not yet understand why samba-3.2.11 failed to work, but are happy that things are working again.

Back to top

View user's profile Send private message

Display posts from previous:   

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

There is a list of common errors I often see in Ubuntu. There is problem with merge list, then there is BADSIG error, and a number of common Ubuntu update errors.

One of such common errors which I often see while installing a program from its source code is error while loading shared libraries. The full error generally looks like this:

error while loading shared libraries:
cannot open shared object file: No such file or directory

For example, I was trying to use FreeRADIUS server and it showed me this error:

radiusd: error while loading shared libraries:
libfreeradius-radius-2.1.10.so:
cannot open shared object file: No such file or directory

The reason behind this error is that the libraries of the program have been installed in a place where dynamic linker cannot find it.

Let me show you how you can go about fixing this issue.

One quick way to fix this “error while loading shared libraries” automatically is to use ldconfig.

All you need to do is to open terminal (Ctrl+Alt+T) and type the following command:

sudo /sbin/ldconfig -v

This one liner should solve the problem in most cases. However, if it doesn’t, I have discussed another method to handle this error. But before that, let me tell you what does the above command do.

What are shared object files? How does the above command fixes the issue?

You see, in C/C++, a .so (shared object) is a compiled library file. It is called shared object because this library file can be shared by several programs. These generated libraries are usually located in /lib or /usr/lib directories.

Now if you wonder how did this tiny command fixed this problem, you should read the man page of ldconfig which says:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

I hope this quick fix helps you in eliminating the nasty error while loading shared libraries message in Ubuntu and other Linux.

If not, you can do some investigation and try to fix the issue the way it is mentioned in the next section.

The above discussed method fixes the issue if the library in question is available in your system. But that may not always be the case.

If you do not have the program installed on your system, you won’t have its library file. The ldconfig cannot do anything if there is no library file in the first place.

So, the alternate method is to install the required program and it should create the library automatically.

Let me show it to you by an example. Let’s say you see this error:

error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

The problem is with libgobject version 2.0. The version number is important because some programs depend on a specific version of the library and if they don’t find, they complain about it.

Now, apt provides the search option that can be used for searching a package and knowing its version before installing it.

[email protected]:~$ apt search libgobject
Sorting... Done
Full Text Search... Done
librust-gobject-sys-dev/focal 0.9.0-2 amd64
  FFI bindings to libgobject-2.0 - Rust source code

Now, this librust-gobject-sys-dev package could be what you need if you know that you were trying to run a Rust program. But what if it was a Python program you were running that complained about it?

You can widen your search by removing the lib from the package name while searching. The lib signifies library and libraries may be provided by a generic package that could be named gobject-xyz.

It would be a good idea to search for the string in the names of the package (instead of description) to get more concise results.

[email protected]:~$ apt search --names-only gobject
Sorting... Done
Full Text Search... Done
gobject-introspection/focal-updates 1.64.1-1~ubuntu20.04.1 amd64
  Generate interface introspection data for GObject libraries

libavahi-gobject-dev/focal 0.7-4ubuntu7 amd64
  Development headers for the Avahi GObject library

libavahi-gobject0/focal 0.7-4ubuntu7 amd64
  Avahi GObject library

libcairo-gobject-perl/focal,now 1.005-2 amd64 [installed,automatic]
  integrate Cairo into the Glib type system in Perl

libcairo-gobject2/focal,now 1.16.0-4ubuntu1 amd64 [installed,automatic]
  Cairo 2D vector graphics library (GObject library)

libghc-gi-gobject-dev/focal 2.0.19-1build1 amd64
  GObject bindings

libghc-gi-gobject-doc/focal,focal 2.0.19-1build1 all
  GObject bindings; documentation

In the above truncated output, you’ll have to see if the package is related to the original program you were trying to run. You must also check the version of the library provided.

Once you have identified the correct package, install it like this:

sudo apt install package_name

Once installed, you may run the ldconfig command again to update the cache:

sudo /sbin/ldconfig -v

This method requires some effort on your end but this is how the dependencies are handled.

Nothing works, what now?

If you are unfortunate enough, the above methods might not work for you. What can you do?

First, keep in mind that the shared libraries may be used from other packages in some cases. If you were trying to run XYZ program and ABC program installs the correct version of the shared library, it may (or may not) work for you. You can give it a hit and trial.

Second, if you are trying to run a program which is too old or too new, it may require a library version which is not available for your Linux distribution.

What you may do is to check if you can use some other version of the program. For example, using Eclipse version 3 instead of version 4. This may help your case.

The other way would be to check the developers website or forums and see if you can manually install the correct version of the library from its source code. That requires a lot of effort (in 2020) but you don’t have a lot of options.

Did it work for you?

I hope I have make things a bit more clear for you. Did you manage to fix the issue of shared libraries in your system? If you have questions, suggestions, feel free to drop a comment. Ciao :)

User avatar

hemington1

Posts: 156
Joined: Mon Nov 26, 2012 6:38 pm
Location: Perth Western Australia

SOLVED: Samba Server Stopped

Happy New Year to all.
Yesterday afternoon samba just stopped. I did not install any apps or delete any.
Any clues to a fix?

Code: Select all

[root@localhost ~]# systemctl status smb
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled)
Active: failed (Result: start-limit) since Fri 2016-01-01 14:39:45 AWST; 2min 27s ago
Process: 10016 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=127)
Main PID: 10016 (code=exited, status=127)

Jan 01 14:39:45 localhost.localdomain systemd[1]: smb.service: main process exited, code=exited, status=127/n/a
Jan 01 14:39:45 localhost.localdomain systemd[1]: Failed to start Samba SMB Daemon.
Jan 01 14:39:45 localhost.localdomain systemd[1]: Unit smb.service entered failed state.
Jan 01 14:39:45 localhost.localdomain systemd[1]: smb.service failed.
Jan 01 14:39:45 localhost.localdomain systemd[1]: start request repeated too quickly for smb.service
Jan 01 14:39:45 localhost.localdomain systemd[1]: Failed to start Samba SMB Daemon.
Jan 01 14:39:45 localhost.localdomain systemd[1]: smb.service failed.
Jan 01 14:39:46 localhost.localdomain systemd[1]: start request repeated too quickly for smb.service
Jan 01 14:39:46 localhost.localdomain systemd[1]: Failed to start Samba SMB Daemon.
Jan 01 14:39:46 localhost.localdomain systemd[1]: smb.service failed.
[root@localhost ~]#

Amahi 11
Intel i7 quad core 2.8GHz
1 GiB Geforce graphics
16 GiB RAM
Sagemcom F@st 5366 tn modem/router


User avatar

bigfoot65

Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Samba Server Stopped

Postby bigfoot65 » Fri Jan 01, 2016 7:10 am

Try:

Check status again.
Also check /var/log/ samba/smbd.log for errors.

ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2


User avatar

hemington1

Posts: 156
Joined: Mon Nov 26, 2012 6:38 pm
Location: Perth Western Australia

Re: Samba Server Stopped

Postby hemington1 » Fri Jan 01, 2016 6:34 pm

smbd.log is full of cups errors, unable to connect to printer.
I tried removing cups but get this:

Code: Select all

[root@localhost ~]# yum erase cups
Loaded plugins: fastestmirror
No Match for argument: cups
No Packages marked for removal

Code: Select all

[2015/12/28 03:49:50.293063, 0] ../source3/printing/print_cups.c:151(cups_connect)
Unable to connect to CUPS server localhost:631 - Bad file descriptor
[2015/12/28 03:49:50.293381, 0] ../source3/printing/print_cups.c:528(cups_async_callback)
failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
[2015/12/28 04:02:50.884236, 0] ../source3/printing/print_cups.c:151(cups_connect)
Unable to connect to CUPS server localhost:631 - Bad file descriptor
[2015/12/28 04:02:50.884575, 0] ../source3/printing/print_cups.c:528(cups_async_callback)
failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL

Amahi 11
Intel i7 quad core 2.8GHz
1 GiB Geforce graphics
16 GiB RAM
Sagemcom F@st 5366 tn modem/router


User avatar

bigfoot65

Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Samba Server Stopped

Postby bigfoot65 » Sat Jan 02, 2016 8:05 am

Try installing cups then start Samba. Check status and report back.

ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2


User avatar

hemington1

Posts: 156
Joined: Mon Nov 26, 2012 6:38 pm
Location: Perth Western Australia

Re: Samba Server Stopped

Postby hemington1 » Sat Jan 02, 2016 7:31 pm

cups installed.
Samba is still in a permanently stopped state.
I restarted the HDA to be sure. Still no samba.
I noticed OpenVPN server had also permanently stopped after the restart. A re-install of OpenVPN was the only way to get it working again.
Samba still stopped……….
:cry:
Some critical files/folder corrupted?

Code: Select all

Jan 03 10:39:26 localhost.localdomain smbd[3854]: /usr/sbin/smbd: error while loading shared libraries: libwbclient.so.0: cannot
open shared object file: No such file or directory

Is the folder in the wrong location?

Code: Select all

[root@localhost ~]# locate libwbclient.so.0
/usr/lib64/samba/wbclient/libwbclient.so.0
/usr/lib64/samba/wbclient/libwbclient.so.0.11
[root@localhost ~]#

Amahi 11
Intel i7 quad core 2.8GHz
1 GiB Geforce graphics
16 GiB RAM
Sagemcom F@st 5366 tn modem/router


User avatar

bigfoot65

Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Samba Server Stopped

Postby bigfoot65 » Sat Jan 02, 2016 9:30 pm

ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2


User avatar

hemington1

Posts: 156
Joined: Mon Nov 26, 2012 6:38 pm
Location: Perth Western Australia

Re: Samba Server Stopped

Postby hemington1 » Sun Jan 03, 2016 4:46 am

Yes, up to date.

Amahi 11
Intel i7 quad core 2.8GHz
1 GiB Geforce graphics
16 GiB RAM
Sagemcom F@st 5366 tn modem/router


User avatar

bigfoot65

Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Samba Server Stopped

Postby bigfoot65 » Sun Jan 03, 2016 11:40 am

You might be able to fix it by reinstalling Samba:

It should work, but no guarantee. Also please understand it might make things worse, but worth a shot in my opinion.

ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2


User avatar

hemington1

Posts: 156
Joined: Mon Nov 26, 2012 6:38 pm
Location: Perth Western Australia

Re: Samba Server Stopped

Postby hemington1 » Sun Jan 03, 2016 7:32 pm

Thanks Big. Before I do that, is there a way to redirect Samba to find the library in /usr/lib64/samba/ ?
Where is this library in your setup? Is it in /usr/sbin/smbd ?

Amahi 11
Intel i7 quad core 2.8GHz
1 GiB Geforce graphics
16 GiB RAM
Sagemcom F@st 5366 tn modem/router


User avatar

bigfoot65

Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Samba Server Stopped

Postby bigfoot65 » Mon Jan 04, 2016 11:57 am

I have not checked, but I think the reinstall is the best option. It should fix the missing files but you may need to manually start the service.

ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2


Who is online

Users browsing this forum: No registered users and 7 guests

Sometimes, when you try to install a program or a package from its source code, you might end up getting an error which looks like :

“error while loading shared libraries: cannot open shared object file No such file or directory”

In general, if the package shared library name is lib, the error sometimes shows the following :

error while loading shared libraries: lib.so.X: cannot open shared object file: No such file or directory

Where X is a number.

These dynamically generated shared libraries, which are required by executables, are stored under /lib or /usr/lib directories.

The command below can help find out the libraries that are needed for a given executable :

ldd nw

As a quick workaround, you could try to fix the issue by running ldconfig command below :

sudo ldconfig -v

Now at runtime, the system would need to locate the ‘.so’ corresponding library file since the package or the program is linked with the library shared version.

To locate the library, invoke the command below :

sudo find / -name lib_file.so.x

or you could use apt search command. Jot down the path in which the lib_file.so.x is found, path_to_so_file.

Read: How to find the largest files on Linux

To include the folder in which the library is installed, the shell variable LD_LIBRARY_PATH has to be provided.

If LD_LIBRARY_PATH is not defined (run echo $LD_LIBRARY_PATH to find out), you could set it using the command (in the Bash shell) :

LD_LIBRARY_PATH=/usr/local/lib

Now using the path of the .so file that you found above, path_to_so_file, run the commands below :

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_to_so_file

export LD_LIBRARY_PATH $ ./your_package

You can find out more about shared libraries here.


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

Nikolaus Oosterhof

Nikolaus has a degree in software development. He is passionate about gadgets with a screen, nostalgic for phones, a retired gamer and open source programmer. He likes also to write about macOS and Windows. design web pages and debug long programs!

Понравилась статья? Поделить с друзьями:
  • Error while loading shared libraries libssl so
  • Error while loading shared libraries libqtgui so 4
  • Error while loading shared libraries libqtcore so 4
  • Error while loading shared libraries libqt5sql so 5
  • Error while loading shared libraries libpq so 5