packer-builder-vsphere icon indicating copy to clipboard operation
packer-builder-vsphere copied to clipboard

Invalid configuration for device '0' | VSPHERE-ISO

Open rushi47 opened this issue 5 years ago • 12 comments

When i was running builder for type: "vsphere-iso",

I am getting below error:

Build 'centos-75-vsphere' errored: error mounting an image: Invalid configuration for device '0'.

Am new bee to packer and vmware from my understanding, it seems to be issue with network. I tried attaching various networks, but getting same issue:

Below is the code for same,

{
  "variables": {
    "guest_additions_mode": "disable",
    "headless": "false",
    "vm_name": "packer-build-centos-75",
    "disk_size": "10240",
    "disk_type_id": "1",
    "memory": "1024",
    "cpu": "1",        
    "iso_checksum_type": "sha256",
    "iso_checksum": "f90e4d28fa377669b2db16cbcb451fcb9a89d2460e3645993e30e137ac37d284",
    "vcenter_server": "192.168.11.51",
    "vcenter_datacenter": "ZYCUS-MUM-DC",
    "vcenter_cluster": "ZYCUS-MUM-CLUSTER02",
    "vcenter_datastore": "ESX07-LOCAL-DS01",
    "vcenter_host": "inmuzp-esx-pr07.zycus.net",
    "vcenter_network": "VDS-VLAN1210-QC-A",
    "vcenter_username": "[email protected]",
    "vcenter_password": "xxxxx"
  },
"builders": [{
      "name": "centos-75-vsphere",
      "type": "vsphere-iso",
      "vcenter_server":      "{{ user `vcenter_server` }}",
      "datacenter":          "{{ user `vcenter_datacenter` }}",
      "username":            "{{ user `vcenter_username` }}",
      "password":            "{{ user `vcenter_password` }}",
      "insecure_connection": true,     
      "vm_name": "{{user `vm_name`}}",
      "host":    "{{ user `vcenter_host` }}",
      "cluster": "{{ user `vcenter_cluster` }}",
      "datastore" : "{{ user `vcenter_datastore` }}",
      "communicator": "ssh",
      "ssh_username": "root",
      "ssh_password": "root",
      "network": "{{ user `vcenter_network` }}",
      "boot_wait": "10s",            
      "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
      "guest_os_type": "centos7_64Guest",
      "vm_version" : 13,
      "CPUs":"{{user `cpu`}}",
      "CPU_limit": -1,
      "RAM": "{{user `memory`}}",
      "RAM_reserve_all": true,
      "disk_size": "{{user `disk_size`}}",
      "disk_thin_provisioned": true,
      "iso_paths": [
        "[ESX01-LOCAL-DS01] /ISO/CentOS-7-x86_64-Minimal-1511.iso"
      ]
    }]
}

rushi47 avatar Mar 25 '19 15:03 rushi47

@mkuzmin, It will be great if you can help me with it.

rushi47 avatar Mar 25 '19 15:03 rushi47

try a different disk controller type. I was running into the same issue in windows and swapped the disk controller to lsilogic-sas from the default. There's a PR with the other disk types if that doesn't work.

almightyfoon avatar May 15 '19 00:05 almightyfoon

@rushi47 Make sure the iso image is available when it tries to mount it. I had a simmiar issue like that that got fixed.

loopinu avatar May 16 '19 07:05 loopinu

I had "video_ram": "16", and removing it for me removed the same error. It would be useful if we could get a finer level of debug information being returned. It may help us find out what device, "device '0'" actually is!

ChrisGWarp avatar Aug 20 '19 04:08 ChrisGWarp

@rushi47 I know this is probably old but I ran into this same exact issue and what fixed it was that in your variables, you specified this

"vcenter_datastore": "ESX07-LOCAL-DS01"

But in your iso_paths, you specified a different datastore location:

 "iso_paths": [
         "[ESX01-LOCAL-DS01] /ISO/CentOS-7-x86_64-Minimal-1511.iso"

Change the iso_path and vcenter_datastore to match and you should be good.

dduong26 avatar Dec 12 '19 15:12 dduong26

@ChrisGWarp - I get the same error when I added "video_ram" - did you manage to find a way around?

johnmj avatar Dec 17 '19 14:12 johnmj

No, sorry I didn't. I've not attempted to look at it since either, as so far, I've not needed to address video ram sizes.

ChrisGWarp avatar Dec 19 '19 00:12 ChrisGWarp

The same issue is happening for me. Adding video_ram parameter causes the error "vsphere-iso: Invalid configuration for device '0'."

kaposh avatar Jan 13 '20 19:01 kaposh

@kaposh - perhaps #264 could help you set video memory

johnmj avatar Jan 14 '20 12:01 johnmj

the problem persists with 1.6.6

jorgelon avatar Dec 30 '20 12:12 jorgelon

Just a note about the device number, you can look at the error logs display in vCenter and see which device is causing the problem. In this thread, some of the issues seem to refer to the video device, and others the cdrom device. Note also that the device number is essentially an artefact of the order in which the devices are declared in the JSON and so the order in which the devices are created.

NathanDotTo avatar Jul 27 '21 13:07 NathanDotTo

@rushi47 I know this is probably old but I ran into this same exact issue and what fixed it was that in your variables, you specified this

"vcenter_datastore": "ESX07-LOCAL-DS01"

But in your iso_paths, you specified a different datastore location:

 "iso_paths": [
         "[ESX01-LOCAL-DS01] /ISO/CentOS-7-x86_64-Minimal-1511.iso"

Change the iso_path and vcenter_datastore to match and you should be good.

This is the correct answer here, but this is also wrong. There is no reason to assume that the ISO files should be in the same datastore as the VM. It should be possible to have distinct datastores.

NathanDotTo avatar Jul 27 '21 13:07 NathanDotTo