Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am making a bash script that installs various packages using apt-get install. However, I notice that if there is a line that says:

sudo apt-get install package1 package2 package3

and either of the packages is not found, none of the others will be installed. How do I make it keep going even if it can't find one of the packages?

Thanks in advance.

share|improve this question
up vote 13 down vote accepted

I suggest an apt-get option

sudo apt-get --ignore-missing install $list_of_packages

but be aware that missing dependences cannot be ignored, and even if you use --force you can get a broken system.

share|improve this answer
Thank you! This seems to work. – Hypercube May 20 '11 at 20:57
for i in package1 package2 package3; do
  sudo apt-get install $i
share|improve this answer
A bit brutal performance wise (package dependency tree is being built from the scratch for every iteration), but should work fine. – Serge Broslavsky May 3 '11 at 5:53

Why use a script?
Synaptic will allow multiple package install and will handle all the dependencies. Of course finding a missing package is also covered, if you can't find it you can't select it so no problem.

share|improve this answer
I wanted to use this for a bash script, so Synaptic is not an option. – Hypercube May 20 '11 at 20:58
In the file menu is a "generate package download script" – robin0800 May 21 '11 at 0:13
Thanks, that's useful. However, it seems to only wget the packages, not install them. – Hypercube Jun 5 '11 at 21:41
Yes but did you notice under that menu item the "add download" this uses the above generated script to install the packages. (this info even appears as a pop up) – robin0800 Jun 7 '11 at 13:19

Your Answer


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.