I tried to install two programs at once in Ubuntu via terminal. it says this.

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

Could not get lock: why does /var/lib/apt/lists/lock need to be locked?

I'm so glad if anyone can explain the application installation process for me. Also something about advantages and disadvantages of using a package manager like "apt" compared to the package manager in MS windows.

  • possible duplicate of Could not get lock /var/lib/apt/lists/lock apt simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code. Wikipedia ... instead of search for untrusted software, install untrusted software in Windows. – karel Dec 4 '14 at 15:21
  • 2
    Well, if you have ever used an MSI installer in Windows, you'd know that it too can only install one thing at a time. – muru Dec 4 '14 at 18:33
  • 1
    "consider to package manager in MS windows." ehm Windows package manager also only installs one at a time ;) And the reason "apt-get" only installs one at a time is because nobody wants their system to get corrupted :) – Rinzwind Dec 4 '14 at 18:38
  • 1
    Now that I think of it, every package manager I have encountered (dpkg, pacman, yum, the Windows thing, the Google Play Store) installs only one app at a time. More annoyingly, most of them even download only one app at a time. – muru Dec 4 '14 at 18:40

This can mean that other software, for example the Software Center, is doing something related to installing software. To avoid problems the currently active program has aquired a lock to ensure no other process can interfere (and therefore you get the complaint about could not get lock).

You can solve this by restarting the computer.

And to state the obvious: Did you start the install command with sudo, otherwise it won't work either because installing software is a superuser activity.

Despite the comments on the question you can absolutely install multiple programs at the same time with apt-get.

This command will install three (arbitrary) programs one by one:

apt-get install package1 package2 package3

What you are getting here is not the result of trying two programs simultaneously but to access the underlying database from two different programs - there could be several reasons:

  1. you were starting two software management programs (like Ubuntu Software Center and apt-get or aptitude
  2. you were trying to install a program while a software update was running
  3. one of these programs started with its task and got killed (by whatever) before it could remove the "lock"

What should you do?

case (1): stop one of those programs, always use only one at a time
case (2): wait a few minutes, then try it again case (3): reboot to make sure that none of these programs is actually running, the try again. If it still fails open a terminal CTRL+ALT+T and type sudo rm /var/lib/apt/lists/lock to remove that "stale" lock file.

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.