How to Fix “error while loading shared libraries” Issue in Ubuntu Linux

App does not run in Linux? Try running it using terminal command. If you get something says “error while loading shared libraries”, then you’re the right place to find a solution.

Since some libraries are required for running an application, but not for building it, maintainer may sometimes omit a dependency package when compiling a software. As a result, app does not run in client machine and outputs error:

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

The solution is easy! Just manually search for the package name and install it. And this works in Ubuntu, Debian, Fedora, and all other Linux systems.

Search for the missing package:

For instance, Blender 2.92 PPA package does not run (see the picture in the top) due to the libLLVM-6.0.so.1 library.

To find out which package provides the library, open terminal and run following commands one by one:

Firstly install apt-file searching utility if you don’t have it:

sudo apt install apt-file

Then generate the database by running command:

sudo apt-file update

Finally, search which package provides the file, libLLVM-6.0.so.1, in the case:

apt-file search libLLVM-6.0.so.1

As the picture shows, there are three packages: libllvm6.0, llvm-6.0-dev, and python-lldb-6.0 that provide the file.

  • libllvm6.0 : the package just works.
  • llvm-6.0-dev : package with -dev in the end of package name is usually used for compiling software. Run apt show llvm-6.0-dev command, it will tell that it depends libllvm6.0. The package will work, but install some useless packages.
  • python-lldb-6.0 : the apt show python-lldb-6.0 tells it depends on llvm-6.0-dev. So it works but installs even more useless packages.

The solution in the case is installing either one of the 3 packages. The first one is the good choice, and you can install it via command:

sudo apt install libllvm6.0

What if apt-file search does not work:

If the apt-file command does not work, search on Google or contact the package maintainer as the file is not available in your system repositories.

If the package is packaged strictly, you can run apt show command with package name, blender in the case:

apt show blender

It will outputs the maintainer’s email address.
NOTE: the section is NOT always correct as maintainers change often and the current maintainer may be lazy and do not update it.

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.