Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having a reoccurring issue when sometimes build-essential isn't available while trying to setup ubuntu 12.04.2 on AWS (using ubuntu provided ami: ami-ce7b6fba).

Script that sets up the instance:

set -o xtrace
set -e

sudo apt-get update
sudo apt-get -y install build-essential

The fairly annoying bit is that it sometimes works. I have tried to add the eu-west-1 ubuntu mirror, but that didn't solve the issue.

Any ideas?

The output:

amazon-ebs: ++ set -e
amazon-ebs: ++ sudo apt-get update
amazon-ebs: Get:1 http://security.ubuntu.com precise-security Release.gpg [198 B]
amazon-ebs: Hit http://archive.ubuntu.com precise Release.gpg
amazon-ebs: Get:2 http://security.ubuntu.com precise-security Release [49.6 kB]
amazon-ebs: Get:3 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
amazon-ebs: Hit http://archive.ubuntu.com precise Release
amazon-ebs: Get:4 http://archive.ubuntu.com precise-updates Release [49.6 kB]
amazon-ebs: Hit http://archive.ubuntu.com precise/main amd64 Packages
amazon-ebs: Get:5 http://security.ubuntu.com precise-security/main amd64 Packages [309 kB]
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/universe amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/main i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/universe i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/main TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/universe TranslationIndex
amazon-ebs: Get:6 http://security.ubuntu.com precise-security/restricted amd64 Packages [4627 B]
amazon-ebs: Get:7 http://archive.ubuntu.com precise-updates/main amd64 Packages [677 kB]
amazon-ebs: Get:8 http://security.ubuntu.com precise-security/universe amd64 Packages [80.9 kB]
amazon-ebs: Get:9 http://security.ubuntu.com precise-security/multiverse amd64 Packages [2442 B]
amazon-ebs: Get:10 http://security.ubuntu.com precise-security/main i386 Packages [325 kB]
amazon-ebs: Get:11 http://security.ubuntu.com precise-security/restricted i386 Packages [4620 B]
amazon-ebs: Get:12 http://security.ubuntu.com precise-security/universe i386 Packages [84.1 kB]
amazon-ebs: Get:13 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [11.5 kB]
amazon-ebs: Get:14 http://security.ubuntu.com precise-security/multiverse i386 Packages [2633 B]
amazon-ebs: Get:15 http://archive.ubuntu.com precise-updates/universe amd64 Packages [211 kB]
amazon-ebs: Get:16 http://security.ubuntu.com precise-security/main TranslationIndex [74 B]
amazon-ebs: Get:17 http://security.ubuntu.com precise-security/multiverse TranslationIndex [72 B]
amazon-ebs: Get:18 http://archive.ubuntu.com precise-updates/multiverse amd64 Packages [13.8 kB]
amazon-ebs: Get:19 http://security.ubuntu.com precise-security/restricted TranslationIndex [72 B]
amazon-ebs: Get:20 http://archive.ubuntu.com precise-updates/main i386 Packages [698 kB]
amazon-ebs: Get:21 http://security.ubuntu.com precise-security/universe TranslationIndex [73 B]
amazon-ebs: Get:22 http://security.ubuntu.com precise-security/main Translation-en [149 kB]
amazon-ebs: Get:23 http://archive.ubuntu.com precise-updates/restricted i386 Packages [11.4 kB]
amazon-ebs: Get:24 http://archive.ubuntu.com precise-updates/universe i386 Packages [215 kB]
amazon-ebs: Get:25 http://security.ubuntu.com precise-security/multiverse Translation-en [1299 B]
amazon-ebs: Get:26 http://archive.ubuntu.com precise-updates/multiverse i386 Packages [14.0 kB]
amazon-ebs: Hit http://security.ubuntu.com precise-security/restricted Translation-en
amazon-ebs: Get:27 http://archive.ubuntu.com precise-updates/main TranslationIndex [3564 B]
amazon-ebs: Get:28 http://security.ubuntu.com precise-security/universe Translation-en [51.8 kB]
amazon-ebs: Get:29 http://archive.ubuntu.com precise-updates/multiverse TranslationIndex [2605 B]
amazon-ebs: Get:30 http://archive.ubuntu.com precise-updates/restricted TranslationIndex [2461 B]
amazon-ebs: Get:31 http://archive.ubuntu.com precise-updates/universe TranslationIndex [2850 B]
amazon-ebs: Get:32 http://archive.ubuntu.com precise/main Translation-en [726 kB]
amazon-ebs: Get:33 http://archive.ubuntu.com precise/multiverse Translation-en [93.4 kB]
amazon-ebs: Get:34 http://archive.ubuntu.com precise/restricted Translation-en [2395 B]
amazon-ebs: Get:35 http://archive.ubuntu.com precise/universe Translation-en [3341 kB]
amazon-ebs: Get:36 http://archive.ubuntu.com precise-updates/main Translation-en [306 kB]
amazon-ebs: Get:37 http://archive.ubuntu.com precise-updates/multiverse Translation-en [8064 B]
amazon-ebs: Get:38 http://archive.ubuntu.com precise-updates/restricted Translation-en [2637 B]
amazon-ebs: Get:39 http://archive.ubuntu.com precise-updates/universe Translation-en [125 kB]
amazon-ebs: Fetched 7582 kB in 8s (930 kB/s)
amazon-ebs: Reading package lists... Done
amazon-ebs: ++ sudo apt-get -y install build-essential
amazon-ebs: Reading package lists... Done
amazon-ebs: Building dependency tree
amazon-ebs: Reading state information... Done
amazon-ebs: Package build-essential is not available, but is referred to by another package.
amazon-ebs: This may mean that the package is missing, has been obsoleted, or
amazon-ebs: is only available from another source
amazon-ebs:
amazon-ebs: E: Package 'build-essential' has no installation candidate

And when it works:

amazon-ebs: ++ set -e
amazon-ebs: ++ sudo apt-get update
amazon-ebs: Get:1 http://security.ubuntu.com precise-security Release.gpg [198 B]
amazon-ebs: Hit http://archive.ubuntu.com precise Release.gpg
amazon-ebs: Get:2 http://security.ubuntu.com precise-security Release [49.6 kB]
amazon-ebs: Get:3 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
amazon-ebs: Hit http://archive.ubuntu.com precise Release
amazon-ebs: Get:4 http://archive.ubuntu.com precise-updates Release [49.6 kB]
amazon-ebs: Hit http://archive.ubuntu.com precise/main amd64 Packages
amazon-ebs: Get:5 http://security.ubuntu.com precise-security/main amd64 Packages [309 kB]
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/universe amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse amd64 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/main i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/universe i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse i386 Packages
amazon-ebs: Hit http://archive.ubuntu.com precise/main TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted TranslationIndex
amazon-ebs: Hit http://archive.ubuntu.com precise/universe TranslationIndex
amazon-ebs: Get:6 http://archive.ubuntu.com precise-updates/main amd64 Packages [677 kB]
amazon-ebs: Get:7 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [11.5 kB]
amazon-ebs: Get:8 http://archive.ubuntu.com precise-updates/universe amd64 Packages [211 kB]
amazon-ebs: Get:9 http://archive.ubuntu.com precise-updates/multiverse amd64 Packages [13.8 kB]
amazon-ebs: Get:10 http://archive.ubuntu.com precise-updates/main i386 Packages [698 kB]
amazon-ebs: Get:11 http://security.ubuntu.com precise-security/restricted amd64 Packages [4627 B]
amazon-ebs: Get:12 http://security.ubuntu.com precise-security/universe amd64 Packages [80.9 kB]
amazon-ebs: Get:13 http://security.ubuntu.com precise-security/multiverse amd64 Packages [2442 B]
amazon-ebs: Get:14 http://security.ubuntu.com precise-security/main i386 Packages [325 kB]
amazon-ebs: Get:15 http://archive.ubuntu.com precise-updates/restricted i386 Packages [11.4 kB]
amazon-ebs: Get:16 http://archive.ubuntu.com precise-updates/universe i386 Packages [215 kB]
amazon-ebs: Get:17 http://security.ubuntu.com precise-security/restricted i386 Packages [4620 B]
amazon-ebs: Get:18 http://security.ubuntu.com precise-security/universe i386 Packages [84.1 kB]
amazon-ebs: Get:19 http://archive.ubuntu.com precise-updates/multiverse i386 Packages [14.0 kB]
amazon-ebs: Get:20 http://security.ubuntu.com precise-security/multiverse i386 Packages [2633 B]
amazon-ebs: Get:21 http://security.ubuntu.com precise-security/main TranslationIndex [74 B]
amazon-ebs: Get:22 http://security.ubuntu.com precise-security/multiverse TranslationIndex [72 B]
amazon-ebs: Get:23 http://archive.ubuntu.com precise-updates/main TranslationIndex [3564 B]
amazon-ebs: Get:24 http://security.ubuntu.com precise-security/restricted TranslationIndex [72 B]
amazon-ebs: Get:25 http://archive.ubuntu.com precise-updates/multiverse TranslationIndex [2605 B]
amazon-ebs: Get:26 http://security.ubuntu.com precise-security/universe TranslationIndex [73 B]
amazon-ebs: Get:27 http://archive.ubuntu.com precise-updates/restricted TranslationIndex [2461 B]
amazon-ebs: Get:28 http://security.ubuntu.com precise-security/main Translation-en [149 kB]
amazon-ebs: Get:29 http://archive.ubuntu.com precise-updates/universe TranslationIndex [2850 B]
amazon-ebs: Hit http://archive.ubuntu.com precise/main Translation-en
amazon-ebs: Hit http://archive.ubuntu.com precise/multiverse Translation-en
amazon-ebs: Hit http://archive.ubuntu.com precise/restricted Translation-en
amazon-ebs: Get:30 http://security.ubuntu.com precise-security/multiverse Translation-en [1299 B]
amazon-ebs: Hit http://security.ubuntu.com precise-security/restricted Translation-en
amazon-ebs: Hit http://archive.ubuntu.com precise/universe Translation-en
amazon-ebs: Get:31 http://security.ubuntu.com precise-security/universe Translation-en [51.8 kB]
amazon-ebs: Get:32 http://archive.ubuntu.com precise-updates/main Translation-en [306 kB]
amazon-ebs: Get:33 http://archive.ubuntu.com precise-updates/multiverse Translation-en [8064 B]
amazon-ebs: Get:34 http://archive.ubuntu.com precise-updates/restricted Translation-en [2637 B]
amazon-ebs: Get:35 http://archive.ubuntu.com precise-updates/universe Translation-en [125 kB]
amazon-ebs: Fetched 3420 kB in 2s (1637 kB/s)
amazon-ebs: Reading package lists... Done
amazon-ebs: ++ sudo apt-get -y install build-essential
amazon-ebs: Reading package lists... Done
amazon-ebs: Building dependency tree
amazon-ebs: Reading state information... Done
amazon-ebs: The following extra packages will be installed:
amazon-ebs: binutils cpp cpp-4.6 dpkg-dev
amazon-ebs: fakeroot g++ g++-4.6 gcc gcc-4.6
amazon-ebs: libalgorithm-diff-perl
amazon-ebs: libalgorithm-diff-xs-perl
amazon-ebs: libalgorithm-merge-perl libc-bin
amazon-ebs: libc-dev-bin libc6 libc6-dev
amazon-ebs: libdpkg-perl libgomp1 libmpc2
amazon-ebs: libmpfr4 libquadmath0
amazon-ebs: libstdc++6-4.6-dev linux-libc-dev
amazon-ebs: make manpages-dev
amazon-ebs: Suggested packages:
amazon-ebs: binutils-doc cpp-doc gcc-4.6-locales
amazon-ebs: debian-keyring g++-multilib
amazon-ebs: g++-4.6-multilib gcc-4.6-doc
amazon-ebs: libstdc++6-4.6-dbg gcc-multilib
amazon-ebs: autoconf automake1.9 libtool flex
amazon-ebs: bison gdb gcc-doc gcc-4.6-multilib
amazon-ebs: libmudflap0-4.6-dev libgcc1-dbg
amazon-ebs: libgomp1-dbg libquadmath0-dbg
amazon-ebs: libmudflap0-dbg binutils-gold
amazon-ebs: glibc-doc libstdc++6-4.6-doc
amazon-ebs: make-doc
amazon-ebs: The following NEW packages will be installed:
amazon-ebs: binutils build-essential cpp cpp-4.6
amazon-ebs: dpkg-dev fakeroot g++ g++-4.6 gcc
amazon-ebs: gcc-4.6 libalgorithm-diff-perl
amazon-ebs: libalgorithm-diff-xs-perl
amazon-ebs: libalgorithm-merge-perl libc-dev-bin
amazon-ebs: libc6-dev libdpkg-perl libgomp1
amazon-ebs: libmpc2 libmpfr4 libquadmath0
amazon-ebs: libstdc++6-4.6-dev linux-libc-dev
amazon-ebs: make manpages-dev
amazon-ebs: The following packages will be upgraded:
amazon-ebs: libc-bin libc6
amazon-ebs: 2 upgraded, 24 newly installed, 0 to remove and 76 not upgraded

When it doesn't work, sudo wc -l /var/lib/dpkg/available returns:

9280 /var/lib/dpkg/available
share|improve this question
    
What is the size of your /var/lib/dpkg/available file on the two systems? Or perhaps what is the number of lines in each. wc -l /var/lib/dpkg/available –  Zoredache Aug 22 '13 at 17:24

1 Answer 1

up vote 1 down vote accepted

Ah, figured it out.

apt-get dist-upgrade
apt-get update
apt-get install build-essential

Fixed the issue.

share|improve this answer

Your Answer

 
discard

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.