I was attempting to migrate to CachyOS repos, and while googling how to fix an issue, I ran a command I found without thinking, which was:
sudo rm -f /var/lib/pacman/local/*/desc
Now, when I attempt to use pacman, I get errors like these: error: could not open file /var/lib/pacman/local/xfwm4-themes-4.10.0-6/desc: No such file or directory error: could not open file /var/lib/pacman/local/yt-x-git-v0.4.5.r62.gba700d7-1/desc: No such file or directory looking for conflicting packages… error: could not open file /var/lib/pacman/local/a52dec-0.8.0-3/desc: No such file or directory warning: could not fully load metadata for package a52dec-0.8.0-3 error: failed to prepare transaction (invalid or corrupted package)
For context, it says desc is missing for every single package on the system.
In my tests, pacman will not proceed so long as the desc file is missing. For example, I remove /var/lib/pacman/local/xz-5.8.3-1/desc, then I try to re-install xz:
sudo pacman -S --overwrite "*" xz
It throws:
warning: xz-5.8.3-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/xz-5.8.3-1/desc: No such file or directory
warning: could not fully load metadata for package xz-5.8.3-1
error: failed to prepare transaction (invalid or corrupted package)
The good news is however, it will succeed, so long as a desc file is present. It doesn’t need anything in it, an empty file will suffice. So using the output you’ve shared so far @Crosszay, that’d be something like:
That doesn’t sound like an “accidental” occurrence
I would rather say “mistakenly”, “against my better judgement” or “inadvertently”.
Luckily, the suggestion proposed by @Bink will save you the day.
There is too much intention involved in googling stuff, copying command lines you don’t understand the consequences and implications of, putting it in your terminal and pressing enter.
So please be mindful of what you find online next time when you are trying to solve an issue and if you don’t fully understand the “solutions” you find, post it here and ask so you won’t have similar accidents in the future.
Remember, having sudo is a great responsibility and that responsibility is only on your shoulder.
to force pacman getting the latest package version? Not sure I’m right about this btw
(On CachyOS, I sometimes have to do this for some packages installations as the version changed and I’d got errors that the file where not available. Maybe your error could be the same)
Otherwise, these commands “may” help (but please, wait for better users than me that can give you a GO to test, especially the second command): sudo pacman -Syu
This command refreshes the package database if it is out of date and upgrades all installed packages to their latest available versions. This is the recommended command for routine system maintenance, as it ensures compatibility between packages by upgrading everything simultaneously.
sudo pacman -Syuu
This command enables downgrade packages. Pacman will install newer versions of packages if they exist, but if the repository contains an older version than what is currently installed locally, it will downgrade the package to match the repository. This is typically used only in specific scenarios, such as switching from a testing repository to a stable one, or when trying to fix issues caused by a new package version being removed or rolled back.
$ sudo pacman -Sy --overwrite "*" xz
:: Synchronizing package databases...
endeavouros is up to date
core is up to date
extra 8.2 MiB 17.5 MiB/s 00:00 [-------------------------------------------------------] 100%
multilib is up to date
warning: xz-5.8.3-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/xz-5.8.3-1/desc: No such file or directory
warning: could not fully load metadata for package xz-5.8.3-1
error: failed to prepare transaction (invalid or corrupted package)
Unfortunately, no dice on that one
But thanks for the suggestion and thoughts, all the same.
Mistakenly might be the better term here. I had been dealing with an issue with installing a certain package for a bit, and in my frustration, pasted in that command. I didn’t look at it too hard, which was entirely my fault, assuming it was something related to pacman’s cache or something; obviously this was not the case, and in hindsight, there was no reason for me to think that.
Appreciate your help! Unfortunately, these two commands were some of the first things I tried (Apologies for not listing them in the original message), and they did not fix anything.
Unfortunately does not suceed, and instead returns:
error: could not open file /var/lib/pacman/local/yt-x-git-v0.4.5.r62.gba700d7-1/desc: No such file or directory looking for conflicting packages… error: could not open file /var/lib/pacman/local/a52dec-0.8.0-3/desc: No such file or directory warning: could not fully load metadata for package a52dec-0.8.0-3 error: failed to prepare transaction (invalid or corrupted package)
I’ve truncated the output for readability, but the system does complain about a missing desc for each and every package installed.