yay: error while loading shared libraries: libalpm.so.12

yay: error while loading shared libraries: libalpm.so.12

One of my favorite things about Arch Linux is the Arch User Repository (AUR).
It’s a community maintained collection of packages for just about every damn
thing you may want or need.

One of my least favorite things about Arch Linux is that the Arch package manager, pacman doesn’t install packages directly from the AUR.

Because of this, you can either take a manual approach to installing packages
from the AUR, or you can install an additional command that will allow you to
easily install packages directly from the AUR.

My choice is yay.

With yay installed, you can install packages from the AUR just like you can from the main Arch repository. The command’s syntax is a drop-in for pacman so you can use yay to install packages from either the main repository or the
AUR.

For the most part, yay is a rock, but at least once that I can remember, I’ve run into an issue with it.

Fast forward to the present, I recently ran a system upgrade, without any problems at all. Then a few days later, I went to run another upgrade, and I was greeting with the following from yay:

% yay -Syu
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
Zsh

Fortunately, all that was necessary to get things up and running again was
removing yay and then installing the latest version manually. Incidentally, this was the same thing that resolved my previous yay issue.

To get things up and running again, you will need to:

  1. Remove yay by running pacman -R yay
  2. Make a new directory and change to it (makes for easier cleanup):
    mkdir /tmp/yay && cd /tmp/yay
  3. Download the latest PKGBUILD for yay by running:
    curl -OJ 'https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay'
  4. Build and install the package by running makepkg -si
  5. Get rid of of the evidence: rm -rf /tmp/yay

To double check that things are back in working order, simply run yay to
check:

% yay --version
yay v10.2.3 - libalpm v13.0.0
Zsh
Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.