unexpected EOF / nil pointer dereference when using ansible provisioner on digitalocean builder

66 views
Skip to first unread message

Loren Jan Wilson

unread,
Apr 22, 2018, 6:53:15 PM4/22/18
to Packer
Hello!

I'm seeing an "unexpected EOF" error whenever I run packer in a way that uses the ansible provisioner.

This one is particularly weird because the same commands worked fine a couple of weeks ago and, to my knowledge, I haven't updated anything or changed the packer or ansible software versions.

The error message I'm seeing is below. I can gist the full output if needed.

$ packer --version
1.2.2

$ ansible --version
ansible 2.5.0
  config file = None
  configured module search path = [u'/home/loren/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14+ (default, Feb  6 2018, 19:12:18) [GCC 7.3.0]

$ PACKER_LOG=1 packer build -debug buildbot.json
<snip>
2018/04/22 18:28:58 [INFO] (telemetry) Starting provisioner ansible
2018/04/22 18:28:58 ui: ==> digitalocean: Provisioning with Ansible...
==> digitalocean: Provisioning with Ansible...
2018/04/22 18:28:59 packer: 2018/04/22 18:28:59 SSH proxy: serving on 127.0.0.1:35145
2018/04/22 18:28:59 ui: ==> digitalocean: Executing Ansible: ansible-playbook <REDACTED>
    digitalocean:
2018/04/22 18:29:00 ui:     digitalocean:
2018/04/22 18:29:00 ui:     digitalocean: PLAY [Install python2 so that Ansible can run] *********************************
    digitalocean: PLAY [Install python2 so that Ansible can run] *********************************
2018/04/22 18:29:01 ui:     digitalocean:
    digitalocean:
2018/04/22 18:29:31 ui:     digitalocean: TASK [Install python2] *********************************************************
    digitalocean: TASK [Install python2] *********************************************************
2018/04/22 18:29:31 packer: 2018/04/22 18:29:31 SSH proxy: accepted connection
2018/04/22 18:29:31 packer: 2018/04/22 18:29:31 authentication attempt from 127.0.0.1:49448 to 127.0.0.1:35145 as loren using none
2018/04/22 18:29:31 packer: 2018/04/22 18:29:31 authentication attempt from 127.0.0.1:49448 to 127.0.0.1:35145 as loren using publickey
2018/04/22 18:29:31 packer: ==> digitalocean: Pausing before cleanup of step 'StepConnect'. Press enter to continue. 
panic: runtime error: invalid memory address or nil pointer dereference
2018/04/22 18:29:31 packer: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x99b2fc]
2018/04/22 18:29:31 packer: 
2018/04/22 18:29:31 packer: goroutine 96 [running]:
2018/04/22 18:29:31 [INFO] (telemetry) ending ansible
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh.(*CertChecker).CheckCert(0xc42019e4b0, 0xc4201a63c8, 0x5, 0xc42037c2c0, 0xc420272158, 0x5)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh/certs.go:373 +0x57c
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh.(*CertChecker).Authenticate(0xc42019e4b0, 0x22fba00, 0xc42058c080, 0x22f4ba0, 0xc42037c2c0, 0x22e23c0, 0xc42007cae0, 0x0)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh/certs.go:320 +0x85
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh.(*CertChecker).Authenticate-fm(0x22fba00, 0xc42058c080, 0x22f4ba0, 0xc42037c2c0, 0x657, 0x657, 0x0)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/provisioner/ansible/provisioner.go:221 +0x52
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh/server.go:381 +0x17c1
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh.(*connection).serverHandshake(0xc42058c080, 0xc42058a0c0, 0xc42014cee8, 0x4d744c, 0xc4200a80f0)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh/server.go:228 +0x519
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh.NewServerConn(0x22fdfe0, 0xc4201b21a8, 0xc42036a0c0, 0x0, 0x0, 0xc42048d9e0, 0x89609e, 0x1)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/vendor/golang.org/x/crypto/ssh/server.go:159 +0xe7
2018/04/22 18:29:31 packer: github.com/hashicorp/packer/provisioner/ansible.(*adapter).Handle(0xc42019e500, 0x22fdfe0, 0xc4201b21a8, 0x22f8820, 0xc4203511e0, 0xc4201bb2c0, 0x431dc8)
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/provisioner/ansible/adapter.go:67 +0x93
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/provisioner/ansible/adapter.go:57 +0x51
2018/04/22 18:29:31 packer: /Users/phinze/go/src/github.com/hashicorp/packer/provisioner/ansible/adapter.go:56 +0x1d0
2018/04/22 18:29:31 /usr/local/bin/packer: plugin process exited
2018/04/22 18:29:31 ui: ask: ==> digitalocean: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
2018/04/22 18:30:18 ui: ask: ==> digitalocean: Pausing before cleanup of step 'stepDropletInfo'. Press enter to continue.
==> digitalocean: Pausing before cleanup of step 'stepDropletInfo'. Press enter to continue. 
2018/04/22 18:30:34 ui: ask: ==> digitalocean: Pausing before cleanup of step 'stepCreateDroplet'. Press enter to continue.
==> digitalocean: Pausing before cleanup of step 'stepCreateDroplet'. Press enter to continue. 
2018/04/22 18:30:35 ui: ==> digitalocean: Destroying droplet...
==> digitalocean: Destroying droplet...
2018/04/22 18:30:35 ui: ask: ==> digitalocean: Pausing before cleanup of step 'stepCreateSSHKey'. Press enter to continue.
==> digitalocean: Pausing before cleanup of step 'stepCreateSSHKey'. Press enter to continue. 
2018/04/22 18:30:37 ui: ==> digitalocean: Deleting temporary ssh key...
==> digitalocean: Deleting temporary ssh key...
<snip>

Loren Jan Wilson

unread,
Apr 22, 2018, 8:26:33 PM4/22/18
to Packer
Hey, I finally figured out how to fix this... I added 
"user": "root"
to the ansible provisioner in my template, and this caused everything to work again.

My guess is that I was needlessly running packer using sudo before without realizing it.

My only complaint here is that the "unexpected EOF" error message is not nearly as descriptive as I wish it were! 

Perhaps the traceback points to some kind of mild bug, but obviously everything works fine.

Matthew Hooker

unread,
Apr 22, 2018, 10:26:36 PM4/22/18
to packe...@googlegroups.com
Thanks for the update, Loren.

> Perhaps the traceback points to some kind of mild bug, but obviously everything works fine.

We definitely shouldn't ever be panicing. this does indeed look like a "mild" validation bug.

Thanks,
--Matt

--
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/7b7a4d26-a91d-42d0-ad44-12b543e92be2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages