Ubuntu image generated with vmware-iso builder loads fine in Fusion, but fails to load on ESXi

129 views
Skip to first unread message

Brandon Heller

unread,
Apr 10, 2015, 5:05:47 PM4/10/15
to packe...@googlegroups.com
I'm trying to use Packer to have a single place for generated a variety of VM formats.  I'm starting with VMware Fusion 6.0.5 on a Mac OS X 10.10 machine.

The VM builds just fine and I can start it up in Fusion, but the real reason I'd doing this is to have a way to script the generation of machines for ESXi usage.

When I go to import the VM in ESXi 5.5, I get this error: 

Transport (VMDB) error -32: Pipe: Read failed.
Failed to power on '/vmfs/volumes/537e9fd5-11172d44-4ae6-a0423f0154bc/packer-ubuntu14.04-2/output-vmware-iso/packer-vmware-iso.vmx'.

Google hasn't shown anything clearly relevant.  Has anyone had any luck with the setup?   I would try the post processor to do a direct send, but the server does not have vCenter installed.

Thanks!

Ethan S.

unread,
Apr 11, 2015, 3:51:00 PM4/11/15
to packe...@googlegroups.com
Did you set up ESX as one of your output types? I believe that there is a vmware_desktop target type as well as a vmware_esx target. They have to do slightly different things to define VMs for the server products.

Also, you don't need vCenter installed to do a direct send, just enter the IP and login information of the ESX host and Packer should take care of the rest. vCenter actually uses a similar communication mechanism to a direct host, so it should work with either.

Brandon Heller

unread,
Apr 11, 2015, 9:24:43 PM4/11/15
to packe...@googlegroups.com
The documentation I've been using is for the vmware-iso builder: https://www.packer.io/docs/builders/vmware-iso.html

Ethan, do you mean that there's a different builder than 'vmware-iso' which I should be using?  When you say 'target type', do you mean remote type?

Thanks!



--
You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/dksMMmSSGq0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brandon Heller

unread,
Apr 12, 2015, 12:09:31 AM4/12/15
to packe...@googlegroups.com
FWIW, I was able to get this resolved by using specify the remote_[type, host, datastore, username, password] options for the vmware-iso type, then doing a remote ESXi build instead of Fusion.  

I had one issue with the generated VM not DHCPing but this thread had the solution:
https://groups.google.com/forum/#!topic/packer-tool/02idn-nuIK4

The generated VM appears on the remote ESX datastore, so I can create the VM by navigating to the .vmx file and simply starting it.  Very cool!
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.

Alvaro Miranda Aguilera

unread,
Apr 12, 2015, 12:07:45 PM4/12/15
to packe...@googlegroups.com
Brandon

Do you mind sharing notes you have taken?

since seems are plenty of edge cases you found and seems you got
answers for them..

Thanks
Alvaro.
>>> packer-tool...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool...@googlegroups.com.

Brandon Heller

unread,
Apr 12, 2015, 6:09:06 PM4/12/15
to packe...@googlegroups.com
Sure.  Here's my template.json, which derives from the Ubuntu 14.04 one at github.com/shiguredo/packer-templates.  I haven't fully verified the VirtualBox config yet.  You'll need to pass in params for all variables defined as null at the top or replace them in template.son.

{
  "variables": {
    "ssh_name": null,
    "ssh_pass": null,
    "hostname": "ubuntu",
    "disksize": 40960,
    "esx_remote_host": null,
    "esx_remote_datastore": null,
    "esx_remote_username": null,
    "esx_remote_password": null
  },
  "provisioners": [
    {
      "type": "shell",
      "execute_command": "echo {{user `ssh_pass`}} |sudo -S sh '{{.Path}}'",
      "override": {
        "virtualbox-iso": {
          "scripts": [
            "scripts/base.sh",
            "scripts/virtualbox.sh",
            "scripts/cleanup.sh",
            "scripts/zerodisk.sh"
          ]
        },
        "vmware-esx-remotebuild": {
          "scripts": [
            "scripts/base.sh",
            "scripts/vmware.sh",
            "scripts/cleanup.sh",
            "scripts/zerodisk.sh"
          ]
        }
      }
    }
  ],
  "builders": [
    {
      "type": "virtualbox-iso",
      "boot_command": [
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz<wait>",
        " auto<wait>",
        " console-setup/ask_detect=false<wait>",
        " console-setup/layoutcode=us<wait>",
        " console-setup/modelcode=pc105<wait>",
        " debconf/frontend=noninteractive<wait>",
        " debian-installer=en_US<wait>",
        " fb=false<wait>",
        " initrd=/install/initrd.gz<wait>",
        " kbd-chooser/method=us<wait>",
        " keyboard-configuration/layout=USA<wait>",
        " keyboard-configuration/variant=USA<wait>",
        " locale=en_US<wait>",
        " netcfg/get_hostname=ubuntu-1404<wait>",
        " noapic<wait>",
        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
        " -- <wait>",
        "<enter><wait>"
      ],
      "boot_wait": "5s",
      "disk_size": "{{user `disksize`}}",
      "guest_os_type": "Ubuntu_64",
      "http_directory": "http",
      "iso_checksum": "83aabd8dcf1e8f469f3c72fff2375195",
      "iso_checksum_type": "md5",
      "ssh_username": "{{user `ssh_name`}}",
      "ssh_password": "{{user `ssh_pass`}}",
      "ssh_port": 22,
      "ssh_wait_timeout": "10000s",
      "shutdown_command": "echo 'shutdown -P now' > /tmp/shutdown.sh; echo {{user `ssh_pass`}}|sudo -S sh '/tmp/shutdown.sh'",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--memory", "512" ],
        [ "modifyvm", "{{.Name}}", "--cpus", "1" ]
      ]
    },
    {
      "name": "vmware-esx-remotebuild",
      "type": "vmware-iso",
      "boot_command": [
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz<wait>",
        " auto<wait>",
        " console-setup/ask_detect=false<wait>",
        " console-setup/layoutcode=us<wait>",
        " console-setup/modelcode=pc105<wait>",
        " debconf/frontend=noninteractive<wait>",
        " debian-installer=en_US<wait>",
        " fb=false<wait>",
        " initrd=/install/initrd.gz<wait>",
        " kbd-chooser/method=us<wait>",
        " keyboard-configuration/layout=USA<wait>",
        " keyboard-configuration/variant=USA<wait>",
        " locale=en_US<wait>",
        " netcfg/get_hostname=ubuntu-1404<wait>",
        " noapic<wait>",
        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
        " -- <wait>",
        "<enter><wait>"
      ],
      "boot_wait": "10s",
      "disk_size": "{{user `disksize`}}",
      "guest_os_type": "linux",
      "http_directory": "http",
      "iso_checksum": "83aabd8dcf1e8f469f3c72fff2375195",
      "iso_checksum_type": "md5",
      "ssh_username": "{{user `ssh_name`}}",
      "ssh_password": "{{user `ssh_pass`}}",
      "ssh_port": 22,
      "ssh_wait_timeout": "10000s",
      "shutdown_command": "echo 'shutdown -P now' > /tmp/shutdown.sh; echo {{user `ssh_pass`}}|sudo -S sh '/tmp/shutdown.sh'",
      "vmx_data": {
        "memsize": "512",
        "numvcpus": "1",
        "cpuid.coresPerSocket": "1",
        "ethernet0.present": "TRUE",
        "ethernet0.startConnected": "TRUE",
        "ethernet0.virtualDev": "e1000",
        "ethernet0.networkName": "VM Network",
        "ethernet0.addressType": "generated",
        "ethernet0.generatedAddressOffset": "0",
        "ethernet0.wakeOnPcktRcv": "FALSE"

      },
      "remote_type": "esx5",
      "remote_host": "{{user `esx_remote_host`}}",
      "remote_datastore": "{{user `esx_remote_datastore`}}",
      "remote_username": "{{user `esx_remote_username`}}",
      "remote_password": "{{user `esx_remote_password`}}"
    }
  ]
}

Reply all
Reply to author
Forward
0 new messages