Pacman's db files corruption

Hi,
This is the second time these days I see:

[gpunk@kili ~]$ sudo pacman -Syu
:: Synchronisation des bases de données de paquets…
core est à jour
extra est à jour
community est à jour
multilib est à jour
erreur : l’ouverture du fichier /var/lib/pacman/sync/core.db a échoué : Unrecognized archive format
erreur : l’ouverture du fichier /var/lib/pacman/sync/extra.db a échoué : Unrecognized archive format
erreur : l’ouverture du fichier /var/lib/pacman/sync/community.db a échoué : Unrecognized archive format
erreur : l’ouverture du fichier /var/lib/pacman/sync/multilib.db a échoué : Unrecognized archive format
erreur : la base de données « core » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « extra » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « community » n’est pas valide (base de données non valide ou corrompue (signature PGP))
erreur : la base de données « multilib » n’est pas valide (base de données non valide ou corrompue (signature PGP))
:: Début de la mise à jour complète du système…
il n’y a rien à faire
[gpunk@kili ~]$ ls -ltr /var/lib/pacman/sync/
total 42756
-rw-r–r-- 1 root root 15141 9 janv. 13:32 mhwd.db
-rw-r–r-- 1 root root 268404 20 févr. 20:02 multilib.files
-rw-r–r-- 1 root root 1615945 20 févr. 20:02 core.files
-rw-r–r-- 1 root root 9923793 21 févr. 22:57 extra.files
-rw-r–r-- 1 root root 31147846 21 févr. 22:57 community.files
-rw-r–r-- 1 root root 200673 27 févr. 10:10 core.db
-rw-r–r-- 1 root root 200673 27 févr. 10:10 extra.db
-rw-r–r-- 1 root root 200673 27 févr. 10:10 community.db
-rw-r–r-- 1 root root 200673 27 févr. 10:10 multilib.db
[gpunk@kili ~]$

I fix the issue each time by forcing the complete refresh of the db,

[gpunk@kili ~]$ sudo pacman -Syy
:: Synchronisation des bases de données de paquets…
core 165,8 KiB 1382 KiB/s 00:00 [######################################] 100%
extra 2006,1 KiB 1911 KiB/s 00:01 [######################################] 100%
community 6,6 MiB 573 KiB/s 00:12 [######################################] 100%
multilib 181,3 KiB 2,95 MiB/s 00:00 [######################################] 100%
[gpunk@kili ~]$ ls -ltr /var/lib/pacman/sync/
total 51048
-rw-r–r-- 1 root root 15141 9 janv. 13:32 mhwd.db
-rw-r–r-- 1 root root 268404 20 févr. 20:02 multilib.files
-rw-r–r-- 1 root root 1615945 20 févr. 20:02 core.files
-rw-r–r-- 1 root root 9923793 21 févr. 22:57 extra.files
-rw-r–r-- 1 root root 31147846 21 févr. 22:57 community.files
-rw-r–r-- 1 root root 185666 26 févr. 15:20 multilib.db
-rw-r–r-- 1 root root 169807 26 févr. 19:41 core.db
-rw-r–r-- 1 root root 2054258 26 févr. 19:54 extra.db
-rw-r–r-- 1 root root 6874523 26 févr. 23:21 community.db
[gpunk@kili ~]$

Pacman throws the error and exits correctly.
Octopi cashes and dumps core.

change mirrors before

sudo pacman-mirrors -c all
sudo pacman -Syyu
1 Like

Don’t run -Sy/-Syy without upgrading (-Syu/-Syyu).

(1): pacman - ArchWiki (see the Warning).

2 Likes

That has been done, on the top of it, I use my mirror, which is fine for the last 5 years :slight_smile:
So there is no way, the .db files got corrupted because of a bad mirror.

That is not the issue either, I launched Syu as normally, and found the .db files corrupted,

As you can see even the sizes are bad.

Having the same problem And the same sizes, means Pacman has corrupted the .db files .

I have been troubleshooting on my uex.dk mirror and in the process I learned something about pacman.

When you get the message that a db file - actually any file required by pacman - is in unrecognized format it could be because the actual file is a html file.

As pacman uses curl or wget to fetch the file - pacman only knows of the file fetched and if the content is html text - usually because an error occurred on the server - in my case the word 404 was missing from the response and thus pacman didn’t know better than the files was corrupted.

You can verify if this is the case by listing the content of the file using e.g. cat or use a terminal filemanager like mc to view the content of the file.

I suspect something like that could happen if octopi parses a file as an archive but get a html document instead.

I understand,

Does that mean that pacman downloads data without verifying it ?

Neither its integrity, neither its authenticity ?

Checking authenticity already will satisfy these two points :slight_smile:

If pacman download repo data, it is supposed to make a minimum of verification, at my knowledge.

pacman does not download any data - it requests the data from server using curl or wget - any means really.

After the data is downloaded - before they are used for anything - they are validated and verified and that verification fails - there is no way it is possible to verify data before they are downloaded.

When the package manager expects a package and a signature but then get something that doesn’t match it refuses to use it.

What happens within octopi I have no idea - my experience and learning was regarding pacman and possibly libalpm which octopi may be using as well.

Yes, I see,

But I think it is odd, and to me it is a point of failure of pacman or maybe alps it self,

This behaviour leads us to this kind of trouble,

We use pacman to get data.

It does it.

Then when we need that data, it is found valid or not.

It is a pitty :slight_smile:

No - not a pity - the checks work - just as you have observed - what is a problem - is octopi’s handling of the data received.

I never spoke about octopi,

yes something did check the file .

But not pacman AT the moment it dowloaded the files.

There it should have been,

This is like buying groceries, and only when you get home, you check the receipt/marchandise … :stuck_out_tongue:

But you did in your OP which is why I mention that I don’t know how Octopi handles the issue.

So ?

Are you trying to “fix” an explained problem, or having sleeping problems
thinking about how to look like the one who is right ?

This kind of behavior belongs to teenagers, not to a “SysAdmin - DevSecOps - Retired”
can you find a longer grade to stamp on ?

Are you the one who wrote pacman ? alps ? so trying to depend their mistakes ?
Or are you a manjaro active member that debunks bad software and bugs ?

That is the point now.