Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot mount VMware tools ISO #1795

Closed
sdorsett opened this issue Dec 27, 2014 · 8 comments
Closed

Cannot mount VMware tools ISO #1795

sdorsett opened this issue Dec 27, 2014 · 8 comments

Comments

@sdorsett
Copy link

sdorsett commented Dec 27, 2014

Using packer 7.5 with vmware-iso builder on Centos 6.5 installing ESXi 5.5 on a remote ESXi host. VNC shows the virtual machine properly installs, but the following errors show at the end of the install process:

014/12/26 17:52:56 ui: ==> esxi55: Compacting the disk image
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 remote command exited with '0': vim-cmd vmsvc/reload 22
==> esxi55: Compacting the disk image
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 opening new ssh session
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 starting remote command: vim-cmd vmsvc/power.getstate 22
2014/12/26 17:52:56 ui: ==> esxi55: Unregistering virtual machine...
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 remote command exited with '0': vim-cmd vmsvc/power.getstate 22
==> esxi55: Unregistering virtual machine...
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 opening new ssh session
2014/12/26 17:52:56 packer-builder-vmware-iso: 2014/12/26 17:52:56 starting remote command: vim-cmd vmsvc/unregister 22
2014/12/26 17:52:57 ui error: Build 'esxi55' errored: Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json.
2014/12/26 17:52:57 Builds completed. Waiting on interrupt barrier...
2014/12/26 17:52:57 machine readable: error-count []string{"1"}
2014/12/26 17:52:57 ui error:
==> Some builds didn't complete successfully and had errors:
2014/12/26 17:52:57 machine readable: esxi55,error []string{"Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json."}
2014/12/26 17:52:57 ui error: --> esxi55: Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json.
2014/12/26 17:52:57 ui:
==> Builds finished but no artifacts were created.
2014/12/26 17:52:57 waiting for all plugin processes to complete...
2014/12/26 17:52:57 /root/packer/7.5/packer-post-processor-vagrant-vmware-ovf: plugin process exited
2014/12/26 17:52:57 /root/packer/7.5/packer-provisioner-file: plugin process exited
2014/12/26 17:52:57 /root/packer/7.5/packer-provisioner-shell: plugin process exited
2014/12/26 17:52:57 /root/packer/7.5/packer-provisioner-shell: plugin process exited
2014/12/26 17:52:57 packer-builder-vmware-iso: 2014/12/26 17:52:57 remote command exited with '0': vim-cmd vmsvc/unregister 22
Build 'esxi55' errored: Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json.

==> Some builds didn't complete successfully and had errors:
--> esxi55: Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json.

==> Builds finished but no artifacts were created.
2014/12/26 17:52:57 /root/packer/7.5/packer-builder-vmware-iso: plugin process exited

The packer template I'm using specifies vmkernel5 for the guest_os_type, which doesn't have a VM tools ISO for tools install, but a shell provisioner handles installing vmware tools at the end of the install. The following is the packer template:

[root@packer packer-templates]# cat templates/esxi.json
{
  "variables": {
    "version": "1.0"
  },
  "builders": [
    {
      "name": "esxi55",
      "vm_name": "esxi55",
      "vmdk_name": "esxi55-disk0",
      "type": "vmware-iso",
      "headless": true,
      "disk_size": 4096,
      "guest_os_type": "vmkernel5",
      "iso_url": "./isos/VMware-VMvisor-Installer-5.5.0-1331820.x86_64.iso",
      "iso_checksum": "ef599dc7e647177027684c0eee346ccdbc8704f2",
      "iso_checksum_type": "sha1",
      "remote_host": "192.168.1.5",
      "remote_datastore": "local-sata",
      "remote_username": "root",
      "remote_password": "*******",
      "remote_type": "esx5",
      "ssh_username": "root",
      "ssh_password": "vagrant",
      "ssh_wait_timeout": "60m",
      "shutdown_command": "esxcli system maintenanceMode set -e true -t 0 ; esxcli system shutdown poweroff -d 10 -r 'Packer Shutdown' ; esxcli system maintenanceMode set -e false -t 0",
      "http_directory": ".",
      "boot_wait": "5s",
      "vmx_data": {
        "memsize": "4096",
        "numvcpus": "2",
        "vhv.enable": "TRUE",
        "ethernet0.virtualDev": "e1000",
        "ethernet0.networkName": "vlan2",
        "ethernet0.present": "TRUE"

      },
      "boot_command": [
        "<enter><wait>O<wait> ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/scripts/esxi-5-kickstart.cfg<enter>"
      ]
    }
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "puppet/modules/vagrantbaseconfig/files/vagrant.pub",
      "destination": "/etc/ssh/keys-root/authorized_keys"
    },
    {
      "type": "shell",
      "script": "scripts/esxi-vmware-tools_install.sh"
    },
    {
      "type": "shell",
      "script": "scripts/esxi-cloning_configuration.sh"
    }
  ],
  "post-processors": [
   {
     "type": "vagrant-vmware-ovf",
     "compression_level": 9,
     "output": "{{.BuildName}}-{{.Provider}}-{{user `version`}}.box"
   }
  ]
}

This template, without the remote_ options, succeeds with packer and fusion on OS X.

@sdorsett
Copy link
Author

pulled the following from the vmware.log file of the packer virtual machine:

2014-12-27T02:39:55.597Z| vmx| I120: TOOLS INSTALL entering BEGINNING state.
2014-12-27T02:39:55.597Z| vmx| I120: TOOLS INSTALL could not find tools for this guest OS.
2014-12-27T02:39:55.597Z| vmx| I120: TOOLS INSTALL Initialization failed.
2014-12-27T02:39:55.597Z| vmx| I120: TOOLS INSTALL entering IDLE state.
2014-12-27T02:39:55.597Z| vmx| A115: ConfigDB: Setting toolsInstallManager.updateCounter = "1"
2014-12-27T02:39:55.629Z| vmx| A115: ConfigDB: Setting toolsInstallManager.lastInstallError = "21000"
2014-12-27T02:39:55.650Z| vmx| I120: Vix: [6789066 vigorCommands.c:923]: VigorToolsInstallManager_InitiateInstall: Tools error value is 1. Mapped VIX error value is 21000

@rickard-von-essen
Copy link
Collaborator

Guest os type should be centos-64 or centos.

@sdorsett
Copy link
Author

Setting the guest os type to "centos-64" allowed the packer process to complete:

==> esxi55: Cleaning VMX prior to finishing up...
    esxi55: Unmounting floppy from VMX...
    esxi55: Detaching ISO from CD-ROM device...
==> esxi55: Compacting the disk image
==> esxi55: Unregistering virtual machine...
Build 'esxi55' finished.

==> Builds finished. The artifacts of successful builds are:
--> esxi55: VM files in directory: /vmfs/volumes/local-sata/output-esxi55

The problem with this approach is the .vmx file now has the guestos set to "centos-64" when it needs to have this set as "vmkernel5" for nested virtualization to work within virtual ESXi vms:

/vmfs/volumes/542e0f9d-08d5df6b-dcdc-f4ce46a75a38 # cat output-esxi55/esxi55.vmx | grep guestos
guestos = "centos-64"

@sdorsett
Copy link
Author

Setting the "guest_os_type" to "centos-64" combined with seting the "guestos" back to "vmkernel5" in a "vmx_data_post" section achieved the desired results. Here is the template I successfully used:

{
  "variables": {
    "version": "1.0"
  },
  "builders": [
    {
      "name": "esxi55",
      "vm_name": "esxi55",
      "vmdk_name": "esxi55-disk0",
      "type": "vmware-iso",
      "headless": true,
      "disk_size": 4096,
      "guest_os_type": "centos-64",
      "iso_url": "./isos/VMware-VMvisor-Installer-5.5.0-1331820.x86_64.iso",
      "iso_checksum": "ef599dc7e647177027684c0eee346ccdbc8704f2",
      "iso_checksum_type": "sha1",
      "remote_host": "192.168.1.5",
      "remote_datastore": "local-sata",
      "remote_username": "root",
      "remote_password": "********",
      "remote_type": "esx5",
      "ssh_username": "root",
      "ssh_password": "vagrant",
      "ssh_wait_timeout": "60m",
      "shutdown_command": "esxcli system maintenanceMode set -e true -t 0 ; esxcli system shutdown poweroff -d 10 -r 'Packer Shutdown' ; esxcli system maintenanceMode set -e false -t 0",
      "tools_upload_flavor": "linux",
      "http_directory": ".",
      "boot_wait": "5s",
      "vmx_data": {
        "memsize": "4096",
        "numvcpus": "2",
        "vhv.enable": "TRUE",
        "ethernet0.virtualDev": "e1000",
        "ethernet0.networkName": "vlan2",
        "ethernet0.present": "TRUE"
      },
      "vmx_data_post": {
        "guestos": "vmkernel5"
      },
      "boot_command": [
        "<enter><wait>O<wait> ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/scripts/esxi-5-kickstart.cfg<enter>"
      ]
    }
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "puppet/modules/vagrantbaseconfig/files/vagrant.pub",
      "destination": "/etc/ssh/keys-root/authorized_keys"
    },
    {
      "type": "shell",
      "script": "scripts/esxi-vmware-tools_install.sh"
    },
    {
      "type": "shell",
      "script": "scripts/esxi-cloning_configuration.sh"
    }
  ],
  "post-processors": [
   {
     "type": "vagrant-vmware-ovf",
     "compression_level": 9,
     "output": "{{.BuildName}}-{{.Provider}}-{{user `version`}}.box"
   }
  ]
}

I now think I'm hitting something similar to issue #1457, where certain post processors do not seem to support the artifact returned by remote ESXi:

==> esxi55: Running post-processor: vagrant-vmware-ovf
Build 'esxi55' errored: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type, can't build box: mitchellh.vmware-esx

==> Some builds didn't complete successfully and had errors:
--> esxi55: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type, can't build box: mitchellh.vmware-esx

==> Builds finished but no artifacts were created.

@rickard-von-essen rickard-von-essen removed their assignment Jan 7, 2015
@sethvargo sethvargo changed the title error "Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json" Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json Feb 24, 2015
@sethvargo sethvargo changed the title Couldn't mount VMware tools ISO. Please check the 'guest_os_type' in your template.json Cannot mount VMware tools ISO Feb 24, 2015
@michaeltlombardi
Copy link

@sdorsett Is this problem ongoing or has it been fixed by an update to packer/post-processors since then?

@rickard-von-essen
Copy link
Collaborator

Closing since the original issue is solved.

@berney
Copy link

berney commented Oct 17, 2016

I'm hitting the same issue.

Using packer 0.10.2, vmware_guest_os_type: darwin12-64, vmware-iso building on ESXi 5.5 target. Packer tries to install VMware Tools using vim-cmd, but this fails as the OSX Installation CD is inserted. After the provisioning steps complete, packer fails the build because the vim-cmd to install VMware Tools failed.

Packer should try to eject the CD or allow for provisioing scripts to install VMware Tools. Really it should be doing a functionality test to determine that VMware Tools is working, and it should allow the user to override, so that a VM can be built that doesn't have VMware Tools installed.

@rickard-von-essen
Copy link
Collaborator

@berney Could you please open a new issue.

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants