31

I was wondering why the software center doesn't download all the requested apps and install one by one as they finish to download. Or instead why the software center doesn't download an app while the other is installing

6
  • probably just to save bandwidth...
    – drnessie
    Sep 16, 2011 at 19:05
  • 1
    AFAIK sudo apt-get install can install as many packages as you want. You need to know the package name. May 26, 2012 at 9:43
  • 1
    @drnessie no it's not! if you install both at the same time with apt-get you will download them at the same time and then install them just one at the time.
    – Alvar
    May 26, 2012 at 11:18
  • @Alvar Ok. I have done that in Linux Mint. But trying the same in Ubuntu doesn't work. How to do?
    – MycrofD
    Oct 12, 2014 at 4:47
  • @MycrofD And what are you trying?
    – Alvar
    Oct 12, 2014 at 10:05

7 Answers 7

30

That is a good question. It is because it's based on the same package tools that apt-get and others use. These are designed in a way that expects you to provide all the packages to be installed, and then the rest is automatic. This is very good in most cases, but for the Software Center, it causes some issues. You would either need to first select the packages you want to install and then click a button to actually download and install them, or you have to queue applications and then download and install one by one. This provides a much better user experience if you're installing one application than having to use those extra clicks, but it is also annoying when you're "shopping".

It is possible to fix this, so I expect that in the future, this will be remedied, but it does mean recreating or rewriting existing tools, so I don't think it'll have very high priority.

Let me elaborate:

A package may depend on other packages. If these packages aren't available, then the package cannot be installed. So tools like apt-get will first download all the packages you ask for and all the packages they depend on, etc, and then install all of them. So you would then normally provide all the packages you wanted in one go, and they would first be downloaded and then installed.

When you choose to install an application in the software center, you'll usually want it to start downloading and installing immediately. But in order to ensure that everything is in order, only one installation can be done at any one time. That's why when you install an application, you have to wait until that application is completely downloaded and installed before the next download and install can begin.

This could be fixed by not using apt-get to install the packages, but instead downloading the packages manually and then using dpkg to install them once they're ready. You still wouldn't be able to install two packages simultaneously, but you would be able to start downloading new packages while the previously started installations were finishing. In some cases, that would save quite some time, so it is a good idea. But in most cases, it wouldn't really matter so the effort is better focused elsewhere.

3
  • Actually, apt-get can download packages without installing them, although I'm not 100% sure that works with a locked database...
    – JanC
    Feb 11, 2012 at 23:43
  • simultaneous downloading and perhaps installation works in Linux Mint. It doesn't in Ubuntu.
    – MycrofD
    Oct 12, 2014 at 4:45
  • 2
    @MycrofD: I don't really know what the point of that comment was supposed to be. Sure you can download multiple packages at a time with Ubuntu. You just can't do that with apt-get and tools based on it. That's obviously regardless of which distro you're talking about. Oct 18, 2014 at 23:52
11

you can only install one package at the time with sudo apt-get install, but you can install several packages with one command. Like this:

  • sudo apt-get install ubuntu-desktop lubuntu-desktop

This will install both ubuntu-desktop and lubuntu-desktop and whatever dependencies they require, in the correct sequence.

Also when you update your system with sudo apt-get upgrade, you first download all the software and then install one package at the time.

The reason
Why you can't install several packages at once is that only one instance can use the apt-get privileges at the same time. This is because apt-get locks on the software sources and blocks any other command from using them.

An example
Let's say that you somehow starts 2 separate apt-get as @Rinzwind says, then you could in theory at least edit the source list at same time as you use it to find and install new software. This could lead to that a program that you've installed edits the source list and adds an unsafe repository at the same time as you are upgrading your system. This could be a security issue.

Another example
Also if you edit the source list at 2 separate commands then when you save you would replace the newest version, which will be the one that it's save last. Which means that command in the middle wouldn't have any effect, since you would save over an old version.


Windows behaves similarly using the "official" (MSI) installer

Even in Windows,multiple softwares can be installed simultaneously ... is there an advantage in this or why this is a necessity in linux/ubuntu,etc...

Packages that use the official Windows installer (MSI) WILL REFUSE to run more than one instance at a time. That's because the MSI installer database is similar to sources.list, dpkg info files, etc. -- you don't want more than one installer modifying/locking them at a time.

But a lot of Windows packages use third-party installers like Installshield, NSIS, etc. which will run alongside each other because they do not need to access/modify the MSI database. Similarly, in Linux/Ubuntu, no one's stopping you from running an apt-get, a tar -xzf and a perl/bash install script all at the same time :)

6
  • 1
    If I'm not wrong, many applications can be run using sudo at the same time, but when it comes to package management, only one such app can install or remove packages at a given time, since running apt gets a lock on sources.list and hence if any other package managing app is tried to run, it'll not get lock on that file and hence will not run.
    – Kushal
    May 26, 2012 at 10:23
  • @Kush it's apt-get only one can use, sorry, was a long time since I got that error.
    – Alvar
    May 26, 2012 at 10:31
  • @Rinzwind is this what you mean? :)
    – Alvar
    May 26, 2012 at 12:10
  • 2
    @Alvar: edited to include similar Windows behavior at the bottom: don't want folks to get misinformed that Windows is somehow "superior" ;)
    – ish
    May 26, 2012 at 12:23
  • 1
    @Alvar...Thanx a lot.!! That cleard my basics.. ;)
    – Nirmik
    May 26, 2012 at 13:42
7

First, let it be known that this answer is from what I've gleaned from my experiences with dpkg and apt. I haven't looked at the actual software center code to determine this.

It's a limit of the design of the underlying software.

Part of the dpkg system that Ubuntu uses for packages includes a feature that "locks" the /var/lib/dpkg/lock file to prevent multiple dpkg (apt-get and Ubuntu Software Center are front ends) from overwriting itself and other bad, evil things.

What happens when you install software? What happens is it starts sudo apt-get install chromium-browser (to use Chromium as an example).

And when that happens, a lock kicks in. Once you add more than one package to be installed, what happens next is it waits until the first one is done before it starts the next apt command.

4

Some actions, like refreshing the menu's, indexing fonts and reconfiguring the libraries need to happen only once if all packages are installed at the same time. A second advantage hopefully shouldn't happen often, but if you want to install packages which exclude eachother you know it prior to downloading all of them.

A last advantage is mostly important when you install or upgrade many packages at once: if questions have to be answered, they will all come after eachother during the install progress. So you can keep working instead of being bugged every 5 minutes by a different question.

1
2

The reason that two instances of apt-get cannot operate simultaneously is because the application is reading/writing several files critical for the system operation. Reading or writing a file by an apt-get operation, while another is performing the same operations on it will lead to problems of bad configuration and/or damage of the files. So when an apt-get operation occurs, it "locks" the files it needs so another operation cannot be executed simultaneously, a.k.a. it raises a flag that tells the other operations that the files are currently in use.

However, simultaneous downloads of the files needed by apt (or rather download from a number of sources) are possible with the command apt-fast

https://github.com/ilikenwf/apt-fast

0

simple way to installing several file in one time, follow these steps

  1. copy all the installation folder, for example : /home/user/apps
  2. Open terminal and Type :

    CD /home/user/apps

  3. and then type again

    sudo dpkg -i *.deb

wait untill the installation finish.

1
  • 1
    That still installs the .deb files one-by-one. Not what the OP asked -- he wants multiple .deb files installing simultaneously.
    – ish
    May 26, 2012 at 12:29
-1

you get download the package whilst the other is installing e.g in terminal1

sudo apt-get install vlc

then also download another package in another terminal2

sudo apt-get download openssh-server

to see other options available with apt-get refer to its man simple type

apt-get <press tab on your keyboard>
2
  • This doesn't answer the question.
    – guntbert
    Mar 6, 2015 at 22:08
  • @guntbert i was answering the second part of his question, he says " Or instead why the software center doesn't download an app while the other is installing", i figured he was asserting that it is not possible to download another package whilst installing another which is wrong.
    – marengz
    Mar 6, 2015 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .