For the first time I had this error in the terminal when I tried to update my system. This error message was given for around 10 packages.
unknown key ‘%INSTALLED_DB%’ in local database
I have been pulling my hair and searching the web for some time now. What I have found is that this error seems to be due to corruption in some files in /var/lib/pacman/local
database and has nothing to do with the cryptographic keys used for package signing.
The solution I found was:
sudo find /var/lib/pacman/local/ -type f -name "desc" -exec sed -i '/^%INSTALLED_DB%$/,+2d' {} \;
This command searches for files named “desc” in the /var/lib/pacman/local/
directory and removes lines starting with %INSTALLED_DB%
along with the next two lines.
After this sudo pacman -Syu
behaved normally and pacman didn’t complain.
Please have a look and tell if this was the correct way of handling this issue, if there are better ways and if I haven’t done more damage than good.