This question already has an answer here:

I want to perform multiple apt operations, llike sudo apt install ubuntu-gnome-desktop in one terminal and sudo apt remove lubuntu-desktop in another terminal. When I try to do this I get this (Please don't ask me why I had installed these desktops; I had done so many experiments on Ubuntu that I had to reinstall it many times due to breaking the system)

 $ sudo apt autoremove
 E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
 E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I can do only one operations in at one time with apt!!

I know that it is not safe to break lock but I will take all risk on my own!!

My question is not a duplicate of this as i want to know about how to do in multiple terminals. I know these ways apt install package1 package2 and apt install package1 && apt remove package2. If do this apt install pack1 && apt remove pack2 then I have to wait a long time for pack1 to install.

Also will it work if I break the lock?

marked as duplicate by muru, Terrance, karel, user364819, Eric Carvalho Jun 29 '17 at 11:40

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
    IMHO It is not possible. Multiple instance of apt is not allowed to prevent file corruption. – souravc Jun 29 '17 at 4:32
  • @souravc there must be some way!! – noone Jun 29 '17 at 4:36
  • @souravc what if we break the lock?? – noone Jun 29 '17 at 4:37
  • 1
    Try and find out. Maybe also think a bit before writing nonsense like "apt install pack1 && apt remove pack2 then I have to wait a long time for pack1 to install." – muru Jun 29 '17 at 4:49

You can delete the lock file during one APT process. But this would not be a sane thing to do at all.

It's a basic principle in software that if some data structure is being modified by one process, then another process shouldn't be allowed to access it until the first one has completed its work, because that second process may end up with the wrong information and then try to do something impossible like divide by zero or use a resource that isn't available, or it may write incorrect things. Inconsistencies like this are data corruption, and they break stuff badly.

Allowing multiple APT/DPKG processes to manipulate the database at the same time will cause it to be corrupted. APT may no longer be able to determine what software you have installed or whether its records are up to date. It will most likely start throwing lots of errors and refuse to do anything. It will not save you any time to do that, so please don't do it.


Not allowed. One cannot use apt more than once at the same time. You can, however, use use it like this -> sudo apt-get update && apt-get upgrade

This way both update and upgrade will work.

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