Is there any known cause to the pamac database problem?

I have seen lately a relative big number of users (here and in the spanish-speaking Telegram forum) with the same problem. Graphical pamac can’t update because “Unable to lock database”. The solution seems to be always the same, run the command: pamac update --force-refresh

I’m not sure what’s the difference with this command, as the graphical tools seems to be trying to do just that, update the database. I haven’t had this problem myself, but I am curious to know what could be the cause to this. Does anyone know? Is it a bug somehow? Or is it something users are doing wrong? (although I doubt it)

I regularly get the message unable to lock database but the update /installs still work so I’ve just been ignoring the message

you can try

sudo rm /var/lib/pacman/db.lck

Is this in the GUI tool or the command line tool? As far as I know users having this problem can’t continue the update. And it is always in the GUI tool.

As I said, I’m not having the problem myself and the solution seems to be always the one I mentioned. What I am looking is for the cause of the problem.

It may be related to this

Maybe, but that seems like a different problem with different symptoms.

There may be some correlation between having run pamac with sudo or perhaps it appears when you have opened settings then downloading databases which creates the database problem due to the folder having the wrong permissions.

I think the issue had been solved - I recall a topic recently where @Yochanan posted something about this - but I don’t recall specifically.

Yes, I know. Just yesterday I helped an user that had the pamac_aur.db problem. But the error message was exactly that: “Cannot create regular file …”. In that case it was his fault and the /var/tmp/pamac folder and subfolders had the wrong owner.

But the problem we are seeing most is the one with the error message “Unable to lock database”.

Anyway, I’m going to ask the next user with that problem to show his pamac database folder. Let’s see if I can spot something odd there.

This error message is thrown by alpm library and should point to /var/lib/pacman/db.lck

I have seen several users suggest the file should be located in /var/tmp/pamac subtree - I have never seen such db.lck file outside the /var/lib/pacman.

Odd. As far as I know users don’t have problems with pacman. It’s only with pamac GUI. I will try to make also some tests the next time. Let’s see what info I can gather from users.

It happens when using the pamac gui. Not all the time but often enough to not be normal

Do you solve it any other way than running the command pamac update --force-refresh? As far as I know users can’t continue updating through the GUI without solving it somehow

I solve it with:

sudo rm /var/tmp/pamac/dbs/db.lck

But am still surprised it randomly blocks

The GUI should only be used to see what updates you have. You will have less problems doing the updates through your terminal. I have seen AUR packages not built through pamac, but the same package build and install without issue doing it via the terminal. Wine-Staging is another one that sometimes doesn’t like to offer all the 32 bit components needed, but not a issue in terminal.