Restore pacman local database

Hello, Pacman’s database of installed software, /var/lib/pacman/local, has been deleted from my PC. So, I’m trying to restore it by following the steps prescribed here. I do have the /var/log/pacman.log and the /var/lib/pacman/local/ALPM_DB_VERSION files on my system.

However, in the first step, it says to “Install the pacman-contrib package to get paclog-pkglist.”
How do I do that? Since doing sudo pacman -S pacman-contrib tries to install the required dependencies too, but they are already installed (pacman doesn’t know that of course). And so it raises the “already exists in the filesystem” error.

sudo pacman -Syu pacman-contrib --overwrite "/var/lib/pacman/local/*" && sudo pacman -Fy

Nope. Still the same “[…] exists in filesystem” error

And you can reinstall all installed packages the same way. But you don’t even have to do that, there is --dbonly. Check man pacman.

1 Like

The problem is that we don’t know what state your system is in. Therefore, I can give you a quick fix, but it is dangerous, not recommended unless one knows what one is doing, and it could also completely ruin your system. :point_down:

sudo pacman -Syu pacman-contrib --overwrite "*" && sudo pacman -Fy
2 Likes

If you have timeshift, then why not restore the most recent snapshot from before you messed up your system?

You do know that you can run timeshift from the command line as well, don’t you? :confused:

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.