Solvedyay yay: error while loading shared libraries: libalpm.so.11: cannot open shared object file: No such file or directory

I am having the following issue, when running yay:

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

How should I fix this?

17 Answers

✔️Accepted Answer

You can use the initial installation method of yay, @gouvinb has it well summarized if you want to understand it #1084 (comment)

This can be applied to your prefered flavor yay, yay-gitor yay-bin.

yay-bin

# Remove yay for update 
sudo pacman -R yay
# Install yay from git
cd /tmp
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
cd ..
# clean /tmp folder
rm -rf yay-bin

yay

# Remove yay for update 
sudo pacman -R yay
# Install yay from git
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
# clean /tmp folder
rm -rf yay

EDIT: corrected yay -R
EDIT2: Applies only to Arch Linux and not derivatives such as Manjaro.

Other Answers:

you can use cached repo

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

You cannot do "yay -R yay" because that requires yay, which does not work ;).

try reinstalling yay using git repo.

sudo pacman -Rnsc yay
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg
sudo pacman -U yay-9.4.2-1-x86_64.pkg.tar.xz // <- replace with your file name

That's it 👍

sudo pacman -R yay or yay-bin/yay-git