hashicorp / packer-plugin-vagrant

Packer plugin for Vagrant
https://packer.io
Mozilla Public License 2.0
13 stars 24 forks source link

vagrant-libvirt post processor: Cannot build vagrant-libvirt box from an another vagrant-libvirt box, unexpected EOF #25

Open hc-github-team-packer opened 2 years ago

hc-github-team-packer commented 2 years ago

This issue was originally opened by @vadorovsky in https://github.com/hashicorp/packer/issues/11148 and has been migrated to this repository. The original issue description is below.


Overview of the Issue

I'm trying to build my own vagrant-libvirt box based on this one:

https://app.vagrantup.com/opensuse/boxes/Tumbleweed.x86_64

Here is the buildfile I'm using:

https://github.com/rancher-sandbox/enclave/blob/vagrant-workers/contrib/packer/control-plane-libvirt.json

Reproduction Steps

Do

packer build -force control-plane-libvirt.json

on the following buildfile: https://github.com/rancher-sandbox/enclave/blob/vagrant-workers/contrib/packer/control-plane-libvirt.json

Packer version

Packer v1.7.3

Simplified Packer Buildfile

https://github.com/rancher-sandbox/enclave/blob/vagrant-workers/contrib/packer/control-plane-libvirt.json

Operating system and Environment details

openSUSE Tumbleweed x86_64 kernel 5.13.0-1-default libvirt 7.5.0

Log Fragments and crash.log files

(Probably) the most important fragment:

2021/07/14 19:16:05 ui: ==> vagrant (vagrant): Creating a dummy Vagrant box to ensure the host system can create one correctly
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Turning dir into box: /tmp/packer006449265 => /tmp/box-601523484.box
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Compressing with gzip compression level: -1
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Skipping directory '/tmp/packer006449265' for box '/tmp/box-601523484.box'
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Box add: '/tmp/packer006449265/metadata.json' to '/tmp/box-601523484.box'
2021/07/14 19:16:05 ui: ==> vagrant (vagrant): Creating Vagrant box for 'libvirt' provider
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: panic: interface conversion: interface {} is nil, not string
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: 
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: goroutine 94 [running]:
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*LibVirtProvider).Process(0x8e563c0, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0xc0007aa408, 0x14, 0x0, 0x5, 0x100, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /home/circleci/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.0/post-processor/vagrant/libvirt.go:67 +0x918
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcessProvider(0xc000e3f1e0, 0xc00053c560, 0x7, 0x5e24c90, 0x8e563c0, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0x0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /home/circleci/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.0/post-processor/vagrant/post-processor.go:158 +0x831
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcess(0xc000e3f1e0, 0x5e4ce20, 0xc000278100, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0x5e27cb0, 0x203000, 0x5dbc5c0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /home/circleci/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.0/post-processor/vagrant/post-processor.go:230 +0x199
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-sdk/rpc.(*PostProcessorServer).PostProcess(0xc00011e040, 0x1, 0xc00041a000, 0x0, 0x0)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /home/circleci/go/pkg/mod/github.com/hashicorp/packer-plugin-sdk@v0.2.3/rpc/post_processor.go:108 +0x19a
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: reflect.Value.call(0xc000100480, 0xc00000e3a8, 0x13, 0x56cc20d, 0x4, 0xc000041f08, 0x3, 0x3, 0xc00021e140, 0xc000219f68, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /usr/local/go/src/reflect/value.go:476 +0x8e7
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: reflect.Value.Call(0xc000100480, 0xc00000e3a8, 0x13, 0xc000219f08, 0x3, 0x3, 0xc00021e140, 0x4aaf820, 0xc0005ae000)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /usr/local/go/src/reflect/value.go:337 +0xb9
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: net/rpc.(*service).call(0xc00053e2c0, 0xc0004fe190, 0xc0005ae310, 0xc0005ae320, 0xc00079a200, 0xc00047c160, 0x469d880, 0xc0005ae00c, 0x18a, 0x44d48a0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /usr/local/go/src/net/rpc/server.go:377 +0x189
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: created by net/rpc.(*Server).ServeCodec
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:   /usr/local/go/src/net/rpc/server.go:474 +0x44d
2021/07/14 19:16:05 [INFO] (telemetry) ending vagrant
2021/07/14 19:16:05 Deleting original artifact for build 'vagrant'
2021/07/14 19:16:05 /home/vadorovsky/bin/packer: plugin process exited
2021/07/14 19:16:05 ui error: Build 'vagrant' errored after 3 minutes 197 milliseconds: 1 error(s) occurred:

crash.log: https://gist.github.com/vadorovsky/797599ab4c3df4ebce6514a274dd5b6f

Romainj1 commented 2 years ago

I reproduced the same error !

2 points:

Please note that if you are using the Vagrant builder, then the Vagrant post-processor is unnecessary because the output of the Vagrant builder is already a Vagrant box; using this post-processor with the Vagrant builder will cause your build to fail.

jaunruh commented 2 years ago

+1

I am running a vagrant-libvirt post-processor for an azure-arm source.

source "azure-arm" "win22s" {
  // azure settings
}

build {
  sources = ["sources.azure-arm.win22s"]

  provisioner "file" {
    // file provisioners
  }

  provisioner "powershell" {
    // powershell provisioners
  }

  provisioner "windows-restart" {}

  provisioner "powershell" {
    // required vm preperation
  }

  post-processors {  
    post-processor "vagrant" {
      keep_input_artifact = true
      provider_override = "libvirt"
    }  
  }  
}

Resulting in the following .log:

==> azure-arm.win22s (vagrant): Creating a dummy Vagrant box to ensure the host system can create one correctly
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: Turning dir into box: /var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/packer1148182668 => /var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/box-2991777212.box
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: Compressing with gzip compression level: -1
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: Skipping directory '/var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/packer1148182668' for box '/var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/box-2991777212.box'
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: Box add: '/var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/packer1148182668/metadata.json' to '/var/folders/vn/7nt3vs6d22bf_53xf12kvllr0000gn/T/box-2991777212.box'
==> azure-arm.win22s (vagrant): Creating Vagrant box for 'libvirt' provider
Build 'azure-arm.win22s' errored after 20 minutes 43 seconds: 1 error(s) occurred:

* Post-processor failed: unexpected EOF

==> Wait completed after 20 minutes 43 seconds

==> Some builds didn't complete successfully and had errors:
--> azure-arm.win22s: 1 error(s) occurred:

* Post-processor failed: unexpected EOF

==> Builds finished but no artifacts were created.
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: panic: interface conversion: interface {} is nil, not string
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: goroutine 202 [running]:
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*LibVirtProvider).Process(0x5e655e0, {0x66285d8, 0xc000d8b0b0}, {0x6628620, 0xc0000cb2a0}, {0xc00012afa0, 0x41})
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.1/post-processor/vagrant/libvirt.go:67 +0x69b
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcessProvider(0x10000c00040e770, {0xc000079a98, 0x28}, {0x65d0bb0, 0x9f6aac0}, {0x66285d8, 0xc000d8b0b0}, {0x6628620, 0xc0000cb2a0})
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.1/post-processor/vagrant/post-processor.go:158 +0x706
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcess(0xc000b2edc0, {0xc0000780f0, 0x0}, {0x66285d8, 0xc000d8b0b0}, {0x6628620, 0xc0000cb2a0})
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/go/pkg/mod/github.com/hashicorp/packer-plugin-vagrant@v1.0.1/post-processor/vagrant/post-processor.go:230 +0x49a
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-sdk/rpc.(*PostProcessorServer).PostProcess(0xc000d9a040, 0x79c70, 0xc0000df4c0)
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/go/pkg/mod/github.com/hashicorp/packer-plugin-sdk@v0.2.12-0.20220216103740-f7d4bf877a45/rpc/post_processor.go:108 +0x18c
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: reflect.Value.call({0xc0005b6840, 0xc00000e948, 0x13}, {0x5e612c7, 0x4}, {0xc000791ef8, 0x3, 0x3})
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/hostedtoolcache/go/1.17.8/x64/src/reflect/value.go:556 +0x845
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: reflect.Value.Call({0xc0005b6840, 0xc00000e948, 0x0}, {0xc000646ef8, 0x3, 0x3})
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/hostedtoolcache/go/1.17.8/x64/src/reflect/value.go:339 +0xc5
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: net/rpc.(*service).call(0xc000d9a080, 0x0, 0x0, 0xc000079010, 0xc00049e480, 0x0, {0x4df1220, 0xc000079c50, 0x0}, {0x4c2a1a0, ...}, ...)
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/hostedtoolcache/go/1.17.8/x64/src/net/rpc/server.go:377 +0x239
2022/04/22 11:46:08 packer-post-processor-vagrant plugin: created by net/rpc.(*Server).ServeCodec
2022/04/22 11:46:08 packer-post-processor-vagrant plugin:   /Users/runner/hostedtoolcache/go/1.17.8/x64/src/net/rpc/server.go:474 +0x405
2022/04/22 11:46:08 [INFO] (telemetry) ending vagrant
2022/04/22 11:46:08 /usr/local/bin/packer: plugin process exited
2022/04/22 11:46:08 Deleting original artifact for build 'azure-arm.win22s'

* Post-processor failed: unexpected EOF
==> Wait completed after 20 minutes 43 seconds
2022/04/22 11:46:08 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2022/04/22 11:46:08 machine readable: azure-arm.win22s,error []string{"1 error(s) occurred:\n\n* Post-processor failed: unexpected EOF"}

* Post-processor failed: unexpected EOF
==> Builds finished but no artifacts were created.
2022/04/22 11:46:08 [INFO] (telemetry) Finalizing.
2022/04/22 11:46:09 waiting for all plugin processes to complete...
2022/04/22 11:46:09 /usr/local/bin/packer: plugin process exited
2022/04/22 11:46:09 /usr/local/bin/packer: plugin process exited
2022/04/22 11:46:09 /usr/local/bin/packer: plugin process exited
2022/04/22 11:46:09 /usr/local/bin/packer: plugin process exited
2022/04/22 11:46:09 [ERR] Error decoding response stream 19: EOF
2022/04/22 11:46:09 /usr/local/bin/packer: plugin process exited

EDIT: I have tried to execute this script on MacOS 12.3.1 and on Ubuntu 20.04 both running Packer 1.8.0.

Tash1nka commented 4 months ago

Same here in 2024, running packer 1.10.1 with vagrant plugins v1.1.2 on Arch.