Looking at those logs it seems to me that the reboot happens -- the communicator disconnects, then the error happens when ssh fails to reconnect. What happens if you increase the wait time before the next script?
On Wed, Jan 31, 2018 at 2:38 PM, Salvatore Mazzarino <[email protected] > wrote: > After retry several times it works. the point is that the reboot is very > flaky > > On Wednesday, January 31, 2018 at 2:57:48 PM UTC+1, Salvatore Mazzarino > wrote: > >> I'm building an AMI with Hashicorp Packer and this are one of the steps: >> >> { >> "type": "shell", >> "script": "scripts/apt.sh" >> }, >> { >> "type": "shell", >> "inline": ["sudo reboot"], >> "inline_shebang": "/bin/bash -e", >> "expect_disconnect": true >> }, >> { >> "type": "shell", >> "script": "scripts/sysctl.sh", >> "pause_before": "10s" >> }, >> >> >> and here the result: >> >> >> Provisioning with shell script: scripts/apt.sh >> ==> amazon-ebs: Provisioning with shell script: /tmp/packer- >> shell376239929 >> ==> amazon-ebs: Pausing 10s before the next provisioner... >> ==> amazon-ebs: Provisioning with shell script: scripts/sysctl.sh >> amazon-ebs: net.ipv4.ip_forward = 0 >> amazon-ebs: net.ipv4.conf.all.send_redirects = 0 >> amazon-ebs: net.ipv4.conf.default.send_redirects = 0 >> >> >> It is pretty visible that Packer doesn't somehow interpret the reboot >> command but immediately run the next command even though I put there the >> pause attribute. It waits for that 10sec but then no reboot happens. >> >> -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/1c8f73ca-9b91-4b2e-a7dc-bde55bca0aed%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/1c8f73ca-9b91-4b2e-a7dc-bde55bca0aed%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAGPV1urra-PShwdb_%3DL254Z1wz3ugPA3wcg%2Bgm7ZP8bgW5ymMg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
