Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Actually if we suspend any application installing in middle or suspending updates then automatically while resuming we will get some problems like

E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/

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 know how to solve these things by removing lock . but i want to know why there is going to be a lock while performing updates/installation .

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Quite simply, locks are used for their original intention: To keep other processes from mucking around with installations. Imagine the following scenario:

  1. Process1 is started to install basex, which depends on default-jre

  2. Process2 begins to remove default-jre. basex is already in progress so it cannot be informed of this removal.

  3. Process2 finishes.

  4. Process1 finishes. A nonworking system exists. This is worse if the same package is installed, then removed simultaneously.

While this may be resolved by holding a per-package lock held for the package and any packages that must exist(Dependencies), I don't know why this is not done.

A similar issue can occur if there are packages that conflict. For example, one package might be installed, and another conflicting one could be installed simultaneously(as a dependency or otherwise).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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