apt-get reporta “nenhum candidato de instalação” aleatoriamente sem uma boa razão

1

Quando provisiono as caixas do Ubuntu 14.04 no Amazon AWS, começo com uma AMI oficial da Canonical (especificamente ami-f0c52390 ), inicio a instância e executo um script de provisionamento. Uma das primeiras coisas que o script faz é:

sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
sudo apt-get update
sudo apt-get -y install python-dev python-virtualenv ruby

Na maioria das vezes isso funciona muito bem. Às vezes, talvez, 1 em 10 vezes, o apt-get install falhará com o seguinte:

$ sudo apt-get -y install python-dev python-virtualenv ruby
Reading package lists...
Building dependency tree...
Reading state information...
Package python-virtualenv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package ruby is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python

E: Package 'python-dev' has no installation candidate
E: Package 'python-virtualenv' has no installation candidate
E: Package 'ruby' has no installation candidate

Se eu termino a instância e inicio uma nova - a mesma AMI, as mesmas fontes apt, o mesmo script, mesmo tudo , normalmente funcionará na próxima vez que eu tentar.

Normalmente, eu posso dizer que a instalação falhará assistindo a saída de apt-get update . Os espelhos usados são distintamente diferentes entre corridas bem e mal sucedidas.

BOM:

$ sudo apt-get update
Ign http://us-west-2.ec2.archive.ubuntu.com trusty InRelease
Get:1 http://us-west-2.ec2.archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://us-west-2.ec2.archive.ubuntu.com trusty-backports InRelease [65.9 kB]
Hit http://us-west-2.ec2.archive.ubuntu.com trusty Release.gpg
Hit http://security.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty InRelease
Get:3 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main Sources [262 kB]
Get:4 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/restricted Sources [5,352 B]
Get:5 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:6 http://security.ubuntu.com trusty-security/main Sources [106 kB]
Get:7 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe Sources [151 kB]
Get:8 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/multiverse Sources [5,946 B]
Get:9 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main amd64 Packages [713 kB]
Get:10 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:11 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.9 kB]
Get:12 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe amd64 Packages [339 kB]
Get:13 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/multiverse amd64 Packages [13.2 kB]
Get:14 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main Translation-en [361 kB]
Get:15 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/multiverse Translation-en [7,227 B]
Get:16 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/restricted Translation-en [3,699 B]
Get:17 https://deb.nodesource.com trusty InRelease
Get:18 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe Translation-en [182 kB]
Get:19 https://deb.nodesource.com trusty/main amd64 Packages
Get:20 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/main Sources [8,661 B]
Get:21 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/restricted Sources [28 B]
Get:22 https://deb.nodesource.com trusty/main Translation-en_US
Get:23 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/universe Sources [34.0 kB]
Get:24 http://archive.ubuntu.com trusty/main amd64 Packages [1,350 kB]
Get:25 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/multiverse Sources [1,898 B]
Get:26 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/main amd64 Packages [9,787 B]
Get:27 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/restricted amd64 Packages [28 B]
Get:28 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/universe amd64 Packages [40.9 kB]
Get:29 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/multiverse amd64 Packages [1,571 B]
Get:30 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/main Translation-en [5,843 B]
Get:31 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/multiverse Translation-en [1,215 B]
Ign https://deb.nodesource.com trusty/main Translation-en_US
Get:32 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/restricted Translation-en [28 B]
Get:33 http://us-west-2.ec2.archive.ubuntu.com trusty-backports/universe Translation-en [35.5 kB]
Ign https://deb.nodesource.com trusty/main Translation-en
Hit http://us-west-2.ec2.archive.ubuntu.com trusty Release
Get:34 http://us-west-2.ec2.archive.ubuntu.com trusty/main Sources [1,064 kB]
Get:35 http://us-west-2.ec2.archive.ubuntu.com trusty/restricted Sources [5,433 B]
Get:36 http://us-west-2.ec2.archive.ubuntu.com trusty/universe Sources [6,399 kB]
Get:37 http://security.ubuntu.com trusty-security/universe Sources [34.0 kB]
Get:38 http://us-west-2.ec2.archive.ubuntu.com trusty/multiverse Sources [174 kB]
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/main amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://us-west-2.ec2.archive.ubuntu.com trusty/universe Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://us-west-2.ec2.archive.ubuntu.com trusty/main Translation-en_US
Ign http://us-west-2.ec2.archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://us-west-2.ec2.archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://us-west-2.ec2.archive.ubuntu.com trusty/universe Translation-en_US
Get:39 http://archive.ubuntu.com trusty/universe amd64 Packages [5,859 kB]
Get:40 http://archive.ubuntu.com trusty/restricted amd64 Packages [13.0 kB]
Get:41 http://archive.ubuntu.com trusty/multiverse amd64 Packages [132 kB]
Get:42 http://archive.ubuntu.com trusty/main Translation-en [762 kB]
Get:43 http://archive.ubuntu.com trusty/multiverse Translation-en [102 kB]
Get:44 http://archive.ubuntu.com trusty/restricted Translation-en [3,457 B]
Get:45 http://archive.ubuntu.com trusty/universe Translation-en [4,089 kB]
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://archive.ubuntu.com trusty/universe Translation-en_US
Fetched 22.5 MB in 1min 36s (234 kB/s)

BAD:

$ sudo apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Get:3 https://deb.nodesource.com trusty InRelease
Get:4 https://deb.nodesource.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty Release.gpg
Get:5 https://deb.nodesource.com trusty/main Translation-en
Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [713 kB]
Ign https://deb.nodesource.com trusty/main Translation-en
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.9 kB]
Get:8 http://security.ubuntu.com trusty-security/main amd64 Packages [431 kB]
Get:9 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [339 kB]
Get:10 http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages [13.2 kB]
Get:11 http://archive.ubuntu.com trusty-updates/main Translation-en [361 kB]
Get:12 http://archive.ubuntu.com trusty-updates/multiverse Translation-en [7227 B]
Get:13 http://archive.ubuntu.com trusty-updates/restricted Translation-en [3699 B]
Get:14 http://archive.ubuntu.com trusty-updates/universe Translation-en [182 kB]
Get:15 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:16 http://archive.ubuntu.com trusty/multiverse amd64 Packages [132 kB]
Get:17 http://security.ubuntu.com trusty-security/restricted amd64 Packages [13.0 kB]
Get:18 http://archive.ubuntu.com trusty/restricted amd64 Packages [13.0 kB]
Get:19 http://security.ubuntu.com trusty-security/universe amd64 Packages [125 kB]
Get:20 http://archive.ubuntu.com trusty/universe amd64 Packages [5859 kB]
Get:21 http://security.ubuntu.com trusty-security/multiverse amd64 Packages [4991 B]
Get:22 http://security.ubuntu.com trusty-security/main Translation-en [236 kB]
Get:23 http://security.ubuntu.com trusty-security/multiverse Translation-en [2570 B]
Get:24 http://security.ubuntu.com trusty-security/restricted Translation-en [3206 B]
Get:25 http://archive.ubuntu.com trusty/main amd64 Packages [1350 kB]
Get:26 http://security.ubuntu.com trusty-security/universe Translation-en [73.8 kB]
Get:27 http://archive.ubuntu.com trusty/main Translation-en [762 kB]
Get:28 http://archive.ubuntu.com trusty/multiverse Translation-en [102 kB]
Get:29 http://archive.ubuntu.com trusty/restricted Translation-en [3457 B]
Get:30 http://archive.ubuntu.com trusty/universe Translation-en [4089 kB]
Fetched 15.0 MB in 8s (1814 kB/s)

O que está acontecendo aqui? Eu estou às vezes batendo em um espelho ruim? A rede da instância não poderia estar totalmente ativada ou algo assim? Por que o comportamento não é determinístico e sempre pode ser corrigido simplesmente tentando o script novamente em uma nova instância?

    
por smitelli 13.03.2016 / 23:18

0 respostas