apt-get сообщает "нет кандидата для установки" в произвольном порядке без веской причины
Когда я поставляю Ubuntu 14.04 в Amazon AWS, я начинаю с официального Canonical AMI (в частности, ami-f0c52390
), загрузите экземпляр и запустите сценарий подготовки. Первое, что делает скрипт, это:
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
Большую часть времени это прекрасно работает. Хотя иногда, может быть, 1 из 10 раз, apt-get install
потерпит неудачу со следующим:
$ 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
Если я прекращаю работу экземпляра и запускаю новый - тот же AMI, те же подходящие источники, тот же сценарий, все то же самое, обычно он будет работать при следующей попытке.
Обычно я могу сказать, что установка не удалась, наблюдая за выводом apt-get update
, Используемые зеркала заметно отличаются между успешными и неудачными запусками.
ХОРОШО:
$ 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)
ПЛОХОЙ:
$ 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)
Что тут происходит? Я иногда бью плохое зеркало? Может ли сеть инстанса работать не полностью или как-то так? Почему поведение недетерминировано и всегда можно исправить, просто попробовав скрипт снова на новом экземпляре?