I want to install a list of packages via the command

sudo apt-get install app1 app2 etc

I tried it, but due to a missing package, apt-get doesn't install anything. So I look in depth in man apt-get install and found --fix-missing option! Nevertheless it seems it doesn't work! It says:

E: could not find package xxxxxx 

and it stops.

I need use list option, can't write sudo apt-get install for each package, and even I need to be sure that the script where I want to use this command will install as much as possible packages, don't care if it will miss to install one. Thanks

Pratical example:

cirelli @ asus: /mnt/data/first-boot-master $ sudo apt-get install atom skype
Reading package lists ... Done
Building dependency tree
Reading state information ... Done
E: Could not find skype package

I'm using Ubuntu Gnome 16.04

apt show apt:
Package: apt
Version: 1.2.12~ubuntu16.04.1

P.S.: apt-get man page

  • 1
    What command have you tried exactly and what was the exact error message? Also which release are you on? – heemayl Jul 17 '16 at 11:56
  • cirelli @ asus: / mnt / data / first master-boot-$ sudo apt-get install atom banana Reading package lists ... Done Building dependency tree Reading state information ... Done E: Could not find banana package – Cirelli94 Jul 17 '16 at 12:04
  • 1
    Please edit your question and add these – heemayl Jul 17 '16 at 12:04
  • Skype : Enable Canonical Partners Repository → → ubuntuhandbook.org/index.php/2016/04/… – Knud Larsen Jul 17 '16 at 12:29
  • thanks @KnudLarsen for your comment, anyway it was only an example. – Cirelli94 Jul 17 '16 at 12:36

I don't see any options that make apt (or apt-get) skip a non-existent package and continue installing the others.

However, you could run apt install for every single package in your list separately, that way one non-existent package does not abort installation of the others.

A simple Bash for loop is very useful here:

sudo bash -c 'for pkg in cowsay cowtalk ; do apt install $pkg ; done'

This command executes a for loop in a Bash shell with root privileges. The loop itself runs apt install PACKAGE for every PACKAGE in the list cowsay cowtalk.

While cowsay exists, cowtalk does not. You see the output here:

$ sudo bash -c 'for package in cowsay cowtalk ; do apt install $package ; done'
[sudo] password for bytecommander: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
The following NEW packages will be installed
  cowsay cowsay-off
0 to upgrade, 2 to newly install, 0 to remove and 0 not to upgrade.
Need to get 21,7 kB of archives.
After this operation, 112 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ftp.uni-stuttgart.de/ubuntu xenial/universe amd64 cowsay all 3.03+dfsg1-15 [18,0 kB]
Get:2 http://ftp.uni-stuttgart.de/ubuntu xenial/universe amd64 cowsay-off all 3.03+dfsg1-15 [3.640 B]
Fetched 21,7 kB in 0s (117 kB/s)      
Selecting previously unselected package cowsay.
(Reading database ... 304276 files and directories currently installed.)
Preparing to unpack .../cowsay_3.03+dfsg1-15_all.deb ...
Unpacking cowsay (3.03+dfsg1-15) ...
Selecting previously unselected package cowsay-off.
Preparing to unpack .../cowsay-off_3.03+dfsg1-15_all.deb ...
Unpacking cowsay-off (3.03+dfsg1-15) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up cowsay (3.03+dfsg1-15) ...
Setting up cowsay-off (3.03+dfsg1-15) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package cowtalk
  • I found: -m, --ignore-missing, --fix-missing Ignore missing packages. If packages cannot be retrieved or fail the integrity check after retrieval (corrupted package files), hold back those packages and handle the result. Use of this option together with -f may produce an error in some situations. If a package is selected for installation (particularly if it is mentioned on the command-line) and it could not be downloaded then it will be silently held back. I thought this would work! – Cirelli94 Jul 17 '16 at 13:29
  • 1
    @FabrizioCirelli I tested that argument too, but it seems that applies only on missing dependency packages, not on explicitly mentioned packages. – Byte Commander Jul 17 '16 at 13:31

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.