Score:0

HashiCorp packer with vshpere 7.0.2 : error mounting an image

ru flag

Not sure if anyone using Packer to build images for vmware vsphere 7.0.2. Here is the error I am having and I dont know what does it mean by device 0 What is this Device 0?

Here is the error:

==> vsphere-iso: Creating VM...
==> vsphere-iso: Customizing hardware...
==> vsphere-iso: Mounting ISO images...
==> vsphere-iso: Destroying VM...
Build 'vsphere-iso' errored after 956 milliseconds 798 microseconds: error mounting an image '': Incompatible device backing specified for device '0'.

==> Wait completed after 957 milliseconds 63 microseconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso: error mounting an image '': Incompatible device backing specified for device '0'.

==> Builds finished but no artifacts were created.

Here are some logs from packer

2021/06/21 14:29:26 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2021/06/21 14:29:26 packer.exe plugin: Waiting for connection...
2021/06/21 14:29:26 Received tcp RPC address for C:\Program Files\HashiCorp\packer.exe: addr is 127.0.0.1:10000
2021/06/21 14:29:26 packer.exe plugin: Serving a plugin connection...
2021/06/21 14:29:26 [TRACE] Starting internal plugin packer-provisioner-shell
2021/06/21 14:29:26 Starting plugin: C:\Program Files\HashiCorp\packer.exe []string{"C:\\Program Files\\HashiCorp\\packer.exe", "plugin", "packer-provisioner-shell"}
2021/06/21 14:29:26 Waiting for RPC address for: C:\Program Files\HashiCorp\packer.exe
2021/06/21 14:29:27 packer.exe plugin: [INFO] Packer version: 1.7.3 [go1.16.5 windows amd64]
2021/06/21 14:29:27 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/06/21 14:29:27 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\r.yang\AppData\Roaming\packer.config
2021/06/21 14:29:27 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\r.yang\AppData\Roaming\packer.config
2021/06/21 14:29:27 packer.exe plugin: [INFO] Setting cache directory: D:\001_devops\terraform\vmware\packer-vsphere-iso-linux\Ubuntu-20.04-LTS\packer_cache
2021/06/21 14:29:27 packer.exe plugin: args: []string{"packer-provisioner-shell"}
2021/06/21 14:29:27 packer.exe plugin: Plugin port range: [10000,25000]
2021/06/21 14:29:27 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2021/06/21 14:29:27 packer.exe plugin: Waiting for connection...
2021/06/21 14:29:27 Received tcp RPC address for C:\Program Files\HashiCorp\packer.exe: addr is 127.0.0.1:10000
2021/06/21 14:29:27 packer.exe plugin: Serving a plugin connection...
2021/06/21 14:29:27 Preparing build: vsphere-iso
2021/06/21 14:29:27 ui: vsphere-iso: output will be in this color.
2021/06/21 14:29:27 ui: 
2021/06/21 14:29:27 Build debug mode: false
2021/06/21 14:29:27 Force build: false
2021/06/21 14:29:27 On error: 
2021/06/21 14:29:27 Waiting on builds to complete...
2021/06/21 14:29:27 Starting build run: vsphere-iso
2021/06/21 14:29:27 Running builder: vsphere-iso
2021/06/21 14:29:27 [INFO] (telemetry) Starting builder vsphere-iso
2021/06/21 14:29:27 packer.exe plugin: No URLs were provided to Step Download. Continuing...
2021/06/21 14:29:27 packer.exe plugin: No CD files specified. CD disk will not be made.
2021/06/21 14:29:27 ui: ==> vsphere-iso: Creating VM...
2021/06/21 14:29:27 ui: ==> vsphere-iso: Customizing hardware...
2021/06/21 14:29:27 ui: ==> vsphere-iso: Mounting ISO images...
2021/06/21 14:29:27 packer.exe plugin: Creating CD-ROM on controller '&{{{} 200 0xc001360ee0 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso ''
2021/06/21 14:29:28 ui: ==> vsphere-iso: Destroying VM...
2021/06/21 14:29:28 [INFO] (telemetry) ending vsphere-iso
2021/06/21 14:29:28 ui error: Build 'vsphere-iso' errored after 1 second 647 milliseconds: error mounting an image '': Incompatible device backing specified for device '0'.
2021/06/21 14:29:28 ui: 
==> Wait completed after 1 second 647 milliseconds
2021/06/21 14:29:28 machine readable: error-count []string{"1"}
2021/06/21 14:29:28 ui error: 
==> Some builds didn't complete successfully and had errors:
2021/06/21 14:29:28 machine readable: vsphere-iso,error []string{"error mounting an image '': Incompatible device backing specified for device '0'."}
2021/06/21 14:29:28 ui error: --> vsphere-iso: error mounting an image '': Incompatible device backing specified for device '0'.
2021/06/21 14:29:28 ui: 
==> Builds finished but no artifacts were created.
2021/06/21 14:29:28 [INFO] (telemetry) Finalizing.
2021/06/21 14:29:29 waiting for all plugin processes to complete...
2021/06/21 14:29:29 C:\Program Files\HashiCorp\packer.exe: plugin process exited
2021/06/21 14:29:29 C:\Program Files\HashiCorp\packer.exe: plugin process exited

Here is the packer build json file, it is very simple and straight forward.

{
  "builders": [
    {
      "type": "vsphere-iso",
  
      "vcenter_server": "{{user `vcenter-server`}}",
      "username": "{{user `vcenter-username`}}",
      "password": "{{user `vcenter-password`}}",
      "insecure_connection": "true",
      "datacenter": "{{user `datacenter`}}",
  
      "vm_name": "{{user `vm-name`}}",
      "notes": "Build via Packer", 

      "datastore": "{{user `datastore`}}",
      "folder": "{{user `folder`}}",
      "host": "{{user `host`}}",
      "cluster": "{{user `cluster`}}",

      "convert_to_template": "true",

      "ssh_username": "{{user `ssh-username`}}",
      "ssh_password": "{{user `ssh-password`}}", 
      


    
      "boot_order": "disk,cdrom",
  
      "guest_os_type": "ubuntu64Guest",
      "CPUs": "{{user `vm-cpu-num`}}",
      "RAM": "{{user `vm-mem-size`}}",
      "RAM_reserve_all": false,
      "disk_controller_type": "pvscsi",
      "storage": [
        {
          "disk_size": "{{user `vm-disk-size`}}",
          "disk_thin_provisioned": true
        }
      ],
      "network_adapters": [
        {
          "network": "{{user `network`}}",
          "network_card": "vmxnet3"
        }
      ],
      "iso_paths": ["{{user `iso_url`}}"],
      "floppy_files": ["./preseed.cfg"],
      "boot_command": [
        "<enter><wait><f6><wait><esc><wait>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs>",
        "/install/vmlinuz",
        " initrd=/install/initrd.gz",
        " priority=critical",
        " locale=en_US",
        " file=/media/preseed.cfg",
        "<enter>"
      ]
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "sudo rm /etc/machine-id", 
        "sudo touch /etc/machine-id",
        "echo 'Packer Template Build -- Complete'"
      ]
    }
  ]
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.