Package: packer
Version: 1.6.6+ds1-7
Severity: grave

Hello.

I'm using packer and ansible to create images for GCP.

After upgrading to Debian bookworm, packer crashes on
the most simple template:

$ packer build sample.pkr.hcl
panic: ConfigSpec failed: gob: type cty.Type has no exported fields [recovered]
        panic: ConfigSpec failed: gob: type cty.Type has no exported fields

goroutine 1 [running]:
log.Panic({0xc00083e8e8?, 0x0?, 0x0?})
        log/log.go:388 +0x65
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).checkExit(0xc0005e0490?,
 {0x314b860, 0xc0005e04c0}, 0x0)
        github.com/hashicorp/packer/packer/plugin/builder.go:47 +0x7f
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).ConfigSpec.func1()
        github.com/hashicorp/packer/packer/plugin/builder.go:19 +0x39
panic({0x314b860, 0xc0005e04c0})
        runtime/panic.go:884 +0x212
github.com/hashicorp/packer/packer-plugin-sdk/rpc.(*commonClient).ConfigSpec(0xc00068e9e0)
        github.com/hashicorp/packer/packer-plugin-sdk/rpc/common.go:44 +0x297
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).ConfigSpec(0xc00047f0d0?)
        github.com/hashicorp/packer/packer/plugin/builder.go:22 +0x65
github.com/hashicorp/packer/hcl2template.decodeHCL2Spec({0x4447708, 
0xc000483650}, 0xd?, {0x7fc2746a1680?, 0xc0004728a0?})
        github.com/hashicorp/packer/hcl2template/decode.go:17 +0x39
github.com/hashicorp/packer/hcl2template.(*PackerConfig).startBuilder(0x3379060?,
 {{0xc000792540, 0xd}, {0xc000792570, 0xa}, 0xc0004cd1e0, {0x0, 0x0}, {0x0, 
0x0}}, ...)
        github.com/hashicorp/packer/hcl2template/types.source.go:110 +0x16a
github.com/hashicorp/packer/hcl2template.(*PackerConfig).GetBuilds(0xc00077f320,
 {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}})
        github.com/hashicorp/packer/hcl2template/types.packer_config.go:396 
+0xb48
github.com/hashicorp/packer/command.(*BuildCommand).RunContext(0xc000053920, 
{0x4447120?, 0xc0000aa540}, 0xc000782120)
        github.com/hashicorp/packer/command/build.go:156 +0x1b5
github.com/hashicorp/packer/command.(*BuildCommand).Run(0xc000053920, 
{0xc000112170, 0x1, 0x1})
        github.com/hashicorp/packer/command/build.go:40 +0xc5
github.com/mitchellh/cli.(*CLI).Run(0xc000748640)
        github.com/mitchellh/cli/cli.go:261 +0x5f8
main.wrappedMain()
        github.com/hashicorp/packer/main.go:249 +0xb11
main.realMain()
        github.com/hashicorp/packer/main.go:50 +0xf5
main.main()
        github.com/hashicorp/packer/main.go:36 +0x19



!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Packer crashed! This is always indicative of a bug within Packer.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Packer[1] so that we can fix this.

[1]: https://github.com/hashicorp/packer/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

This is the template I'm using:

-----------------------------------------------------------------
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "googlecompute" "buildd-gce" {
  account_file        = "my-account-file.json"
  image_family        = "debian-12-buildd"
  image_name          = "debian-12-buildd-amd64-${local.timestamp}"
  machine_type        = "n1-standard-1"
  disk_size           = 10
  project_id          = "my-project-id"
  source_image_family = "debian-11"
  ssh_username        = "packer"
  tags                = ["ssh"]
  zone                = "us-central1-f"
}

build {
  sources = ["source.googlecompute.buildd-gce"]

  provisioner "ansible" {
    extra_arguments = ["--become"]
    groups          = ["buildd"]
    playbook_file   = "playbooks/buildd-gce.yml"
  }

}
-----------------------------------------------------------------

I'm also attaching the crash.log file.


For completeness: Version 1.8.6 from github does not crash, but it has
two subtle incompatibilities with openssh-client in bookworm:

https://github.com/hashicorp/packer-plugin-ansible/issues/140
https://github.com/hashicorp/packer/issues/11783

I was going to report those issues here for documentation purposes,
as both of them have workarounds. but then I found the Debian
version seems not to work at all.

Thanks.
2023/03/08 18:30:02 [INFO] Packer version: 1.6.6 [go1.19.6 linux amd64]
2023/03/08 18:30:02 Checking 'PACKER_CONFIG' for a config file path
2023/03/08 18:30:02 'PACKER_CONFIG' not set; checking the default config file path
2023/03/08 18:30:02 Attempting to open config file: /home/bluser/.packerconfig
2023/03/08 18:30:02 [WARN] Config file doesn't exist: /home/bluser/.packerconfig
2023/03/08 18:30:02 Setting cache directory: /home/bluser/packer_cache
2023/03/08 18:30:02 [TRACE] validateValue: not active for timestamp, so skipping
2023/03/08 18:30:02 [TRACE] validateValue: not active for timestamp, so skipping
2023/03/08 18:30:02 [TRACE] validateValue: not active for timestamp, so skipping
2023/03/08 18:30:02 Creating plugin client for path: /usr/bin/packer
2023/03/08 18:30:02 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-googlecompute"}
2023/03/08 18:30:02 Waiting for RPC address for: /usr/bin/packer
2023/03/08 18:30:02 packer-builder-googlecompute plugin: [INFO] Packer version: 1.6.6 [go1.19.6 linux amd64]
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Checking 'PACKER_CONFIG' for a config file path
2023/03/08 18:30:02 packer-builder-googlecompute plugin: 'PACKER_CONFIG' not set; checking the default config file path
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Attempting to open config file: /home/bluser/.packerconfig
2023/03/08 18:30:02 packer-builder-googlecompute plugin: [WARN] Config file doesn't exist: /home/bluser/.packerconfig
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Setting cache directory: /home/bluser/packer_cache
2023/03/08 18:30:02 packer-builder-googlecompute plugin: args: []string{"packer-builder-googlecompute"}
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Plugin address: unix /tmp/packer-plugin1605207489
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Waiting for connection...
2023/03/08 18:30:02 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin1605207489
2023/03/08 18:30:02 packer-builder-googlecompute plugin: Serving a plugin connection...
2023/03/08 18:30:02 ConfigSpec failed: gob: type cty.Type has no exported fields
2023/03/08 18:30:02 waiting for all plugin processes to complete...
2023/03/08 18:30:02 /usr/bin/packer: plugin process exited
panic: ConfigSpec failed: gob: type cty.Type has no exported fields [recovered]
	panic: ConfigSpec failed: gob: type cty.Type has no exported fields

goroutine 1 [running]:
log.Panic({0xc00083e8e8?, 0x0?, 0x0?})
	log/log.go:388 +0x65
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).checkExit(0xc0005e0490?, {0x314b860, 0xc0005e04c0}, 0x0)
	github.com/hashicorp/packer/packer/plugin/builder.go:47 +0x7f
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).ConfigSpec.func1()
	github.com/hashicorp/packer/packer/plugin/builder.go:19 +0x39
panic({0x314b860, 0xc0005e04c0})
	runtime/panic.go:884 +0x212
github.com/hashicorp/packer/packer-plugin-sdk/rpc.(*commonClient).ConfigSpec(0xc00068e9e0)
	github.com/hashicorp/packer/packer-plugin-sdk/rpc/common.go:44 +0x297
github.com/hashicorp/packer/packer/plugin.(*cmdBuilder).ConfigSpec(0xc00047f0d0?)
	github.com/hashicorp/packer/packer/plugin/builder.go:22 +0x65
github.com/hashicorp/packer/hcl2template.decodeHCL2Spec({0x4447708, 0xc000483650}, 0xd?, {0x7fc2746a1680?, 0xc0004728a0?})
	github.com/hashicorp/packer/hcl2template/decode.go:17 +0x39
github.com/hashicorp/packer/hcl2template.(*PackerConfig).startBuilder(0x3379060?, {{0xc000792540, 0xd}, {0xc000792570, 0xa}, 0xc0004cd1e0, {0x0, 0x0}, {0x0, 0x0}}, ...)
	github.com/hashicorp/packer/hcl2template/types.source.go:110 +0x16a
github.com/hashicorp/packer/hcl2template.(*PackerConfig).GetBuilds(0xc00077f320, {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}})
	github.com/hashicorp/packer/hcl2template/types.packer_config.go:396 +0xb48
github.com/hashicorp/packer/command.(*BuildCommand).RunContext(0xc000053920, {0x4447120?, 0xc0000aa540}, 0xc000782120)
	github.com/hashicorp/packer/command/build.go:156 +0x1b5
github.com/hashicorp/packer/command.(*BuildCommand).Run(0xc000053920, {0xc000112170, 0x1, 0x1})
	github.com/hashicorp/packer/command/build.go:40 +0xc5
github.com/mitchellh/cli.(*CLI).Run(0xc000748640)
	github.com/mitchellh/cli/cli.go:261 +0x5f8
main.wrappedMain()
	github.com/hashicorp/packer/main.go:249 +0xb11
main.realMain()
	github.com/hashicorp/packer/main.go:50 +0xf5
main.main()
	github.com/hashicorp/packer/main.go:36 +0x19

Reply via email to