Fix “error while loading shared libraries:” on ArchLinux

Today, when I tried to use yaourt to install some software, the following error happened:

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

The root cause is the libalpm in system is already

$ ls -lt /usr/lib/*
lrwxrwxrwx 1 root root     17 Jun  1 00:32 /usr/lib/ ->
lrwxrwxrwx 1 root root     17 Jun  1 00:32 /usr/lib/ ->
-rwxr-xr-x 1 root root 223616 Jun  1 00:32 /usr/lib/

But the package-query is still searching

$ ldd /usr/bin/package-query (0x00007fffb1d8d000) => /usr/lib/ (0x00007f4baee32000) => /usr/lib/ (0x00007f4baec28000) => not found => /usr/lib/ (0x00007f4bae86c000) => /usr/lib/ (0x00007f4bae647000)

The solution is removing yaourt and package-query, and re-intall them:

$ sudo pacman -Rn yaourt package-query
$ sudo pacman -S fakeroot
$ git clone
$ cd package-query
$ makepkg -si
$ git clone
$ cd yaourt
$ makepkg -si

That’s it!

14 thoughts on “Fix “error while loading shared libraries:” on ArchLinux”

  1. Note that should be no need to uninstall yaourt and package-query before reinstalling them.

    If you happen to have the Git repositories already on your system, then you can rebuild them by running ‘git pull’ inside and then running ‘makepkg -sif’.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.