Packer/Amazon EBS/Ubuntu - Inconsistent PPAs

北城以北 提交于 2021-01-29 04:21:06

问题


TL;DR;

Packer is inconsistently ignoring the AWS Ubuntu PPAs, which is breaking my builds. Why?


I have a job in Jenkins that uses Packer's Amazon EBS builder to create an AMI, based on the official Ubuntu 14.04 AMI. For some reason, every so often, the apt-gets that I use in the provisioner fail to use AWS' own PPAs, and only uses those at ubuntu.com:

==> amazon-ebs: Prevalidating AMI Name...
==> amazon-ebs: Inspecting the source AMI...
==> amazon-ebs: Creating temporary keypair: packer xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 22 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
    amazon-ebs: Instance ID: i-xxxxxxx
==> amazon-ebs: Waiting for instance (i-xxxxxxx) to become ready...
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Connected to SSH!
==> amazon-ebs: Provisioning with shell script: /tmp/packer-shellxxxxxxx
    amazon-ebs: Ign http://security.ubuntu.com trusty-security InRelease
    amazon-ebs: Ign http://archive.ubuntu.com trusty InRelease
    amazon-ebs: Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
    amazon-ebs: Ign http://archive.ubuntu.com trusty-updates InRelease
    amazon-ebs: Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
    amazon-ebs: Get:3 http://archive.ubuntu.com trusty Release.gpg [933 B]
    amazon-ebs: Get:4 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
    amazon-ebs: Get:5 http://archive.ubuntu.com trusty Release [58.5 kB]
    amazon-ebs: Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [341 kB]
    amazon-ebs: Get:7 http://archive.ubuntu.com trusty-updates Release [63.5 kB]
    amazon-ebs: Get:8 http://security.ubuntu.com trusty-security/restricted amd64 Packages [8,875 B]
    amazon-ebs: Get:9 http://archive.ubuntu.com trusty/main amd64 Packages [1,350 kB]
    amazon-ebs: Get:10 http://security.ubuntu.com trusty-security/universe amd64 Packages [116 kB]
    amazon-ebs: Get:11 http://security.ubuntu.com trusty-security/multiverse amd64 Packages [3,686 B]
    amazon-ebs: Get:12 http://security.ubuntu.com trusty-security/main Translation-en [186 kB]
    amazon-ebs: Get:13 http://archive.ubuntu.com trusty/restricted amd64 Packages [13.0 kB]
    amazon-ebs: Get:14 http://archive.ubuntu.com trusty/universe amd64 Packages [5,859 kB]
    amazon-ebs: Get:15 http://security.ubuntu.com trusty-security/multiverse Translation-en [1,679 B]
    amazon-ebs: Hit http://security.ubuntu.com trusty-security/restricted Translation-en
    amazon-ebs: Get:16 http://security.ubuntu.com trusty-security/universe Translation-en [67.8 kB]
    amazon-ebs: Get:17 http://archive.ubuntu.com trusty/multiverse amd64 Packages [132 kB]
    amazon-ebs: Get:18 http://archive.ubuntu.com trusty/main Translation-en [762 kB]
    amazon-ebs: Get:19 http://archive.ubuntu.com trusty/multiverse Translation-en [102 kB]
    amazon-ebs: Get:20 http://archive.ubuntu.com trusty/restricted Translation-en [3,457 B]
    amazon-ebs: Get:21 http://archive.ubuntu.com trusty/universe Translation-en [4,089 kB]
    amazon-ebs: Get:22 http://archive.ubuntu.com trusty-updates/main amd64 Packages [618 kB]
    amazon-ebs: Get:23 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.4 kB]
    amazon-ebs: Get:24 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [312 kB]
    amazon-ebs: Get:25 http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages [11.9 kB]
    amazon-ebs: Get:26 http://archive.ubuntu.com trusty-updates/main Translation-en [299 kB]
    amazon-ebs: Get:27 http://archive.ubuntu.com trusty-updates/multiverse Translation-en [6,148 B]
    amazon-ebs: Get:28 http://archive.ubuntu.com trusty-updates/restricted Translation-en [3,560 B]
    amazon-ebs: Get:29 http://archive.ubuntu.com trusty-updates/universe Translation-en [166 kB]
    amazon-ebs: Ign http://archive.ubuntu.com trusty/main Translation-en_US
    amazon-ebs: Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
    amazon-ebs: Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
    amazon-ebs: Ign http://archive.ubuntu.com trusty/universe Translation-en_US
    amazon-ebs: Fetched 14.7 MB in 18s (781 kB/s)
    amazon-ebs: Reading package lists...
    amazon-ebs: Reading package lists...
    amazon-ebs: Building dependency tree...
    amazon-ebs: Reading state information...
    amazon-ebs: The following extra packages will be installed:
    amazon-ebs: libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7-minimal
    amazon-ebs: Suggested packages:
    amazon-ebs: python2.7-doc binutils binfmt-support
    amazon-ebs: The following packages will be upgraded:
    amazon-ebs: libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7
    amazon-ebs: python2.7-minimal
    amazon-ebs: 5 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.
    amazon-ebs: Need to get 4,597 kB of archives.
    amazon-ebs: After this operation, 13.3 kB disk space will be freed.
    amazon-ebs: Get:1 http://security.ubuntu.com/ubuntu/ trusty-security/main python2.7 amd64 2.7.6-8ubuntu0.2 [196 kB]
    amazon-ebs: Get:2 http://security.ubuntu.com/ubuntu/ trusty-security/main libpython2.7 amd64 2.7.6-8ubuntu0.2 [1,039 kB]
    amazon-ebs: Get:3 http://security.ubuntu.com/ubuntu/ trusty-security/main libpython2.7-stdlib amd64 2.7.6-8ubuntu0.2 [1,869 kB]
    amazon-ebs: Get:4 http://security.ubuntu.com/ubuntu/ trusty-security/main python2.7-minimal amd64 2.7.6-8ubuntu0.2 [1,185 kB]
    amazon-ebs: Get:5 http://security.ubuntu.com/ubuntu/ trusty-security/main libpython2.7-minimal amd64 2.7.6-8ubuntu0.2 [308 kB]
    amazon-ebs: debconf: unable to initialize frontend: Dialog
    amazon-ebs: debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
    amazon-ebs: debconf: falling back to frontend: Readline
    amazon-ebs: debconf: unable to initialize frontend: Readline
    amazon-ebs: debconf: (This frontend requires a controlling tty.)
    amazon-ebs: debconf: falling back to frontend: Teletype
    amazon-ebs: dpkg-preconfigure: unable to re-open stdin:
    amazon-ebs: Fetched 4,597 kB in 7s (595 kB/s)
    amazon-ebs: (Reading database ... 51120 files and directories currently installed.)
    amazon-ebs: Preparing to unpack .../python2.7_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking python2.7 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7-stdlib_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../python2.7-minimal_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking python2.7-minimal (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7-minimal_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    amazon-ebs: Processing triggers for mime-support (3.54ubuntu1.1) ...
    amazon-ebs: Setting up libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up python2.7-minimal (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up python2.7 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up libpython2.7:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
    amazon-ebs: Reading package lists...
    amazon-ebs: Building dependency tree...
    amazon-ebs: Reading state information...
    amazon-ebs: E: Unable to locate package python-pip
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: No AMIs to cleanup
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Script exited with non-zero exit status: 100    

It successfully builds when it correctly uses the AWS PPAs.

==> amazon-ebs: Prevalidating AMI Name...
==> amazon-ebs: Inspecting the source AMI...
==> amazon-ebs: Creating temporary keypair: packer xxxxxxxxxxxxxxxxx
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 22 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
    amazon-ebs: Instance ID: i-xxxxxxxx
==> amazon-ebs: Waiting for instance (i-xxxxxxx) to become ready...
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Connected to SSH!
==> amazon-ebs: Provisioning with shell script: /tmp/packer-shellxxxxxxxxx
    amazon-ebs: Ign http://ap-southeast-2.ec2.archive.ubuntu.com trusty InRelease
    amazon-ebs: Ign http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates InRelease
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty Release.gpg
    amazon-ebs: Get:1 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates Release.gpg [933 B]
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty Release
    amazon-ebs: Get:2 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates Release [63.5 kB]
    amazon-ebs: Get:3 http://ap-southeast-2.ec2.archive.ubuntu.com trusty/main Sources [1,064 kB]
    amazon-ebs: Get:4 http://ap-southeast-2.ec2.archive.ubuntu.com trusty/universe Sources [6,399 kB]
    amazon-ebs: Ign http://security.ubuntu.com trusty-security InRelease
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty/main amd64 Packages
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty/universe amd64 Packages
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty/main Translation-en
    amazon-ebs: Hit http://ap-southeast-2.ec2.archive.ubuntu.com trusty/universe Translation-en
    amazon-ebs: Get:5 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/main Sources [234 kB]
    amazon-ebs: Get:6 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/universe Sources [135 kB]
    amazon-ebs: Get:7 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/main amd64 Packages [618 kB]
    amazon-ebs: Get:8 http://security.ubuntu.com trusty-security Release.gpg [933 B]
    amazon-ebs: Get:9 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/universe amd64 Packages [312 kB]
    amazon-ebs: Get:10 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/main Translation-en [299 kB]
    amazon-ebs: Get:11 http://security.ubuntu.com trusty-security Release [63.5 kB]
    amazon-ebs: Get:12 http://ap-southeast-2.ec2.archive.ubuntu.com trusty-updates/universe Translation-en [166 kB]
    amazon-ebs: Ign http://ap-southeast-2.ec2.archive.ubuntu.com trusty/main Translation-en_US
    amazon-ebs: Ign http://ap-southeast-2.ec2.archive.ubuntu.com trusty/universe Translation-en_US
    amazon-ebs: Get:13 http://security.ubuntu.com trusty-security/main Sources [94.1 kB]
    amazon-ebs: Get:14 http://security.ubuntu.com trusty-security/universe Sources [30.5 kB]
    amazon-ebs: Get:15 http://security.ubuntu.com trusty-security/main amd64 Packages [341 kB]
    amazon-ebs: Get:16 http://security.ubuntu.com trusty-security/universe amd64 Packages [116 kB]
    amazon-ebs: Get:17 http://security.ubuntu.com trusty-security/main Translation-en [186 kB]
    amazon-ebs: Get:18 http://security.ubuntu.com trusty-security/universe Translation-en [67.8 kB]
    amazon-ebs: Fetched 10.2 MB in 7s (1,333 kB/s)
    amazon-ebs: Reading package lists...
    amazon-ebs: Reading package lists...
    amazon-ebs: Building dependency tree...
    amazon-ebs: Reading state information...
    amazon-ebs: The following extra packages will be installed:
    amazon-ebs: libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7-minimal
    amazon-ebs: Suggested packages:
    amazon-ebs: python2.7-doc binutils binfmt-support
    amazon-ebs: The following packages will be upgraded:
    amazon-ebs: libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7
    amazon-ebs: python2.7-minimal
    amazon-ebs: 5 upgraded, 0 newly installed, 0 to remove and 108 not upgraded.
    amazon-ebs: Need to get 4,597 kB of archives.
    amazon-ebs: After this operation, 13.3 kB disk space will be freed.
    amazon-ebs: Get:1 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python2.7 amd64 2.7.6-8ubuntu0.2 [196 kB]
    amazon-ebs: Get:2 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python2.7-minimal amd64 2.7.6-8ubuntu0.2 [1,185 kB]
    amazon-ebs: Get:3 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libpython2.7 amd64 2.7.6-8ubuntu0.2 [1,039 kB]
    amazon-ebs: Get:4 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libpython2.7-stdlib amd64 2.7.6-8ubuntu0.2 [1,869 kB]
    amazon-ebs: Get:5 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libpython2.7-minimal amd64 2.7.6-8ubuntu0.2 [308 kB]
    amazon-ebs: debconf: unable to initialize frontend: Dialog
    amazon-ebs: debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
    amazon-ebs: debconf: falling back to frontend: Readline
    amazon-ebs: debconf: unable to initialize frontend: Readline
    amazon-ebs: debconf: (This frontend requires a controlling tty.)
    amazon-ebs: debconf: falling back to frontend: Teletype
    amazon-ebs: dpkg-preconfigure: unable to re-open stdin:
    amazon-ebs: Fetched 4,597 kB in 0s (19.8 MB/s)
    amazon-ebs: (Reading database ... 51120 files and directories currently installed.)
    amazon-ebs: Preparing to unpack .../python2.7_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking python2.7 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../python2.7-minimal_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking python2.7-minimal (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7-stdlib_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Preparing to unpack .../libpython2.7-minimal_2.7.6-8ubuntu0.2_amd64.deb ...
    amazon-ebs: Unpacking libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.2) over (2.7.6-8) ...
    amazon-ebs: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    amazon-ebs: Processing triggers for mime-support (3.54ubuntu1.1) ...
    amazon-ebs: Setting up libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up python2.7-minimal (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up libpython2.7-stdlib:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up python2.7 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Setting up libpython2.7:amd64 (2.7.6-8ubuntu0.2) ...
    amazon-ebs: Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
    amazon-ebs: Reading package lists...
    amazon-ebs: Building dependency tree...
    amazon-ebs: Reading state information...
    amazon-ebs: The following extra packages will be installed:
    amazon-ebs: binutils build-essential cpp cpp-4.8 dpkg-dev fakeroot g++ g++-4.8 gcc
    amazon-ebs: gcc-4.8 gcc-4.8-base libalgorithm-diff-perl libalgorithm-diff-xs-perl
    amazon-ebs: libalgorithm-merge-perl libasan0 libatomic1 libc-dev-bin libc6-dev
    amazon-ebs: libcloog-isl4 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-4.8-dev
    amazon-ebs: libgmp10 libgomp1 libisl10 libitm1 libmpc3 libmpfr4 libquadmath0
    amazon-ebs: libstdc++-4.8-dev libstdc++6 libtsan0 linux-libc-dev make manpages-dev
    amazon-ebs: python-chardet-whl python-colorama python-colorama-whl python-distlib
    amazon-ebs: python-distlib-whl python-html5lib python-html5lib-whl python-pip-whl
    amazon-ebs: python-pkg-resources python-requests-whl python-setuptools
    amazon-ebs: python-setuptools-whl python-six-whl python-urllib3-whl python-wheel
    amazon-ebs: python3-pkg-resources
    amazon-ebs: Suggested packages:
    amazon-ebs: binutils-doc cpp-doc gcc-4.8-locales debian-keyring g++-multilib
    amazon-ebs: g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg gcc-multilib autoconf
    amazon-ebs: automake1.9 libtool flex bison gdb gcc-doc gcc-4.8-multilib libgcc1-dbg
    amazon-ebs: libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg
    amazon-ebs: libquadmath0-dbg glibc-doc libstdc++-4.8-doc make-doc python-genshi
    amazon-ebs: python-lxml python-distribute python-distribute-doc python3-setuptools
    amazon-ebs: Recommended packages:
    amazon-ebs: python-dev-all
    amazon-ebs: The following NEW packages will be installed:
    amazon-ebs: binutils build-essential cpp cpp-4.8 dpkg-dev fakeroot g++ g++-4.8 gcc
    amazon-ebs: gcc-4.8 libalgorithm-diff-perl libalgorithm-diff-xs-perl
    amazon-ebs: libalgorithm-merge-perl libasan0 libatomic1 libc-dev-bin libc6-dev
    amazon-ebs: libcloog-isl4 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-4.8-dev
    amazon-ebs: libgmp10 libgomp1 libisl10 libitm1 libmpc3 libmpfr4 libquadmath0
    amazon-ebs: libstdc++-4.8-dev libtsan0 linux-libc-dev make manpages-dev
    amazon-ebs: python-chardet-whl python-colorama python-colorama-whl python-distlib
    amazon-ebs: python-distlib-whl python-html5lib python-html5lib-whl python-pip
    amazon-ebs: python-pip-whl python-requests-whl python-setuptools python-setuptools-whl
    amazon-ebs: python-six-whl python-urllib3-whl python-wheel python3-pkg-resources
    amazon-ebs: The following packages will be upgraded:
    amazon-ebs: gcc-4.8-base libstdc++6 python-pkg-resources
    amazon-ebs: 3 upgraded, 50 newly installed, 0 to remove and 105 not upgraded.
    amazon-ebs: Need to get 38.6 MB of archives.
    amazon-ebs: After this operation, 116 MB of additional disk space will be used.
    amazon-ebs: Get:1 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main gcc-4.8-base amd64 4.8.4-2ubuntu1~14.04 [15.9 kB]
    amazon-ebs: Get:2 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libstdc++6 amd64 4.8.4-2ubuntu1~14.04 [259 kB]
    amazon-ebs: Get:3 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libasan0 amd64 4.8.4-2ubuntu1~14.04 [63.0 kB]
    amazon-ebs: Get:4 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libatomic1 amd64 4.8.4-2ubuntu1~14.04 [8,650 B]
    amazon-ebs: Get:5 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libgmp10 amd64 2:5.1.3+dfsg-1ubuntu1 [218 kB]
    amazon-ebs: Get:6 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libisl10 amd64 0.12.2-1 [419 kB]
    amazon-ebs: Get:7 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libcloog-isl4 amd64 0.18.2-1 [57.5 kB]
    amazon-ebs: Get:8 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libgomp1 amd64 4.8.4-2ubuntu1~14.04 [23.1 kB]
    amazon-ebs: Get:9 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libitm1 amd64 4.8.4-2ubuntu1~14.04 [28.6 kB]
    amazon-ebs: Get:10 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libmpfr4 amd64 3.1.2-1 [203 kB]
    amazon-ebs: Get:11 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libquadmath0 amd64 4.8.4-2ubuntu1~14.04 [126 kB]
    amazon-ebs: Get:12 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libtsan0 amd64 4.8.4-2ubuntu1~14.04 [94.7 kB]
    amazon-ebs: Get:13 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libmpc3 amd64 1.0.1-1ubuntu1 [38.4 kB]
    amazon-ebs: Get:14 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main binutils amd64 2.24-5ubuntu13 [2,076 kB]
    amazon-ebs: Get:15 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libc-dev-bin amd64 2.19-0ubuntu6.6 [68.9 kB]
    amazon-ebs: Get:16 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-libc-dev amd64 3.13.0-63.103 [777 kB]
    amazon-ebs: Get:17 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libc6-dev amd64 2.19-0ubuntu6.6 [1,910 kB]
    amazon-ebs: Get:18 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main cpp-4.8 amd64 4.8.4-2ubuntu1~14.04 [4,597 kB]
    amazon-ebs: Get:19 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main cpp amd64 4:4.8.2-1ubuntu6 [27.5 kB]
    amazon-ebs: Get:20 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libgcc-4.8-dev amd64 4.8.4-2ubuntu1~14.04 [1,687 kB]
    amazon-ebs: Get:21 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main gcc-4.8 amd64 4.8.4-2ubuntu1~14.04 [5,049 kB]
    amazon-ebs: Get:22 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main gcc amd64 4:4.8.2-1ubuntu6 [5,098 B]
    amazon-ebs: Get:23 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libstdc++-4.8-dev amd64 4.8.4-2ubuntu1~14.04 [1,052 kB]
    amazon-ebs: Get:24 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main g++-4.8 amd64 4.8.4-2ubuntu1~14.04 [15.0 MB]
    amazon-ebs: Get:25 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
    amazon-ebs: Get:26 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main make amd64 3.81-8.2ubuntu3 [119 kB]
    amazon-ebs: Get:27 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libdpkg-perl all 1.17.5ubuntu5.4 [179 kB]
    amazon-ebs: Get:28 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main dpkg-dev all 1.17.5ubuntu5.4 [726 kB]
    amazon-ebs: Get:29 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
    amazon-ebs: Get:30 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libfakeroot amd64 1.20-3ubuntu2 [25.4 kB]
    amazon-ebs: Get:31 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main fakeroot amd64 1.20-3ubuntu2 [55.0 kB]
    amazon-ebs: Get:32 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-perl all 1.19.02-3 [50.0 kB]
    amazon-ebs: Get:33 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-xs-perl amd64 0.04-2build4 [12.6 kB]
    amazon-ebs: Get:34 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]
    amazon-ebs: Get:35 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libfile-fcntllock-perl amd64 0.14-2build1 [15.9 kB]
    amazon-ebs: Get:36 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main manpages-dev all 3.54-1ubuntu1 [1,820 kB]
    amazon-ebs: Get:37 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python3-pkg-resources all 3.3-1ubuntu2 [31.7 kB]
    amazon-ebs: Get:38 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-chardet-whl all 2.2.1-2~ubuntu1 [170 kB]
    amazon-ebs: Get:39 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-colorama all 0.2.5-0.1ubuntu2 [18.4 kB]
    amazon-ebs: Get:40 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-colorama-whl all 0.2.5-0.1ubuntu2 [18.2 kB]
    amazon-ebs: Get:41 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-distlib all 0.1.8-1ubuntu1 [113 kB]
    amazon-ebs: Get:42 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-distlib-whl all 0.1.8-1ubuntu1 [140 kB]
    amazon-ebs: Get:43 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-html5lib all 0.999-3~ubuntu1 [83.5 kB]
    amazon-ebs: Get:44 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-html5lib-whl all 0.999-3~ubuntu1 [109 kB]
    amazon-ebs: Get:45 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-six-whl all 1.5.2-1ubuntu1 [10.5 kB]
    amazon-ebs: Get:46 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-urllib3-whl all 1.7.1-1ubuntu3 [64.0 kB]
    amazon-ebs: Get:47 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-requests-whl all 2.2.1-1ubuntu0.3 [227 kB]
    amazon-ebs: Get:48 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-setuptools-whl all 3.3-1ubuntu2 [244 kB]
    amazon-ebs: Get:49 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-pip-whl all 1.5.4-1ubuntu3 [111 kB]
    amazon-ebs: Get:50 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-pkg-resources all 3.3-1ubuntu2 [61.9 kB]
    amazon-ebs: Get:51 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-setuptools all 3.3-1ubuntu2 [230 kB]
    amazon-ebs: Get:52 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-pip all 1.5.4-1ubuntu3 [97.2 kB]
    amazon-ebs: Get:53 http://ap-southeast-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main python-wheel all 0.24.0-1~ubuntu1 [44.7 kB]
    ...
    ... cut for clarity ...
    ...
==> amazon-ebs: Stopping the source instance...
==> amazon-ebs: Waiting for the instance to stop...
==> amazon-ebs: Creating the AMI: base_ami-xxxxxxxx
    amazon-ebs: AMI: ami-xxxxxxx
==> amazon-ebs: Waiting for AMI to become ready...
==> amazon-ebs: Adding tags to AMI (ami-xxxxxxx)...
    amazon-ebs: Adding tag: "timestamp": "xxxxxxxxx"
    amazon-ebs: Adding tag: "version": "xx"
    amazon-ebs: Adding tag: "source_ami": "ami-xxxxxxx"
==> amazon-ebs: Tagging snapshot: snap-xxxxxxx
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' finished.

Does anyone know what's causing this inconsistent behaviour? The relevant part of my provisioning script is below:

"sudo apt-get clean",
"sudo apt-get update",
"sudo apt-get install python2.7 -y",
"sudo apt-get install python-pip -y",
"sudo pip install awscli",
"sudo pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz",

回答1:


I cannot really explain why you have this behavior but I'd suggest you always add the repository in your provisioning script so it gets more consistent - example with the amazon tools PPA

sudo add-apt-repository ppa:awstools-dev/awstools
sudo apt-get update

what you can also try it

sudo sed 's@http://archive\.ubuntu\.com/@http://ap-southeast-2.ec2.archive.ubuntu.com/@' -i /etc/apt/sources.list

so it should always point to the server that seems to work



来源:https://stackoverflow.com/questions/32492207/packer-amazon-ebs-ubuntu-inconsistent-ppas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!