Packer amazon import waiting for resource state

111 views
Skip to first unread message

Morgan Andrew Davis

unread,
Jan 15, 2019, 9:19:08 AM1/15/19
to Packer
Hello again. I was hoping someone could help me with another issue. Hopefully, this will be the last one for the current project. When I am running an amazon import with packer using the AWS_MAX_ATTEMPTS thing I get an error like: ResourceNotReady: waiting for successful resource state. Even when I set the max attempts and the interval to something ridiculous like 1000 and 10 it still gives me this. Does anyone have advice as to how to overcome this? I appreciate any help you can give me.

Rickard von Essen

unread,
Jan 15, 2019, 9:24:28 AM1/15/19
to packe...@googlegroups.com
Could you show how how done that, you shouldn't get that if those take effect. (I would increase the polling intervall to something larger like 60s and set the max attempts to something more sane like 360).

On Tue, Jan 15, 2019 at 3:19 PM Morgan Andrew Davis <morgana...@gmail.com> wrote:
Hello again. I was hoping someone could help me with another issue. Hopefully, this will be the last one for the current project. When I am running an amazon import with packer using the AWS_MAX_ATTEMPTS thing I get an error like: ResourceNotReady: waiting for successful resource state. Even when I set the max attempts and the interval to something ridiculous like 1000 and 10 it still gives me this. Does anyone have advice as to how to overcome this? I appreciate any help you can give me.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/88024ca4-3e93-4b04-9421-bf9c4b1c09be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Morgan Andrew Davis

unread,
Jan 15, 2019, 9:32:23 AM1/15/19
to Packer
Sure. The command is export "AWS_MAX_ATTEMPTS=1000"; export "AWS_POLL_DELAY_SECONDS=10"; packer build ./examplepacker.json where examplepacker.json has the following inside: 

{
"builders": [{
"type": "vmware-vmx",
"source_path": "./output-atomicorp-aeo-hub-vmware-iso/atomicorp-aeo-hub.vmx",
"ssh_pty": "true",
"ssh_username": "root",
"ssh_password": "atomicorp",
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'atomicorp' | sudo -S shutdown -P now",
"format": "ova"
}],
"post-processors" : [{
"type": "amazon-import",
        "access_key": "",
        "secret_key": "",
        "region": "us-east-1",
        "s3_bucket_name": "packertestbucket",
        "tags": {
             "Description": "packer/boxcutter amazon-import {{timestamp}}"
        }
}]
}
Note that I removed the access and secret key to post the rest here. I'm fairly certain that part is right and I don't need to share that since it is the company's. Is this what you wanted or did you want the terminal output or something else? I am going to go ahead and try and run this using the numbers you posted up top.

Morgan Andrew Davis

unread,
Jan 15, 2019, 9:36:18 AM1/15/19
to Packer
Scratch what I just posted. I grabbed the wrong file. examplepacker.json is: 


{
"_comment": "json comment... This file uses the virtualbox builder and then feeds it into the amazon post processor. You can remove the post processor and the builder can work by itself. May need to be modified to work with another source image",
"builders": [{
"type": "virtualbox-ovf",
"source_path": "./atomicorp-aeo-hub.ova",
"ssh_pty": "true",
"ssh_username": "root",
"ssh_password": "atomicorp",
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'atomicorp' | sudo -S shutdown -P now",
"format": "ova"
}],
"post-processors" : [{
"type": "amazon-import",
        "access_key": "",
        "secret_key": "",
        "region": "us-east-1",
        "s3_bucket_name": "packertestbucket",
        "tags": {
             "Description": "packer/boxcutter amazon-import {{timestamp}}"
        }
}]
}
My bad, I have a lot of files open.

Rickard von Essen

unread,
Jan 15, 2019, 9:52:47 AM1/15/19
to packe...@googlegroups.com
If you run with PACKER_LOG=1 I think you will see a line every time it polls AWS for the state.

Morgan Andrew Davis

unread,
Jan 15, 2019, 10:06:02 AM1/15/19
to Packer
If the current run with it doesn't work i'll run it with the packer_log and put some output here. I appreciate your help thus far.

Rickard von Essen

unread,
Jan 15, 2019, 10:11:10 AM1/15/19
to packe...@googlegroups.com

Morgan Andrew Davis

unread,
Jan 15, 2019, 1:34:05 PM1/15/19
to Packer
Ok, seems like the 360 and 60 settings didn't work either. I'll put some of the output using packer_log here. Maybe you can gleam something from it.

Here it is: 

Starting post-processor amazon-import                                                                                                                                                     
==> virtualbox-ovf: Running post-processor: amazon-import                                                                                                                                                                        
2019/01/15 11:45:07 packer.exe: 2019/01/15 11:45:07 Found region us-east-1                                                                                                                                                       
2019/01/15 11:45:07 packer.exe: 2019/01/15 11:45:07 [INFO] AWS Auth provider use                                                                                                                                                 
d: "StaticProvider"                                                                                                                                                                                                              
2019/01/15 11:45:07 packer.exe: 2019/01/15 11:45:07 Rendered s3_key_name as pack                                                                                                                                                 
er-import-1547570312.ova                                                                                                                                                                                                         
2019/01/15 11:45:07 packer.exe: 2019/01/15 11:45:07 Looking for image in artifac                                                                                                                                                 
t                                                                                                                                                                                                                                
2019/01/15 11:45:07 packer.exe: 2019/01/15 11:45:07 Opening file output-virtualb                                                                                                                                                 
ox-ovf\packer-virtualbox-ovf-1547570312.ova to upload                                                                                                                                                                            
    virtualbox-ovf (amazon-import): Uploading output-virtualbox-ovf\packer-virtu                                                                                                                                                 
albox-ovf-1547570312.ova to s3://packertestbucket/packer-import-1547570312.ova                                                                                                                                                   
    virtualbox-ovf (amazon-import): Completed upload of output-virtualbox-ovf\pa                                                                                                                                                 
cker-virtualbox-ovf-1547570312.ova to s3://packertestbucket/packer-import-154757                                                                                                                                                 
0312.ova                                                                                                                                                                                                                         
2019/01/15 12:16:21 packer.exe: 2019/01/15 12:16:21 Calling EC2 to import from s                                                                                                                                                 
3://packertestbucket/packer-import-1547570312.ova                                                                                                                                                                                
    virtualbox-ovf (amazon-import): Started import of s3://packertestbucket/pack                                                                                                                                                 
er-import-1547570312.ova, task id import-ami-0be69e5a5077f6e11                                                                                                                                                                   
    virtualbox-ovf (amazon-import): Waiting for task import-ami-0be69e5a5077f6e1                                                                                                                                                 
1 to complete (may take a while)                                                                                                                                                                                                 
2019/01/15 13:25:44 [INFO] (telemetry) ending amazon-import                                                                                                                                                                      
2019/01/15 13:25:44 Deleting original artifact for build 'virtualbox-ovf'                                                                                                                                                        
Build 'virtualbox-ovf' errored: 1 error(s) occurred:                                                                                                                                                                             
2019/01/15 13:25:44 ui error: Build 'virtualbox-ovf' errored: 1 error(s) occurre                                                                                                                                                 
d:                                                                                                                                                                                                                               
                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-0be69e5a5077f6e11 failed with er                                                                                                                                                 
ror: ResourceNotReady: failed waiting for successful resource state                                                                                                                                                              
* Post-processor failed: Import task import-ami-0be69e5a5077f6e11 failed with er                                                                                                                                                 
ror: ResourceNotReady: failed waiting for successful resource state                                                                                                                                                              
2019/01/15 13:25:44 Builds completed. Waiting on interrupt barrier...                                                                                                                                                            
2019/01/15 13:25:44 machine readable: error-count []string{"1"}                                                                                                                                                                  
2019/01/15 13:25:44 ui error:                                                                                                                                                                                                    
==> Some builds didn't complete successfully and had errors:                                                                                                                                                                     
2019/01/15 13:25:44 machine readable: virtualbox-ovf,error []string{"1 error(s)                                                                                                                                                  
occurred:\n\n* Post-processor failed: Import task import-ami-0be69e5a5077f6e11 f                                                                                                                                                 
ailed with error: ResourceNotReady: failed waiting for successful resource state                                                                                                                                                 
"}                                                                                                                                                                                                                               
2019/01/15 13:25:44 ui error: --> virtualbox-ovf: 1 error(s) occurred:                                                                                                                                                           
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-0be69e5a5077f6e11 failed with er                                                                                                                                                 
ror: ResourceNotReady: failed waiting for successful resource state                                                                                                                                                              
==> Builds finished but no artifacts were created.                                                                                                                                                                               
                                                                                                                                                                                                                                 
==> Some builds didn't complete successfully and had errors:                                                                                                                                                                     
--> virtualbox-ovf: 1 error(s) occurred:                                                                                                                                                                                         
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-0be69e5a5077f6e11 failed with er                                                                                                                                                 
ror: ResourceNotReady: failed waiting for successful resource state                                                                                                                                                              
                                                                                                                                                                                                                                 
==> Builds finished but no artifacts were created.                                                                                                                                                                               
2019/01/15 13:25:44 [INFO] (telemetry) Finalizing.                                                                                                                                                                               
2019/01/15 13:25:44 waiting for all plugin processes to complete...                                                                                                                                                              
2019/01/15 13:25:44 C:\Users\Morgan Davis\Desktop\packer.exe: plugin process exi                                                                                                                                                 
ted                                                                                                                                                                                                                              
2019/01/15 13:25:44 C:\Users\Morgan Davis\Desktop\packer.exe: plugin process exi                                                                                                                                                 
ted

Rickard von Essen

unread,
Jan 15, 2019, 1:42:23 PM1/15/19
to packe...@googlegroups.com
What's the output if you use the cli to describe the import task? (import-ami-0be69e5a5077f6e11) 

Morgan Andrew Davis

unread,
Jan 15, 2019, 1:54:56 PM1/15/19
to Packer
Using aws ec2 describe-import-image-tasks and finding the one with the requested id yeilds:

{
            "ImportTaskId": "import-ami-0be69e5a5077f6e11",
            "SnapshotDetails": [
                {
                    "DiskImageSize": 1096725504.0,
                    "Format": "VMDK",
                    "Status": "completed",
                    "UserBucket": {
                        "S3Bucket": "packertestbucket",
                        "S3Key": "packer-import-1547570312.ova"
                    }
                }
            ],
            "Status": "deleted",
            "StatusMessage": "ClientError: No valid partitions. Not a valid volume."

Rickard von Essen

unread,
Jan 15, 2019, 2:35:38 PM1/15/19
to packe...@googlegroups.com
Some observations:

1) Packer doesn't properly report the underlaying error. We should show this:
 "StatusMessage": "ClientError: No valid partitions. Not a valid volume."
I'll create a report an issue for that.

2) Your import fails, that is your real problem. Have you tried to set format to ova instead (seems more logical since the file is an ova).

Morgan Andrew Davis

unread,
Jan 15, 2019, 3:22:35 PM1/15/19
to Packer
Yeah it seems to be. I am currently going through a checklist of prerequisites for an amazon ami that I didn't know existed till now. My previous imports worked, so I didn't actually know there were things that the ova being imported had to abide by. The format that the import expects is by default an ova. I can set it and see if it has an effect though. Thank you for your help.

Rickard von Essen

unread,
Jan 15, 2019, 3:37:17 PM1/15/19
to packe...@googlegroups.com
I made a quick patch that should improve the error message when it fails. It would be great if you can test it out.


Morgan Andrew Davis

unread,
Jan 15, 2019, 3:48:19 PM1/15/19
to Packer
I can but probably not today. I have to leave work in less than an hour and it won't be finished. I'll download it and try it out tomorrow. Is everything I need in the zip?

Morgan Andrew Davis

unread,
Jan 16, 2019, 11:13:01 AM1/16/19
to Packer
Here is the output for my build with after your patch. Hopefully it makes the changes you wanted.

Starting post-processor amazon-import                                                                                                                                                     
==> virtualbox-ovf: Running post-processor: amazon-import                                                                                                                                                                        
2019/01/16 09:25:25 packer.exe: 2019/01/16 09:25:25 Found region us-east-1                                                                                                                                                       
2019/01/16 09:25:25 packer.exe: 2019/01/16 09:25:25 [INFO] AWS Auth provider use                                                                                                                                                 
d: "StaticProvider"                                                                                                                                                                                                              
2019/01/16 09:25:25 packer.exe: 2019/01/16 09:25:25 Rendered s3_key_name as pack                                                                                                                                                 
er-import-1547648263.ova                                                                                                                                                                                                         
2019/01/16 09:25:25 packer.exe: 2019/01/16 09:25:25 Looking for image in artifac                                                                                                                                                 
t                                                                                                                                                                                                                                
2019/01/16 09:25:26 packer.exe: 2019/01/16 09:25:26 Opening file output-virtualb                                                                                                                                                 
ox-ovf\packer-virtualbox-ovf-1547648263.ova to upload                                                                                                                                                                            
    virtualbox-ovf (amazon-import): Uploading output-virtualbox-ovf\packer-virtu                                                                                                                                                 
albox-ovf-1547648263.ova to s3://packertestbucket/packer-import-1547648263.ova                                                                                                                                                   
    virtualbox-ovf (amazon-import): Completed upload of output-virtualbox-ovf\pa                                                                                                                                                 
cker-virtualbox-ovf-1547648263.ova to s3://packertestbucket/packer-import-154764                                                                                                                                                 
8263.ova                                                                                                                                                                                                                         
2019/01/16 09:56:25 packer.exe: 2019/01/16 09:56:25 Calling EC2 to import from s                                                                                                                                                 
3://packertestbucket/packer-import-1547648263.ova                                                                                                                                                                                
    virtualbox-ovf (amazon-import): Started import of s3://packertestbucket/pack                                                                                                                                                 
er-import-1547648263.ova, task id import-ami-03054a8da6b346888                                                                                                                                                                   
    virtualbox-ovf (amazon-import): Waiting for task import-ami-03054a8da6b34688                                                                                                                                                 
8 to complete (may take a while)                                                                                                                                                                                                 
2019/01/16 11:09:44 [INFO] (telemetry) ending amazon-import                                                                                                                                                                      
2019/01/16 11:09:44 Deleting original artifact for build 'virtualbox-ovf'                                                                                                                                                        
2019/01/16 11:09:44 ui error: Build 'virtualbox-ovf' errored: 1 error(s) occurre                                                                                                                                                 
d:                                                                                                                                                                                                                               
Build 'virtualbox-ovf' errored: 1 error(s) occurred:                                                                                                                                                                             
                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-03054a8da6b346888 failed with st                                                                                                                                                 
atus message: ClientError: No valid partitions. Not a valid volume., error: %!s(                                                                                                                                                 
)                                                                                                                                                                                                                           
* Post-processor failed: Import task import-ami-03054a8da6b346888 failed with st                                                                                                                                                 
atus message: ClientError: No valid partitions. Not a valid volume., error: %!s(                                                                                                                                                 
)                                                                                                                                                                                                                           
2019/01/16 11:09:44 Builds completed. Waiting on interrupt barrier...                                                                                                                                                            
2019/01/16 11:09:44 machine readable: error-count []string{"1"}                                                                                                                                                                  
                                                                                                                                                                                                                                 
==> Some builds didn't complete successfully and had errors:                                                                                                                                                                     
2019/01/16 11:09:44 ui error:                                                                                                                                                                                                    
==> Some builds didn't complete successfully and had errors:                                                                                                                                                                     
2019/01/16 11:09:44 machine readable: virtualbox-ovf,error []string{"1 error(s)                                                                                                                                                  
occurred:\n\n* Post-processor failed: Import task import-ami-03054a8da6b346888 f                                                                                                                                                 
ailed with status message: ClientError: No valid partitions. Not a valid volume.                                                                                                                                                 
, error: %!s()"}                                                                                                                                                                                                            
2019/01/16 11:09:44 ui error: --> virtualbox-ovf: 1 error(s) occurred:                                                                                                                                                           
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-03054a8da6b346888 failed with st                                                                                                                                                 
atus message: ClientError: No valid partitions. Not a valid volume., error: %!s(                                                                                                                                                 
)                                                                                                                                                                                                                           
==> Builds finished but no artifacts were created.                                                                                                                                                                               
2019/01/16 11:09:44 [INFO] (telemetry) Finalizing.                                                                                                                                                                               
--> virtualbox-ovf: 1 error(s) occurred:                                                                                                                                                                                         
                                                                                                                                                                                                                                 
* Post-processor failed: Import task import-ami-03054a8da6b346888 failed with st                                                                                                                                                 
atus message: ClientError: No valid partitions. Not a valid volume., error: %!s(                                                                                                                                                 
)                                                                                                                                                                                                                           
                                                                                                                                                                                                                                 
==> Builds finished but no artifacts were created.                                                                                                                                                                               
2019/01/16 11:09:45 waiting for all plugin processes to complete...                                                                                                                                                              
2019/01/16 11:09:45 C:\Users\Morgan Davis\Desktop\packer.exe: plugin process exi                                                                                                                                                 
ted                                                                                                                                                                                                                              
2019/01/16 11:09:45 C:\Users\Morgan Davis\Desktop\packer.exe: plugin process exi                                                                                                                                                 
ted

Rickard von Essen

unread,
Jan 17, 2019, 7:41:46 AM1/17/19
to packe...@googlegroups.com
Opened this PR to improve the error message. https://github.com/hashicorp/packer/pull/7207

Attached a updated build with this fix:

Reply all
Reply to author
Forward
0 new messages