2

My packer build seems to run all commands successfully, but keeps hanging on the last cmd. This is the end of my packer output on debug mode. I am unsure how to get past this. It seems to get stuck on removing the temporary script.

==> amazon-ebs: + systemctl stop httpd
    amazon-ebs: apache-tomcat-8.5.53/bin/version.sh
==> amazon-ebs: + systemctl start tomcat
==> amazon-ebs: + systemctl enable tomcat
==> amazon-ebs: Created symlink from /etc/systemd/system/multi-user.target.wants/tomcat.service to /etc/systemd/system/tomcat.service.
==> amazon-ebs: + firewall-offline-cmd --add-port=8080/tcp
    amazon-ebs: success
==> amazon-ebs: + systemctl unmask --now firewalld
==> amazon-ebs: Removed symlink /etc/systemd/system/firewalld.service.
==> amazon-ebs: + systemctl enable firewalld
==> amazon-ebs: Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
==> amazon-ebs: Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
==> amazon-ebs: + systemctl start firewalld
==> amazon-ebs: + echo 'boostrap finished'
    amazon-ebs: boostrap finished
==> amazon-ebs: + sleep 30
2020/04/01 20:55:22 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 0
2020/04/01 20:55:22 [INFO] 69661 bytes written for 'stdout'
2020/04/01 20:55:22 [INFO] 276662 bytes written for 'stderr'
2020/04/01 20:55:22 [INFO] RPC client: Communicator ended with: 0
2020/04/01 20:55:22 [INFO] RPC endpoint: Communicator ended with: 0
2020/04/01 20:55:22 packer-provisioner-shell plugin: [INFO] 69661 bytes written for 'stdout'
2020/04/01 20:55:22 packer-provisioner-shell plugin: [INFO] 276662 bytes written for 'stderr'
2020/04/01 20:55:22 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2020/04/01 20:55:22 packer-builder-amazon-ebs plugin: [DEBUG] Opening new ssh session
2020/04/01 20:55:22 packer-builder-amazon-ebs plugin: [DEBUG] starting remote command: rm -f /tmp/script_3825.sh
2020/04/01 20:55:22 packer-builder-amazon-ebs plugin: [ERROR] Remote command exited with '1': rm -f /tmp/script_3825.sh
2020/04/01 20:55:22 packer-builder-amazon-ebs plugin: [INFO] RPC endpoint: Communicator ended with: 1

I am using the following provisioner:

  {
    "type": "shell",
    "script": "bootstrap/bootstrap.sh",
    "execute_command": "echo 'packer' | sudo -S env {{ .Vars }} {{ .Path }}"
  }

And the final error is:

2020/04/01 21:00:54 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2020/04/01 21:00:54 machine readable: amazon-ebs,error []string{"Error removing temporary script at /tmp/script_3825.sh!"}
==> Builds finished but no artifacts were created.
2020/04/01 21:00:54 [INFO] (telemetry) Finalizing.
Build 'amazon-ebs' errored: Error removing temporary script at /tmp/script_3825.sh!
Lukeriggz
  • 167
  • 4
  • 17

1 Answers1

3

Your bootstrap script seems to block new ssh connections so that packer can't cleanup the temporary script it uploaded.

If that is the intention you can skip cleanup with skip_clean.

Rickard von Essen
  • 4,110
  • 2
  • 23
  • 27