FS#47188 - The eternal "Unable to lock database" Error
Attached to Project:
Pacman
Opened by Camille Bissuel (nylnook) - Thursday, 26 November 2015, 15:49 GMT
Last edited by Allan McRae (Allan) - Monday, 14 December 2015, 13:37 GMT
Opened by Camille Bissuel (nylnook) - Thursday, 26 November 2015, 15:49 GMT
Last edited by Allan McRae (Allan) - Monday, 14 December 2015, 13:37 GMT
|
Details
Summary and Info:
Every now and then, I run into a "Unable to lock database" Error and have to enter again "sudo rm /var/lib/pacman/db.lck", and trying to remember what the path is. Honestly I'm sick on it, It's been three years, and it's the most common blocking error pacman send to everyone. I fully understand the need to ensure that the current installation process is the only one running at that time. But can this be done in a smarter way, and non-obstrusive for users, especially newbies installing Manjaro or Antergos ? Can't pacman check if another pid of itself is running before running ? And ask "Another Pacman instance is actually running, you should wait for it to finish. Do you want to force it to stop (not recommended) ?" Or can't pacman just ask "Another Pacman instance is actually running, you should wait for it to finish. Do you want to force delete the lock file (not recommended) ? Or just Pacamn dealing silently and smartly with that without blocking the user just making it's daily update ? Steps to Reproduce: just abort any installation, and launch pacman again. I know it sound like a feature request, but please consider this as an usability bug. Thanks a lot in advance. |
This task depends upon
Closed by Allan McRae (Allan)
Monday, 14 December 2015, 13:37 GMT
Reason for closing: Not a bug
Additional comments about closing: Leaving the lock file is desirable when pacman is interrupted.
Monday, 14 December 2015, 13:37 GMT
Reason for closing: Not a bug
Additional comments about closing: Leaving the lock file is desirable when pacman is interrupted.
I'm using Antergos.
Pamac (graphical client) is installed by default and I'm using it.
It comes with a daemon called "pamac-tray", checking for updates regularly.
So maybe it's linked to this daemon : if I switch off my computer (twice a day) while pamac-tray is invocating pamac, maybe this left the db.lck file.
But, sorry to be insisting, but even it is what is happening that's not the point : Pacman should be able to deal with an interrupted process (script error, user aborting, internet switch off, electrical power cut... ), "repairing" things, or proposing to repair, if something bad happened instead of blocking the user. That's not excluding with pedagogy and the Archlinux principles : just explain the user what happened and inform him on what to do next instead of just saying "Unable to lock database" which is not helpful.
I fully respect the great work done on Pacman, and I tahnk you for that using it every day, but I think there is still room for improvement user-side...
I hope I am clearer...
Maybe just a log file storing the last used command would allow pacman to know what was happening when something gone wrong.
Then it may be just a question like "Pacman was interrupted, do you want to retry the latest command ?"
Linux doesn't complain after a power cut : it just start again, checking the file system. Firefox ask you if you want to restore your tabs... and so on ! Why Pacman couldn't manage it ?
Thanks !
This search give me thousands of users asking again and again the same question : why my package manager is broken ?
https://www.google.fr/search?q=pacman+unable+to+lock+database
If you read me correctly, I'm not asking not to use this db.lck file, I'm asking you not to leave users with a broken package manager, forced to delete an obscure file in an obscure path without understanding what they do to recover, and with high chances to do something worst than a broken package. A broken error message is a bug not only by conception but by lack of respect for the human using your software.
So, what do you do recommend to do if you get this error "Unable to lock database" message and you know no other pacman instance is running ?
pacman -Qk
pacman -Su
pacman -Sy
?
Shouldn't this be better than letting the user type
sudo rm /var/lib/pacman/db.lck
as it is recommended in the Manjaro wiki : https://wiki.manjaro.org/index.php?title=Pacman_troubleshooting ?
Can't we change a simple error message to lead the user in a better way, and not let him do stupid things ?
I'm open to discussion about what should be recommended if no magic is possible, but don't say me there is no issue.