1. What’s up?

Recently, when I use yay -Syu to update the software packages, it always prompts that a package cannot be updated and prompts are warning: could not fully load metadata for package and error: failded to prepare transaction (invalid or corrupted package). It’s time to solve this annoying problem.


2. Remove first

Try to remove it first:

$ yay -Rdd zoom

It still cannot be removed mannually and this time the prompt becomes error: could not remove database entry.


3. Reinstall with the verbose option

And then try to reinstall it with verbose option:

$ yay -Sv zoom

This time the problem remains, but we got the verbose:


4. Analyze the problem

According to the prompts, we know that this issue is related to metadata of the package. And since the metadata is stored in Database, so we check the DB data by the DB Path in the verbose.

4.1 Explore the structure

List the DB directory:

$ ls -la /var/lib/pacman/


There are two folders:

  • local (for local packages data)
  • sync (for sync data)

List the local directory:

$ ls -la /var/lib/pacman/local


List the sync directory:

$ ls -la /var/lib/pacman/sync


4.2 Compare the structure

List the invalid package directory:

$ ls -la /var/lib/pacman/local/zoom-2.9.265650.0716-1/


List a local valid package directory:

$ ls -la /var/lib/pacman/local/git-2.28.0-1


We can find that compared with the normal package, the invalid package lacks some directories and files. It is not difficult to figure out that it is this missing that caused removal or update to be abnormal.

5. Fix the problem

Therefore, we remove the invalid package data mannually:

$ sudo rm -rf /var/lib/pacman/local/zoom-2.9.265650.0716-1/

And then we install the package again:

$ yay -S zoom

Wow! Now the package can be installed without any error prompts.