Arch Linux: Cannot find shared library libffi.so.7

Aron Schüler Published


Today something happened that reddit lets you think happens more often. My Arch Linux broke after an update.

The first hints on this were that I got the message “Cannot find shared library libffi.so.7” when starting various apps. I quickly decided that this was due to a missing kernel module and rebooted. Then it became obvious that it was not just some missing modprobe but a more serious problem; even my LightDM display manager and NetworkManager refused to start without libffi in the correct version.

Fixing the libffi dependency on Arch

Now, there are two ways to provide your system with the missing library: Either you downgrade your libffi package to the version 3.4.2-3 or you install libffi7 from the AUR.

The downgrade will install a version of libffi that provides both the newer libffi.so.8 as well as the older libffi.so.7 libraries. This way, your applications will have satisfied dependencies and you can continue using your system until all packages have updated their dependencies from libffi.so.7 to .8.

The package from the Arch User Repository will provide libffi.so.7 in parallel to your normal libffi installation. Doing so will allow you to keep updating your libffi package without worrying about the .7 library.

Solution 1: Downgrading libffi on Arch

Note: I do not recommend this solution but would rather advise you to use solution 2. Partial downgrades of libraries can and probably will cause other dependency issues in the future. Also you will have to lock the package version. This forces you to come back to this issue, manually check if the problem was resolved upstream, so than you can then remove the version lock and update your package again. This is not necessary when using solution 2!

To downgrade libffi, you can use pacman to automatically install the older version from the awesome Arch Linux Archive. This contains daily snapshots of older packages. If you ever need an older version of the package and don’t want to build it based with an older PKGBUILD yourself, this is the site where you look for your package.

To install the last working libffi version for your arch system, we will use pacman to first install the package itself:

pacman -U https://archive.archlinux.org/packages/l/libffi/libffi-3.4.2-3-x86_64.pkg.tar.zst

Now we have to tell pacman to skip upgrades for this package, as we intend to keep the older version. To do so, you must open /etc/pacman.conf, find the [options] section, find the line containing IgnorePkg= and add libffi to this line so that it reads IgnorePkg=libffi [...] (where […] is a placeholder for other packages. Don’t add […] to that line!)

Pacman will now ignore possible updates to libffi until you allow it by removing the line in pacman.conf.

Solution 2: Installing libffi.so.7 from Arch User Repository

My recommended solution to this problem is installing the library as a portable function interface from the AUR. This way you can keep your libffi package and satisfy any dependencies on libffi.so.7.

This solution requires two steps. You clone the files and build the package from it:

git clone https://aur.archlinux.org/libffi7.git
cd libffi7
makepkg -si

Well yes, it’s three steps if you include the cd 😛

makepkg will fetch dependencies for the build, build the package, test the package and install it. After that, you will have a working version 7 of libffi available on your system.

Done!

I hope the steps above helped to resolve your current dependency conflict and to give you some insight on what to do if this happens again. Any feedback is welcome in the comments, other posts can be found in my recent posts.

Thanks for reading and see you around!


Related Posts

Find posts on similar topics:


Comments