Solvedyay libalpm.so.12: cannot open shared object file ( Installed pacman without yay rebuild)

Affected Version

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

Describe the bug

Using yay in any way results in the following error message:
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
Yes, I keep it up to date.

Reproduction Steps

  1. Have latest pacman
  2. Try to use yay

Expected behavior

Yay should work

Output

  0 [lxb ~]$ yay -V
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
127 [lxb ~]$ yay -Pg
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
127 [lxb ~]$ yay --help
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
127 [lxb ~]$ yay
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
127 [lxb ~]$ pacman --version

 .--.                  Pacman v6.0.0 - libalpm v13.0.0
/ _.-' .-.  .-.  .-.   Copyright (C) 2006-2021 Pacman Development Team
\  '-. '-'  '-'  '-'   Copyright (C) 2002-2006 Judd Vinet
 '--'
                       This program may be freely redistributed under
                       the terms of the GNU General Public License.
16 Answers

✔️Accepted Answer

quick fix:

cd /tmp && git clone 'https://aur.archlinux.org/yay.git' && cd /tmp/yay && makepkg -si && cd ~ && rm -rf /tmp/yay/

Other Answers:

you can use cached repo to rebuild

cd ~/.cache/yay/yay
git pull
makepkg -si

Rebuilding yay from AUR manually solves this problem.
https://wiki.archlinux.org/title/Arch_User_Repository#Installing_and_upgrading_packages

$ yay -V
yay v10.2.2 - libalpm v13.0.0

quick fix:

cd /tmp && git clone 'https://aur.archlinux.org/yay.git' && cd /tmp/yay && makepkg -si && cd ~ && rm -rf /tmp/yay/

Thanks, that fixed the issue :)

you beat me to it :3

Related Issues:

333
yay libalpm.so.12: cannot open shared object file ( Installed pacman without yay rebuild)
quick fix: Affected Version yay -V yay: error while loading shared libraries: libalpm.so.12: cannot ...
104
yay yay: error while loading shared libraries: libalpm.so.11: cannot open shared object file: No such file or directory
You can use the initial installation method of yay I am having the following issue ...
12
yay zsh completion seems to not work
I had this issue on zsh and the solution was to rm ~/.cache/yay/completion.cache ...
15
ArchWSL Can't start a service
You can work around the issues with systemctl by replacing it with this script by @gdraheim: https:/...