Packer: Packer shell provisioner fails on AWS and works on VMWare and Virtualbox

Created on 27 May 2015  ·  3Comments  ·  Source: hashicorp/packer

Hello,

I have built a template.json file to take a current ubuntu 14.04 image and create VMWare, Virtualbox and AWS images. One of my provisioners is a shell provisioner that attempts to perform:

sudo apt-get -y -q install python3-dev

This of course works on the VMWare and VB images, but when I run it on the AWS I get a:

amazon-ebs: 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
amazon-ebs: Reading package lists... Done
amazon-ebs: Building dependency tree
amazon-ebs: Reading state information... Done
amazon-ebs:
amazon-ebs: Package python3-dev 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 'python3-dev' has no installation candidate

==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Script exited with non-zero exit status: 100

If I install the package manually it works, so I am a bit stumped right now. The json for my builder is:

{"type": "amazon-ebs",
  "access_key": "{{user `aws_access_key`}}",
  "secret_key": "{{user `aws_secret_key`}}",
  "region": "us-west-1",
  "source_ami": "ami-9b7f90df",
  "instance_type": "t2.micro",
  "ssh_username": "ubuntu",
  "ami_name": "packer-{{timestamp}}"
}

Currently I am working around this by supplying cloud config data to the instances to fix the provisioning shortcomings, but this is a total hack.

Thanks
Craig

Most helpful comment

Are you running apt-get update before? The amazon machines often have stale caches.

Otherwise, I've also seen AWS machines fail early due to system setup, so try putting a sleep (for maybe 10 seconds) before the apt-get update.

This doesn't appear to be a Packer issue itself.

All 3 comments

Are you running apt-get update before? The amazon machines often have stale caches.

Otherwise, I've also seen AWS machines fail early due to system setup, so try putting a sleep (for maybe 10 seconds) before the apt-get update.

This doesn't appear to be a Packer issue itself.

Thanks @mitchellh

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wduncanfraser picture wduncanfraser  ·  3Comments

Nikoos picture Nikoos  ·  3Comments

frezbo picture frezbo  ·  3Comments

sourav82 picture sourav82  ·  3Comments

tleyden picture tleyden  ·  3Comments