Repository navigation
Closed
Description
I am shameless copying this issue but updating slightly: #5792
It may be related to #6526
I have a CentOS Packer build on AWS which works with version 1.1.2 but fails with version 1.2.5
The template used to build the image:
{
"variables": {
"packer_script_path": "",
"force_deregister": "",
"image_name": "",
"aws_secret_key_id": "{{env `AWS_SECRET_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"source_ami": "ami-476e4c22",
"ami_regions": "us-west-2",
"ssh_username": "{{env `DEFAULT_PLATFORM_USER`}}"
},
"builders": [
{
"name": "aws",
"type": "amazon-ebs",
"region": "us-east-2",
"source_ami": "{{user `source_ami`}}",
"instance_type": "t2.medium",
"ssh_username": "{{user `ssh_username`}}",
"ssh_pty": "true",
"run_tags": {
"Source": "Packer",
},
"tags": {
"Source": "Packer",
},
"ami_name": "{{user `image_name`}}",
"ami_description": "{{user `image_name`}}",
"force_deregister": "{{user `force_deregister`}}",
"ami_regions": "{{user `ami_regions`}}",
"shutdown_behavior": "terminate"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"{{user `packer_script_path`}}/install-packages.sh"
]
},
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"{{user `packer_script_path`}}/configure-os.sh"
]
},
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"{{user `packer_script_path`}}/set-kernel.sh"
]
}
],
"post-processors": [
{
"type": "manifest",
"output": "image-metadata/aws-{{user `file_name`}}.json",
"strip_path": true
}
]
}
As you can see, I am not doing anything complicated.
When the build fails using version 1.2.5, it times out with the following error. This happens 75% of the time:
==> aws: 1 error(s) occurred:
==> aws:
==> aws: * Error waiting for AMI (ami-192c0861) in region (us-west-2): ResourceNotReady: exceeded wait attempts
-
Packer version from packer version
1.2.5 -
Host platform
Alpine Linux 3.8.0
I am using this image from dockerhub, https://hub.docker.com/r/hashicorp/packer/, with a tag of light.
If I run the above template using v 1.1.2, it works fine.
Regard,
Kris
Activity
kmacoskey commentedon Aug 6, 2018
Setting the env var
AWS_MAX_ATTEMPTS=150has been a valid workaround for now.SwampDragons commentedon Aug 6, 2018
I'm going to close this as a duplicate since it's caused by the same underlying issue as #6526. I'd like to track all instances of this bug in the same place. Thanks for sharing your information :)
kmacoskey commentedon Aug 6, 2018
The linked issue is already closed?
SwampDragons commentedon Aug 6, 2018
Sorry, realized I linked the wrong one and updated 😬
kmacoskey commentedon Aug 6, 2018
The issue occurs with and without
encrypt_boot: true. Should I add some comments to the other linked issue to reflect that the issue extends beyond the scope of the original issue?SwampDragons commentedon Aug 6, 2018
There's already another issue linked to that one that's closer in symptoms to yours. I promise, it's the same root cause :) . If you want to add a little note though, mentioning your symptoms and that increasing the wait attempts helped, it may help other users.
kmacoskey commentedon Aug 6, 2018
I had not followed the next issue. It makes more sense now. Thank you!
SwampDragons commentedon Aug 6, 2018
No problem! And thanks for your diligence.
mattolenik commentedon Aug 28, 2018
I'm also hitting this but setting
AWS_MAX_ATTEMPTS=150does nothing. Neither does any combination of these variables, according to the logic laid out here: https://github.com/hashicorp/packer/blob/master/builder/amazon/common/state.go#L298I'm just exporting them from the shell script where I invoke Packer. It's pretty straightforward, but I can't seem to configure it to not time out. It's as if they're all being ignored entirely.
I'm confused in general with this behavior...AMI import is a process that can frequently take 1-2 hours, even longer. The updated default timeout of 30 minutes is still nowhere near enough for any moderately sized image.
SwampDragons commentedon Aug 28, 2018
I can update the default further, but those env variables absolutely should work. That code is a little hairy but ultimately the behavior is: use the env variables if the user has set them and if not, use waiter-specific defaults rather than global ones. If you want help debugging I'll need to see your debug logs (set env var
PACKER_LOG=1)SwampDragons commentedon Aug 30, 2018
@mattolenik and @WeekendsBull can one or both of you please share configs and debug logs with me so I can try to replicate?
8 remaining items
SwampDragons commentedon Aug 31, 2018
I lied. What I thought was a problem is fine.
SwampDragons commentedon Aug 31, 2018
The good news is, I can reproduce now.
SwampDragons commentedon Aug 31, 2018
Found it. New PR 6649 should fix this for you. Sorry for the saga. If you'd like I can build you a copy of the branch.
WeekendsBull commentedon Aug 31, 2018
i'm able to build mine now. @SwampDragons. Really appreciate your help.
mattolenik commentedon Aug 31, 2018
@SwampDragons thank you very much for your help!! A local build will be just fine for me for now.
SwampDragons commentedon Sep 4, 2018
Okay you're on some kind of posix system going by logs so here's a
linux build:
packer.zip
and here's an OSX build:
packer.zip
cixelsyd commentedon Sep 19, 2018
I'm hitting this also; I tried to look and see if this made it into 1.3.1 or is still as-yet-unreleased however my github foo is not strong enough. I believe that it did not make it into a release yet, would you please confirm for me? Thanks!
SwampDragons commentedon Sep 19, 2018
This should be in 1.3.1. If you're still having problems, update the environment variables.
cixelsyd commentedon Sep 20, 2018
Thank you! I used 1.3.1 and updated my environment variables and it is working as expected.
lmayorga1980 commentedon Sep 20, 2018
The environment variables fixed the problem when uploading an image that usually takes 1 hour. With Packer
1.2.3it runs smoothly and after1.2.5+I have to provide.AWS_POLL_DELAY_SECONDS=10 AWS_MAX_ATTEMPTS=400.royerhq commentedon Sep 26, 2018
I am getting the same issue with Packer Version
1.3.1running the Amazon-Import Post Processor.The AMI gets created in AWS but Packer fails with, ResourceNotReady: exceeded wait attempts, which results on an un-tagged and improperly named AMI.
Note
My environment Variables where set and it still fail. I will set it to a higher number just like @lmayorga1980 did.. will provide feed back once I find a number that would work for me.
Update
Thank you @lmayorga1980 --- I totally messed up my
AWS_POLL_DELAY_SECONDSvariable.. I had it set to 5 which is the default value so I kept timing out... Value of 10 like you did worked like a charm.. Thanks!lmayorga1980 commentedon Sep 27, 2018
shyam2j commentedon Nov 16, 2018
THis worked for me as well, had to make to 400 from 150 for AWS_MAX_ATTEMPTS