Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packer shell provisioner fails on AWS and works on VMWare and Virtualbox #2143

Closed
craigsimon opened this issue May 27, 2015 · 3 comments
Closed

Comments

@craigsimon
Copy link

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

@mitchellh
Copy link
Contributor

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.

@brandaccelerator
Copy link

Thanks @mitchellh

@ghost
Copy link

ghost commented Mar 29, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants