Packer: Panic while running Ansible on AWS

Created on 7 Aug 2019  ยท  4Comments  ยท  Source: hashicorp/packer

I'm using Packer to build new AWS AMIs using Ansible. Everything seems to go along fine until Ansible finishes with an error. Packer then panics with this type of output:

2019/08/07 18:09:55 packer: 2019/08/07 18:09:55 [ERROR] Remote command exited with '2': cd /tmp/packer-provisioner-ansible-local/5d4b13b5-6ce3-9522-e94e-7fe1a9ebcdad && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook /tmp/packer-provisioner-ansible-local/5d4b13b5-6ce3-9522-e94e-7fe1a9ebcdad/packer.yml --extra-vars "packer_build_name=amazon-ebs packer_builder_type=amazon-ebs packer_http_addr= -o IdentitiesOnly=yes" -e build_id=450539e8e6f6 -vv -c local -i /tmp/packer-provisioner-ansible-local/5d4b13b5-6ce3-9522-e94e-7fe1a9ebcdad/packer-provisioner-ansible-local255794741
2019/08/07 18:09:55 packer: 2019/08/07 18:09:55 [INFO] RPC endpoint: Communicator ended with: 2
2019/08/07 18:09:55 [INFO] 17368 bytes written for 'stdout'
2019/08/07 18:09:55 [INFO] 96 bytes written for 'stderr'
2019/08/07 18:09:55 [INFO] RPC client: Communicator ended with: 2
2019/08/07 18:09:55 [INFO] RPC endpoint: Communicator ended with: 2
2019/08/07 18:09:55 packer: 2019/08/07 18:09:55 [INFO] 17368 bytes written for 'stdout'
2019/08/07 18:09:55 packer: 2019/08/07 18:09:55 [INFO] 96 bytes written for 'stderr'
2019/08/07 18:09:55 packer: 2019/08/07 18:09:55 [INFO] RPC client: Communicator ended with: 2
2019/08/07 18:09:55 [INFO] (telemetry) ending ansible-local
2019/08/07 18:09:55 ui error: ==> amazon-ebs: Error executing Ansible: Non-zero exit status: 2
2019/08/07 18:09:55 ui: ==> amazon-ebs: Step "StepProvision" failed
2019/08/07 18:09:55 ui: ask: ==> amazon-ebs: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x2270426]

goroutine 302 [running]:
github.com/hashicorp/packer/vendor/github.com/mattn/go-tty.(*TTY).output(...)
    /Users/mmarsh/go/src/github.com/hashicorp/packer/vendor/github.com/mattn/go-tty/tty_unix.go:101
github.com/hashicorp/packer/vendor/github.com/mattn/go-tty.(*TTY).Output(0x0, 0x258b280)
    /Users/mmarsh/go/src/github.com/hashicorp/packer/vendor/github.com/mattn/go-tty/tty.go:46 +0x6
github.com/hashicorp/packer/vendor/github.com/mattn/go-tty.(*TTY).ReadString(0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/mmarsh/go/src/github.com/hashicorp/packer/vendor/github.com/mattn/go-tty/tty.go:90 +0x3c
github.com/hashicorp/packer/packer.(*BasicUi).Ask.func1(0xc000082e40, 0xc00030ff80)
    /Users/mmarsh/go/src/github.com/hashicorp/packer/packer/ui.go:212 +0x40
created by github.com/hashicorp/packer/packer.(*BasicUi).Ask
    /Users/mmarsh/go/src/github.com/hashicorp/packer/packer/ui.go:211 +0x238

bug provisioneansible-remote waiting-reply

Most helpful comment

I know we had some TTY bugs in the 1.4.0 and 1.4.1 releases; can you give this a try with 1.4.2 and see if it's still an issue for you?

All 4 comments

I know we had some TTY bugs in the 1.4.0 and 1.4.1 releases; can you give this a try with 1.4.2 and see if it's still an issue for you?

Was this solved by the v1.4.2 release, or is this still an issue?

Closing since we haven't heard back and I think there's a good chance this was solved in recent releases.

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

shantanugadgil picture shantanugadgil  ยท  3Comments

sourav82 picture sourav82  ยท  3Comments

jesse-c picture jesse-c  ยท  3Comments

DanielBo picture DanielBo  ยท  3Comments

brettswift picture brettswift  ยท  3Comments