Synchronizing package databases... unable to lock database Failed to synchronize databases

I have 2 different PC’s with Manjaro.

About 50% of the time I when running pamac updates I get the message in the subject.

The existing posts seem to about 6 months old and the recommended remedies don’t seem to fix the issue.

The updates seem to progress normally, but, I do wonder if there is some trick I’ve not found.

Not sure what to do next.

Operating System: Manjaro Linux
KDE Plasma Version: 5.24.6
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.19.1-3-MANJARO (64-bit)
Graphics Platform: X11
Processors: 4 × AMD Athlon 3000G with Radeon Vega Graphics
Memory: 7.7 GiB of RAM
Graphics Processor: GeForce GT 610/PCIe/SSE2

Remove the database lock:
sudo rm /var/lib/pacman/db.lck
If you get: cannot remove ‘/var/lib/pacman/db.lck’: No such file or directory; use this:
sudo rm /var/tmp/pamac/dbs/db.lck

4 Likes

Yes, one of the previously recommended solutions.

I have tried it.

It works for about two or three updates then the error starts again.

But, I’ll try it again.

Edit: neither file exists.

Its also possible that you have corrupted database files.
sudo rm /var/lib/pacman/sync/*.*
will remove them, then refresh the database’s to replace them.

2 Likes

Could be.

But, why would it be fine sometimes and not others?

Not sure, but removing and replacing the databases is a first step to see if it fixes the issue. Its possible your mirror list has you occasionally connecting to a mirror with issues.

Thank you, that did the trick for me