This question already has an answer here:

I have been using Linux for a while. I first used Debian based systems and then yesterday I switched to Arch. I noticed (in both Debian & Arch) that when you try to download multiple packaged from different terminals they give you an error that already some process is going on. In Arch Linux I saw a detailed view of this. I saw that whenever the pacman is doing some stuff it creates a db.lck file and if this file is present, It will not make any further instances. My question is : What happens if I remove this db.lck file while a process is going on. Will that break my system? When I tried to install gimp and gedit at same time :

[siddharth@brightprogrammer etc]$ sudo pacman -S gedit
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

This says that I can remove the db.lck. Can I?

marked as duplicate by Stephen Kitt apt Mar 5 at 8:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @Stephenkitt not exactly a duplicate question, but your answer also answers this question. I would be better with a line or two more on database locking / atomically / consistency. – ctrl-alt-delor Mar 5 at 10:08
  • see askubuntu.com/questions/132059/… for how to get around the apt locking problem. – ctrl-alt-delor Mar 5 at 10:12
  • @ctrl-alt-delor right, the notion of a duplicate on SE relates to the answer, not the question (see the introduction to the link: “This question already has an answer here”). I’ve added a workaround. I’m not sure how to write a couple of lines usefully on the topics you mention; if you want to edit the answer feel free ;-). – Stephen Kitt Mar 5 at 15:18