0

I can't sync my archlinux. When I try to use pacman it get this:

ThinkPad-de-Micael_Andre% sudo pacman -Syu
[sudo] password for dmicaelandre:
Sorry, try again.
[sudo] password for dmicaelandre:
:: Synchronizing package databases...
error: failed to update core (unable to lock database)
error: failed to update extra (unable to lock database)
error: failed to update community (unable to lock database)
error: failed to update multilib (unable to lock database)
error: failed to update archlinuxfr (unable to lock database)
error: failed to update blackarch (unable to lock database)
error: failed to synchronize any databases
error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
if you're sure a package manager is not already
running, you can remove /var/lib/pacman/db.lck

Apparently pacman is in use by another process. How can I get pacman to work?

  • 2
    Have you tried the command suggested by the output, remove /var/lib/pacman/db.lck? – Gypsy Spellweaver Mar 4 '17 at 9:59
  • thanks, for your suggest, you can post on response to give points – Micael André Mar 4 '17 at 10:16
  • Don't post screenshots of text; paste the actual text... – jasonwryan Mar 4 '17 at 19:43
3

When a program says that something else, including another instance of itself, has a resource locked, the first thing to check is if something is really running and using that resource. After you verify that nothing is really using it you can remove the lock.

Often the program will tell you which process is using the resource, or tell you how to remove the lock. In this case the package manager database was locked with the db.lck file, and the error message said to execute remove /var/lib/packman/db.lck.

The cause is often that the last time the program was used it didn't end correctly and remove the lock itself. This could be an error that triggered and abort, or the system could have terminated the process without giving it the opportunity to clean up. The system could have frozen, or shut down, or lost power, as well. Any of these events could cause the resource lock to remain in the file system, and require manual removal.

Of course, always check for a live process before removing any lock files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.