packer-builder-hcloud icon indicating copy to clipboard operation
packer-builder-hcloud copied to clipboard

Server crashs after File Upload

Open nightmare-rg opened this issue 5 years ago • 1 comments

packer build -var-file=vars.json base.json
testbuild output will be in this color.

==> testbuild: Creating temporary ssh key
==> testbuild: Creating new server: packer-hcloud-1535534241
==> testbuild: Created server 1021785
==> testbuild: Waiting for the server to be running...
==> testbuild: Waiting for the server to be running...
==> testbuild: Waiting for SSH to become available...
==> testbuild: Connected to SSH!
==> testbuild: Provisioning with shell script: /Users/joe/packer.io/allezcom_hcloud/scripts/provision.sh
==> testbuild: Provisioning with shell script: /Users/joe/packer.io/allezcom_hcloud/scripts/mysql-user.sh
==> testbuild: Provisioning with shell script: /Users/joe/packer.io/allezcom_hcloud/scripts/floating-ip.sh
==> testbuild: Provisioning with shell script: /Users/joe/packer.io/allezcom_hcloud/scripts/apt-cleanup.sh
==> testbuild: Uploading /Users/joe/packer.io/allezcom_hcloud/scripts/nginx-vhost.conf => /etc/nginx/sites-available/testfile.conf
==> testbuild: Waiting for server 1021785 to be destroyed...
==> testbuild: Deleting temporary ssh key...
==> testbuild: Got state error: msgpack decode error [pos 125487]: readContainerLen: Unrecognized descriptor byte: hex: c4, decimal: 196
Build 'testbuild' errored: msgpack decode error [pos 125487]: readContainerLen: Unrecognized descriptor byte: hex: c4, decimal: 196

==> Some builds didn't complete successfully and had errors:
--> testbuild: msgpack decode error [pos 125487]: readContainerLen: Unrecognized descriptor byte: hex: c4, decimal: 196

==> Builds finished but no artifacts were created.

I stripped out unnecessary output.

crash.log show nothing with my timestamp. only older builds.

My provisioners section in base.json

"provisioners": [
        {
            "type": "shell",
            "environment_vars": [
              "floating_ip={{user `floating_ip`}}",
              "mysql_root={{user `mysql_root`}}",
              "nodejs_version={{user `nodejs_version`}}",
              "yarn_version={{user `yarn_version`}}",
              "mysql_user={{user `mysql_user`}}",
              "mysql_pass={{user `mysql_pass`}}",
              "mysql_dbs={{user `mysql_dbs`}}"
            ],
            "scripts": [
                "{{ template_dir }}/scripts/provision.sh",
                "{{ template_dir }}/scripts/mysql-user.sh",
                "{{ template_dir }}/scripts/floating-ip.sh",
                "{{ template_dir }}/scripts/apt-cleanup.sh"
            ]
        },
        {
          "type": "file",
          "source": "{{ template_dir }}/scripts/nginx-vhost.conf",
          "destination": "/etc/nginx/sites-available/testfile.conf",
          "direction": "upload"
        },
        {
            "type": "shell",
            "environment_vars": [
              "vhost={{user `vhost`}}"
            ],
            "scripts": [
                "{{ template_dir }}/scripts/vhost.sh"
            ]
        }
    ],

If i remove this section everything works fine:

        {
          "type": "file",
          "source": "{{ template_dir }}/scripts/nginx-vhost.conf",
          "destination": "/etc/nginx/sites-available/testfile.conf",
          "direction": "upload"
        },

With -debug it shows the same

==> testbuild: Provisioning with shell script: /Users/joe/packer.io/allezcom_hcloud/scripts/apt-cleanup.sh
==> testbuild: Pausing before the next provisioner . Press enter to continue.
==> testbuild: Uploading /Users/joe/packer.io/allezcom_hcloud/scripts/nginx-vhost.conf => /etc/nginx/sites-available/testfile.conf
==> testbuild: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
==> testbuild: Pausing before cleanup of step 'stepWaitForServer'. Press enter to continue.
==> testbuild: Pausing before cleanup of step 'stepCreateServer'. Press enter to continue.
==> testbuild: Waiting for server 1021802 to be destroyed...
==> testbuild: Pausing before cleanup of step 'stepCreateSSHKey'. Press enter to continue.
==> testbuild: Deleting temporary ssh key...
==> testbuild: Got state error: msgpack decode error [pos 124959]: readContainerLen: Unrecognized descriptor byte: hex: c4, decimal: 196
Build 'testbuild' errored: msgpack decode error [pos 124959]: readContainerLen: Unrecognized descriptor byte: hex: c4, decimal: 196

So i don't know if it is a hcloud plugin error or packer.io error. I will test it with EC2 later. Actually I'm on the latest versions (packer.io v1.2.5 and packer-builder-hcloud built yesterday).

nightmare-rg avatar Aug 29 '18 09:08 nightmare-rg

Had the same problem recently. Only workaround I found was to specify a folder instead of specific files.

RCM7 avatar Oct 08 '18 17:10 RCM7