Packer: Packer >= 1.5.2: Incorrect HTTP address in boot command with multi builder templates (Virtualbox ISO and VMware ISO)

Created on 11 May 2020  ·  12Comments  ·  Source: hashicorp/packer

Overview of the Issue

When building a template with vmware-iso and virtualbox-iso builders defined, Packer no longer issues the correct HTTP server IP address to the individual builders - instead, both seem to pick up the IP intended for the virtualbox builder (10.0.2.2). However, each builder still seems to be given the correct HTTP server port. This can be seen in the boot command.

Virtualbox ISO builder:

boot: install auto url=http://10.0.2.2:8763/preseed-std.cfg debian-installer...

VMware ISO builder:

boot: install auto url=http://10.0.2.2:8819/preseed-std.cfg debian-installer...

The 10.0.2.2 address shown in the VMware ISO builders boot command is incorrect - typically this would be a 192.168.x.1 address. The incorrect address prevents the VMware guest from downloading it's preseed or kickstart file and the build hangs and eventually times out.

This occurs with Packer >= v1.5.2. Packer versions <= v1.5.1 behave as expected issuing the correct HTTP IP address to each builder e.g. :

Virtualbox ISO builder:

boot: install auto url=http://10.0.2.2:8518/preseed-std.cfg debian-installer...

VMware ISO builder:

boot: install auto url=http://192.168.236.1:8892/preseed.cfg debian-installer...

Ping @sylviamoss

Reproduction Steps

Build a template with both vmware-iso and virtualbox-iso builders defined (see demo template below).

Packer version

packer versions >= 1.5.2 are affected

Simplified Packer Buildfile

Template HERE

Operating system and Environment details

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G4032

$ VBoxManage version
6.1.6r137129

VMware Fusion: Professional Version 8.5.10 (7527438)

bug buildevirtualbox buildevmware

Most helpful comment

Great! All working here!

==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso: VM files in directory: output-debian-10-std-virtualbox-iso
--> virtualbox-iso:
--> virtualbox-iso: 'virtualbox' provider box: boxes/debian-10-virtualbox.box
--> virtualbox-iso:
--> vmware-iso: VM files in directory: output-debian-10-std-vmware-iso
--> vmware-iso:
--> vmware-iso: 'vmware' provider box: boxes/debian-10-vmware.box
--> vmware-iso:

Thanks for fixing!

All 12 comments

Thanks for letting us know. We will take a look at this for the next release.

Hey @DanHam! It seems it's a concurrency issue. I'll figure out the best solution for this and will let you know. Thanks 👍

Hello @DanHam! I've implemented a solution for this. Could you test it and let me know if it works for you?
here the binaries: https://circleci.com/gh/hashicorp/packer/51902#artifacts/containers/0

Hi @sylviamoss

Thanks for the quick turnaround on this.

Unfortunately I don't have a CircleCI account so I can't access the binaries. Can you provide them another way?

@sylviamoss Sorry - ignore last!

@sylviamoss

Too many accounts. Too few brain cells...

I have now managed to download the binary from the CircleCI build. Unfortunately that doesn't seem to be working for me.

I get a panic at the start of the builds. I'm using the template HERE.

In brief:

2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stdout:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stderr:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: failed to unlock port lockfile: close tcp 127.0.0.1:4184: use of closed network connection
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5944: use of closed network connection
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: Executing VBoxManage: []string{"storageattach", "debian-10-virtualbox-iso", "--storagectl", "IDE Controller", "--port", "0", "--device", "1", "--medium", "none"}
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stdout:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stderr:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: Executing VBoxManage: []string{"unregistervm", "debian-10-virtualbox-iso", "--delete"}
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stdout:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: panic: interface conversion: interface {} is string, not int
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: goroutine 43 [running]:
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: github.com/hashicorp/packer/builder/virtualbox/common.(*StepVBoxManage).Run(0xc0006226c0, 0x5956420, 0xc0006780c0, 0x59308e0, 0xc000671320, 0x0)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /go/src/github.com/hashicorp/packer/builder/virtualbox/common/step_vboxmanage.go:47 +0x856
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc000671380, 0x5956420, 0xc0006780c0, 0x59308e0, 0xc000671320)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /go/src/github.com/hashicorp/packer/helper/multistep/basic_runner.go:67 +0x217
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: github.com/hashicorp/packer/builder/virtualbox/iso.(*Builder).Run(0xc000428a00, 0x5956420, 0xc0006780c0, 0x5973c60, 0xc0006710e0, 0x58de180, 0xc00065ffc0, 0x203000, 0x203000, 0x203000, ...)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /go/src/github.com/hashicorp/packer/builder/virtualbox/iso/builder.go:417 +0x12da
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: github.com/hashicorp/packer/packer/rpc.(*BuilderServer).Run(0xc00018c180, 0x1, 0xc000478940, 0x0, 0x0)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /go/src/github.com/hashicorp/packer/packer/rpc/builder.go:117 +0x27c
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: reflect.Value.call(0xc0004684e0, 0xc0001740f0, 0x13, 0x51bdfc1, 0x4, 0xc000198f18, 0x3, 0x3, 0xc00062ae78, 0x100510c, ...)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /usr/local/go/src/reflect/value.go:460 +0x5f6
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: reflect.Value.Call(0xc0004684e0, 0xc0001740f0, 0x13, 0xc00062af18, 0x3, 0x3, 0xc00009f560, 0xc000626c00, 0xc000626c88)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /usr/local/go/src/reflect/value.go:321 +0xb4
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: net/rpc.(*service).call(0xc00018c1c0, 0xc0003d6280, 0xc0003625a0, 0xc0003625b0, 0xc00026a200, 0xc000420ac0, 0x449a780, 0xc0004788fc, 0x18a, 0x43c70c0, ...)
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /usr/local/go/src/net/rpc/server.go:377 +0x16f
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin: created by net/rpc.(*Server).ServeCodec
2020/05/15 13:19:09 packer-builder-virtualbox-iso plugin:       /usr/local/go/src/net/rpc/server.go:474 +0x42b
2020/05/15 13:19:09 [INFO] (telemetry) ending virtualbox-iso
2020/05/15 13:19:09 /Users/dan/working/go/bin/packer: plugin process exited
2020/05/15 13:19:11 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun -T fusion list
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: stdout: Total running VMs: 1
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: /Users/dan/working/packer-testing/multi-builder/output-debian-10-vmware-iso/debian-10--vmware-iso.vmx
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: stderr:
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: Executing: /Applications/VMware Fusion.app/Contents/Library/vmrun -T fusion stop output-debian-10-vmware-iso/debian-10--vmware-iso.vmx hard
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: stdout:
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: stderr:
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5982: use of closed network connection
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: panic: interface conversion: interface {} is string, not int
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: goroutine 181 [running]:
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: github.com/hashicorp/packer/builder/vmware/common.(*StepTypeBootCommand).Run(0xc0004fdef0, 0x5956420, 0xc0006c9a40, 0x59308e0, 0xc0006b5980, 0x0)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /go/src/github.com/hashicorp/packer/builder/vmware/common/step_type_boot_command.go:47 +0x137c
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc0006b5aa0, 0x5956420, 0xc0006c9a40, 0x59308e0, 0xc0006b5980)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /go/src/github.com/hashicorp/packer/helper/multistep/basic_runner.go:67 +0x217
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: github.com/hashicorp/packer/builder/vmware/iso.(*Builder).Run(0xc00041b100, 0x5956420, 0xc0006c9a40, 0x5973c60, 0xc0006b5830, 0x58de180, 0xc00040ffa0, 0x203000, 0x203000, 0x203000, ...)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /go/src/github.com/hashicorp/packer/builder/vmware/iso/builder.go:190 +0x146c
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: github.com/hashicorp/packer/packer/rpc.(*BuilderServer).Run(0xc000063b80, 0x1, 0xc000483f90, 0x0, 0x0)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /go/src/github.com/hashicorp/packer/packer/rpc/builder.go:117 +0x27c
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: reflect.Value.call(0xc00009e9c0, 0xc0003980b0, 0x13, 0x51bdfc1, 0x4, 0xc00017ff18, 0x3, 0x3, 0x0, 0x0, ...)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /usr/local/go/src/reflect/value.go:460 +0x5f6
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: reflect.Value.Call(0xc00009e9c0, 0xc0003980b0, 0x13, 0xc00064f718, 0x3, 0x3, 0x0, 0x0, 0x0)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /usr/local/go/src/reflect/value.go:321 +0xb4
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: net/rpc.(*service).call(0xc000063bc0, 0xc0005cc500, 0xc000050490, 0xc0000504a0, 0xc00022e700, 0xc0005c8660, 0x449a780, 0xc000483f5c, 0x18a, 0x43c70c0, ...)
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /usr/local/go/src/net/rpc/server.go:377 +0x16f
2020/05/15 13:19:12 packer-builder-vmware-iso plugin: created by net/rpc.(*Server).ServeCodec
2020/05/15 13:19:12 packer-builder-vmware-iso plugin:   /usr/local/go/src/net/rpc/server.go:474 +0x42b
2020/05/15 13:19:12 [INFO] (telemetry) ending vmware-iso
2020/05/15 13:19:12 machine readable: error-count []string{"2"}
==> Some builds didn't complete successfully and had errors:
2020/05/15 13:19:12 machine readable: virtualbox-iso,error []string{"unexpected EOF"}
2020/05/15 13:19:12 machine readable: vmware-iso,error []string{"unexpected EOF"}

Full log and output HERE

Oh no! Thank you for quickly testing this! I'll fix the panic and come back with new binaries!

Ok! Now it should work! I tested with your packer-testing repo template and it went out fine.
Here the binaries: https://circleci.com/gh/hashicorp/packer/51944#artifacts/containers/0
Let me know if it works for you!

Great! All working here!

==> Builds finished. The artifacts of successful builds are:
--> virtualbox-iso: VM files in directory: output-debian-10-std-virtualbox-iso
--> virtualbox-iso:
--> virtualbox-iso: 'virtualbox' provider box: boxes/debian-10-virtualbox.box
--> virtualbox-iso:
--> vmware-iso: VM files in directory: output-debian-10-std-vmware-iso
--> vmware-iso:
--> vmware-iso: 'vmware' provider box: boxes/debian-10-vmware.box
--> vmware-iso:

Thanks for fixing!

Nice!! Thanks for testing!

@sylviamoss No problem. Ping if you need me to test again post review of the PR.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jesse-c picture jesse-c  ·  3Comments

mvermaes picture mvermaes  ·  3Comments

wduncanfraser picture wduncanfraser  ·  3Comments

tleyden picture tleyden  ·  3Comments

mwhooker picture mwhooker  ·  3Comments