Packer + Proxmox - Error when setting MTU

Hi,

When trying to set the MTU for my template using packer, I get the error:

2023/03/07 15:26:12 packer-builder-proxmox plugin: Serving a plugin connection…

on ubuntu-20.04.pkr.hcl line 31:
(source code not available)

An argument named “mtu” is not expected here.

2023/03/07 15:26:12 [INFO] (telemetry) Finalizing.
Error: Unsupported argument

on ubuntu-20.04.pkr.hcl line 31:
(source code not available)

An argument named “mtu” is not expected here.

my network_adapters definition looks like:

    network_adapters  {
        model      = "virtio" 
        bridge     = "vmbr99"
        vlan_tag   = "20"
        firewall   = false
        mtu        = 0
    }

it works if I remove the mtu declaration

Does anyone know what could be wrong?

Thanks,

Hi @elg0ch0,

The mtu argument was added to the proxmox plugin recently only (with version 1.1.2), so this could be because the version of the plugin you’re using does not support it.

Since you are using HCL2 for the template, have you defined a required_plugins block in your template?

Hi @lbajolet-hashicorp ,

Thanks for your reply!

I have limited experience with packer so maybe I’m missing something?
I have this config file:

$ cat config.pkr.hcl
packer {
required_plugins {
proxmox = {
version = “>= 1.1.2”
source = “github.com/hashicorp/proxmox
}
}
}

and I executed

packer init config.pkr.hcl

before my build:

packer build -var-file=variables.hcl ubuntu-20.04.pkr.hcl

but still the same error
Should I do something more? or something different?

Regards,

Out of curiosity, have you defined this packer block in the template you’re building? I wonder which version of the plugin is being used for this build.

Could you also try with the PACKER_LOG=1 environment variable set? This way you’ll have more verbose logs and see which version of the plugin is used for this build.

Out of curiosity, have you defined this packer block in the template you’re building? I wonder which version of the plugin is being used for this build.

It has been defined on a different file (config.pkr.hcl), I did:

packer init config.pkr.hcl

export PACKER_LOG=1

packer build -var-file=variables.hcl ubuntu-20.04.pkr.hcl

Could you also try with the PACKER_LOG=1 environment variable set? This way you’ll have more verbose logs and see which version of the plugin is used for this build.

2023/03/08 13:39:05 [INFO] Packer version: 1.8.5 [go1.18.9 linux amd64]

2023/03/08 13:39:05 [TRACE] discovering plugins in /usr/bin

2023/03/08 13:39:05 [TRACE] discovering plugins in /home/ra/.config/packer/plugins

2023/03/08 13:39:05 [DEBUG] Discovered plugin: proxmox = /home/ra/.config/packer/plugins/github.com/hashic

orp/proxmox/packer-plugin-proxmox_v1.1.2_x5.0_linux_amd64

2023/03/08 13:39:06 [INFO] found external [clone iso] builders from proxmox plugin

2023/03/08 13:39:06 [TRACE] discovering plugins in .

2023/03/08 13:39:06 [INFO] PACKER_CONFIG env var not set; checking the default config file path

2023/03/08 13:39:06 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/ra/.packerconf

ig

2023/03/08 13:39:06 [WARN] Config file doesn’t exist: /home/ra/.packerconfig

2023/03/08 13:39:06 [INFO] Setting cache directory: /home/ra/.cache/packer

2023/03/08 13:39:06 [TRACE] init: plugingetter.ListInstallationsOptions{FromFolders:string{"/usr/bin/pac

ker", “.”, “/home/ra/.config/packer/plugins”}, BinaryInstallationOptions:plugingetter.BinaryInstallationOp

tions{APIVersionMajor:“5”, APIVersionMinor:“0”, OS:“linux”, ARCH:“amd64”, Ext:“”, Checksummers:pluginget

ter.Checksummer{plugingetter.Checksummer{Type:“sha256”, Hash:(*sha256.digest)(0xc000604000)}}}}

2023/03/08 13:39:06 [TRACE] listing potential installations for “github.com/hashicorp/proxmox” that match

“>= 1.1.2”. plugingetter.ListInstallationsOptions{FromFolders:string{“/usr/bin/packer”, “.”, "/home/ra/.

config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:

“5”, APIVersionMinor:“0”, OS:“linux”, ARCH:“amd64”, Ext:“”, Checksummers:plugingetter.Checksummer{plugin

getter.Checksummer{Type:“sha256”, Hash:(*sha256.digest)(0xc000604000)}}}}

2023/03/08 13:39:06 [TRACE] for plugin github.com/hashicorp/proxmox found 1 matching installation(s)

2023/03/08 13:39:06 [INFO] (telemetry) Finalizing.

2023/03/08 13:39:06 waiting for all plugin processes to complete…

2023/03/08 13:39:06 [INFO] Packer version: 1.8.5 [go1.18.9 linux amd64]

2023/03/08 13:39:06 [TRACE] discovering plugins in /usr/bin

2023/03/08 13:39:06 [TRACE] discovering plugins in /home/ra/.config/packer/plugins

2023/03/08 13:39:06 [DEBUG] Discovered plugin: proxmox = /home/ra/.config/packer/plugins/github.com/hashic

orp/proxmox/packer-plugin-proxmox_v1.1.2_x5.0_linux_amd64

2023/03/08 13:39:07 [INFO] found external [clone iso] builders from proxmox plugin

2023/03/08 13:39:07 [TRACE] discovering plugins in .

2023/03/08 13:39:07 [INFO] PACKER_CONFIG env var not set; checking the default config file path

2023/03/08 13:39:07 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/ra/.packerconf

ig

2023/03/08 13:39:07 [WARN] Config file doesn’t exist: /home/ra/.packerconfig

2023/03/08 13:39:07 [INFO] Setting cache directory: /home/ra/.cache/packer

2023/03/08 13:39:07 [TRACE] validateValue: not active for cpu_type, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for os, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for ssh_password, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for disable_kvm, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for cores, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for vm_name, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for template_name, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for token, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for onboot, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for cloud_init, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for sockets, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for iso_file, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for task_timeout, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for username, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for pool, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for memory, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for ssh_username, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for ssh_timeout, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for ssh_handshake_attempts, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for unmount_iso, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for scsi_controller, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for ssh_port, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for proxmox_url, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for template_description, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for data_directory, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for shell_setup01, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for insecure_skip_tls_verify, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for iso_checksum, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for node, so skipping

2023/03/08 13:39:07 [TRACE] validateValue: not active for qemu_agent, so skipping

2023/03/08 13:39:07 [TRACE] Starting internal plugin packer-builder-proxmox

2023/03/08 13:39:07 Starting plugin: /usr/bin/packer string{“/usr/bin/packer”, “plugin”, "packer-builder

-proxmox"}

2023/03/08 13:39:07 Waiting for RPC address for: /usr/bin/packer

2023/03/08 13:39:07 packer-builder-proxmox plugin: [INFO] Packer version: 1.8.5 [go1.18.9 linux amd64]

2023/03/08 13:39:07 packer-builder-proxmox plugin: [INFO] PACKER_CONFIG env var not set; checking the defa

ult config file path

2023/03/08 13:39:07 packer-builder-proxmox plugin: [INFO] PACKER_CONFIG env var set; attempting to open co

nfig file: /home/ra/.packerconfig

2023/03/08 13:39:07 packer-builder-proxmox plugin: [WARN] Config file doesn’t exist: /home/ra/.packerconfi

g

2023/03/08 13:39:07 packer-builder-proxmox plugin: [INFO] Setting cache directory: /home/ra/.cache/packer

2023/03/08 13:39:07 packer-builder-proxmox plugin: args: string{“packer-builder-proxmox”}

2023/03/08 13:39:07 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin658059523

2023/03/08 13:39:07 packer-builder-proxmox plugin: Plugin address: unix /tmp/packer-plugin658059523

2023/03/08 13:39:07 packer-builder-proxmox plugin: Waiting for connection…

2023/03/08 13:39:07 packer-builder-proxmox plugin: Serving a plugin connection…

Error: Unsupported argument

on ubuntu-20.04.pkr.hcl line 33:

(source code not available)

An argument named “mtu” is not expected here.

on ubuntu-20.04.pkr.hcl line 33:

(source code not available)

An argument named “mtu” is not expected here.

2023/03/08 13:39:07 [INFO] (telemetry) Finalizing.

2023/03/08 13:39:07 waiting for all plugin processes to complete…

2023/03/08 13:39:07 /usr/bin/packer: plugin process exited

| lbajolet-hashicorp
March 8 |

  • | - |

Out of curiosity, have you defined this packer block in the template you’re building? I wonder which version of the plugin is being used for this build.

Could you also try with the PACKER_LOG=1 environment variable set? This way you’ll have more verbose logs and see which version of the plugin is used for this build.

Fixed:

Use “proxmox-iso” instead of “proxmox”:

source "proxmox-iso" "ubuntu-VM" {
  # Proxmox Connection settings
  proxmox_url               = "${var.proxmox_url}"
  username                  = "${var.username}"
build {
name = "ubuntu-VM"
  sources = ["source.proxmox-iso.ubuntu-VM"]

Thanks