Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm experiencing a strange issue with a fabric script I'm using to bootstrap a server on EC2.

I launch a stock Ubuntu 12.04 AMI (ami-3d4ff254), wait for it to start, then proceed with:

with settings(host_string="ubuntu@%s" % i.dns_name, 
    sudo('apt-get -qy update')
    sudo('apt-get -qy install --no-install-recommends mdadm') # don't install postfix

The apt-get update appears to run fine and gives no errors, however (2/3 of the time or so) installing mdadm throws a "no installation candidate" error.

When I ssh into the server and run apt-get install mdadm I get the same error. Running apt-get update by hand, then the package installs fine.

Any ideas on what might be happening, or ideas for debugging?

EDIT: It turns out by adding a sleep(10) after the SSH server comes up and before trying apt-get update it works fine. This seems to be an issue with the configuration of apt on this AMI combined with perhaps some strangeness on Amazon's end, or DNS issues.

Here are my entries in /etc/apt/sources.list:

deb precise main
deb-src precise main
deb precise-updates main
deb-src precise-updates main
deb precise universe
deb-src precise universe
deb precise-updates universe
deb-src precise-updates universe
deb precise-security main
deb-src precise-security main
deb precise-security universe
deb-src precise-security universe

Here is the output from the apt-get update that screws up my mdadm install:

Ign precise-security InRelease
Get:1 precise-security Release.gpg [198 B]
Ign precise InRelease
Get:2 precise-security Release [49.6 kB]
Ign precise-updates InRelease
Hit precise Release.gpg
Get:3 precise-updates Release.gpg [198 B]
Hit precise Release
Get:4 precise-security/main amd64 Packages [177 kB]
Get:5 precise-updates Release [49.6 kB]
Hit precise/main amd64 Packages
Hit precise/restricted amd64 Packages
Hit precise/universe amd64 Packages
Hit precise/multiverse amd64 Packages
Hit precise/main i386 Packages
Hit precise/restricted i386 Packages
Hit precise/universe i386 Packages
Hit precise/multiverse i386 Packages
Get:6 precise-security/restricted amd64 Packages [3,969 B]
Hit precise/main TranslationIndex
Get:7 precise-security/universe amd64 Packages [48.6 kB]
Hit precise/multiverse TranslationIndex
Get:8 precise-security/multiverse amd64 Packages [2,188 B]
Get:9 precise-security/main i386 Packages [183 kB]
Hit precise/restricted TranslationIndex
Get:10 precise/universe TranslationIndex [2,922 B]
Get:11 precise-updates/main amd64 Packages [405 kB]
Get:12 precise-security/restricted i386 Packages [3,968 B]
Get:13 precise-security/universe i386 Packages [48.7 kB]
Get:14 precise-security/multiverse i386 Packages [2,357 B]
Get:15 precise-security/main TranslationIndex [73 B]
Get:16 precise-security/multiverse TranslationIndex [71 B]
Get:17 precise-security/restricted TranslationIndex [71 B]
Get:18 precise-security/universe TranslationIndex [73 B]
Get:19 precise-updates/restricted amd64 Packages [8,215 B]
Get:20 precise-updates/universe amd64 Packages [149 kB]
Get:21 precise-security/main Translation-en [86.5 kB]
Get:22 precise-updates/multiverse amd64 Packages [8,948 B]
Hit precise-security/multiverse Translation-en
Get:23 precise-updates/main i386 Packages [410 kB]
Hit precise-security/restricted Translation-en
Get:24 precise-security/universe Translation-en [30.3 kB]
Get:25 precise-updates/restricted i386 Packages [8,218 B]
Get:26 precise-updates/universe i386 Packages [149 kB]
Get:27 precise-updates/multiverse i386 Packages [9,930 B]
Get:28 precise-updates/main TranslationIndex [3,564 B]
Get:29 precise-updates/multiverse TranslationIndex [2,605 B]
Get:30 precise-updates/restricted TranslationIndex [2,461 B]
Get:31 precise-updates/universe TranslationIndex [2,850 B]
Get:32 precise/main Translation-en [726 kB]
Get:33 precise/multiverse Translation-en [93.4 kB]
Get:34 precise/restricted Translation-en [2,395 B]
Get:35 precise/universe Translation-en [3,341 kB]
Get:36 precise-updates/main Translation-en [202 kB]
Get:37 precise-updates/multiverse Translation-en [5,606 B]
Get:38 precise-updates/restricted Translation-en [2,048 B]
Get:39 precise-updates/universe Translation-en [87.4 kB]
Ign precise/main Translation-en_US
Ign precise/multiverse Translation-en_US
Ign precise/restricted Translation-en_US
Fetched 6,308 kB in 8s (786 kB/s)
Reading package lists...

And here's the output for the one that works (i.e. after waiting a few seconds before doing the apt-get update):

Ign precise InRelease
Ign precise-updates InRelease
Get:1 precise Release.gpg [198 B]
Get:2 precise-updates Release.gpg [198 B]
Get:3 precise Release [49.6 kB]
Ign precise-security InRelease
Get:4 precise-updates Release [49.6 kB]
Get:5 precise-security Release.gpg [198 B]
Get:6 precise/main Sources [934 kB]
Get:7 precise-security Release [49.6 kB]
Get:8 precise/universe Sources [5,019 kB]
Get:9 precise/main amd64 Packages [1,273 kB]
Get:10 precise-security/main Sources [50.1 kB]
Get:11 precise/universe amd64 Packages [4,786 kB]
Get:12 precise-security/universe Sources [14.5 kB]
Get:13 precise-security/main amd64 Packages [177 kB]
Get:14 precise/main i386 Packages [1,274 kB]
Get:15 precise-security/universe amd64 Packages [48.6 kB]
Get:16 precise/universe i386 Packages [4,796 kB]
Get:17 precise-security/main i386 Packages [183 kB]
Get:18 precise/main TranslationIndex [3,706 B]
Get:19 precise/universe TranslationIndex [2,922 B]
Get:20 precise-updates/main Sources [178 kB]
Get:21 precise-security/universe i386 Packages [48.7 kB]
Get:22 precise-updates/universe Sources [60.2 kB]
Get:23 precise-security/main TranslationIndex [73 B]
Get:24 precise-updates/main amd64 Packages [405 kB]
Get:25 precise-updates/universe amd64 Packages [149 kB]
Get:26 precise-security/universe TranslationIndex [73 B]
Get:27 precise-security/main Translation-en [86.5 kB]
Get:28 precise-security/universe Translation-en [30.3 kB]
Get:29 precise-updates/main i386 Packages [410 kB]
Get:30 precise-updates/universe i386 Packages [149 kB]
Get:31 precise-updates/main TranslationIndex [3,564 B]
Get:32 precise-updates/universe TranslationIndex [2,850 B]
Get:33 precise/main Translation-en [726 kB]
Get:34 precise/universe Translation-en [3,341 kB]
Get:35 precise-updates/main Translation-en [202 kB]
Get:36 precise-updates/universe Translation-en [87.4 kB]
Fetched 24.6 MB in 12s (1,976 kB/s)
Reading package lists...

I don't know why the former is full of more Hits and Igns.

share|improve this question
up vote 2 down vote accepted

Without some more in-depth testing (which I'm not going to do right now) it's hard to say exactly what is going on, but the general outline is:

When you first start up an Ubuntu cloud instance on EC2, a script runs which customizes it a bit for the EC2 environment. One of the things that happens is that your /etc/apt/sources.list is rewritten to point to Ubuntu mirrors which are themselves hosted in Amazon S3 (which means you pay no bandwidth costs for install/update software).

My guess is that something is subtly different between the Amazon archives and the general archives which causes the strangeness you're seeing; with a bit more testing and poking around you'll probably find out exactly what it is.

My suggestion to make your deployment script work would be to simply wait until all of Ubuntu's initialization stuff is complete before you run your own script.

share|improve this answer
Argh, of course. I now see my failed update is fetching from repos like ""; that aren't even in my source.list (once I check on it). Thanks! – jberryman Oct 22 '12 at 19:57

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.