Running packer on a digital ocean machine(ubuntu 14.04) to generate VMWARE images failing

426 views
Skip to first unread message

ba...@rtbrick.com

unread,
Sep 2, 2017, 4:24:43 AM9/2/17
to Packer
Hi,

I am using packer to generate VMWARE images on a digital ocean instance. I have installed vmware player for linux as well as vmware vix sdk. But i am unable to get it working.

Here is my template:
{
  "builders": [
    {
      "type": "vmware-iso",
      "boot_command": [
        "<esc><esc><enter><wait>",
        "/install/vmlinuz<wait>",
        "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
        "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
        "hostname=RtBrick-Evaluation",
        "fb=false debconf/frontend=noninteractive ",
        "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
        "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
        "initrd=/install/initrd.gz -- <enter>"
      ],
      "boot_wait": "10s",
      "disk_size": 10240,
      "tools_upload_flavor": "linux",
      "vmdk_name": "disk",
      "guest_os_type": "ubuntu-64",
      "http_directory": "http",
      "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
      "iso_checksum_type": "md5",
      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso",
      "ssh_username": "ubuntu",
      "ssh_password": "ubuntu",
      "ssh_port": 22,
      "headless": true,
      "ssh_wait_timeout": "10000s",
      "shutdown_command": "echo 'ubuntu'| sudo shutdown -P now",
      "output_directory": "test",
      "vm_name": "rtbrick-vbox-6topo-{{user `version`}}",
      "vmx_data": {
        "MemTrimRate": "0",
        "sched.mem.pshare.enable": "FALSE",
        "mainMem.useNamedFile": "FALSE",
        "prefvmx.minVmMemPct": "100"
      }
    }
  ]
}

I am getting the following error:

# packer build template.json
vmware-iso output will be in this color.

Build 'vmware-iso' errored: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* exec: "vmware": executable file not found in $PATH
* exec: "vmware": executable file not found in $PATH
* exec: "vmrun": executable file not found in $PATH
* exec: "vmrun": executable file not found in $PATH


==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* exec: "vmware": executable file not found in $PATH
* exec: "vmware": executable file not found in $PATH
* exec: "vmrun": executable file not found in $PATH
* exec: "vmrun": executable file not found in $PATH


==> Builds finished but no artifacts were created.


I had gone through a couple of issues in packer git repo where they mentioned that I have to install VIX SDK which i did. I am still unable to get it working. Any ideas?

Rickard von Essen

unread,
Sep 2, 2017, 5:24:12 AM9/2/17
to packe...@googlegroups.com
Generally cloud providers don't support nested virtualization so it doesn't work to run VMware inside a Digital Ocean droplet. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/bf7c0dbe-0635-419c-84b5-834ca82b36ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ba...@rtbrick.com

unread,
Sep 2, 2017, 12:13:50 PM9/2/17
to Packer
More updates
===========

I ran kvm-ok to check for nested virtualization support and it seems to say so.

# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

My template is:


{
  "builders": [
   {
      "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>",
        " 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>",
        " netcfg/get_domain=vagrantup.com<wait>",
        " noapic<wait>",
        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
        " -- <wait>",
        "<enter><wait>"
      ],
      "boot_wait": "10s",
      "disk_size": 10960,

      "guest_os_type": "ubuntu-64",
      "http_directory": "http",
      "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
      "iso_checksum_type": "md5",
      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso",
      "ssh_username": "ubuntu",
      "ssh_password": "ubuntu",
      "ssh_port": 22,
      "communicator": "ssh",
      "ssh_wait_timeout": "10000s",
      "headless": true,

      "shutdown_command": "echo 'ubuntu'| sudo shutdown -P now",
      "output_directory": "test",
      "vmx_data": {
        "memsize": "512",
        "numvcpus": "1",
        "cpuid.coresPerSocket": "1"
      }
    }
  ]
}


After a bit of reinstalling vmware and change vix config, it has attempted to start the vm but still failing with the following error. Any way of debugging this?


# packer build template.json
vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
    vmware-iso: Downloading or copying: http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting HTTP server on port 8130
==> vmware-iso: Starting virtual machine...
    vmware-iso: The VM will be run headless, without a GUI. If you want to
    vmware-iso: view the screen of the VM, connect via VNC with the password "2hQz35EB" to
    vmware-iso: vnc://127.0.0.1:5968
==> vmware-iso: Error starting VM: VMware error: Error: Unknown error
==> vmware-iso:
==> vmware-iso: Packer detected a VMware 'Unknown Error'. Unfortunately VMware
==> vmware-iso: often has extremely vague error messages such as this and Packer
==> vmware-iso: itself can't do much about that. Please check the vmware.log files
==> vmware-iso: created by VMware when a VM is started (in the directory of the
==> vmware-iso: vmx file), which often contains more detailed error information.
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Error starting VM: VMware error: Error: Unknown error

Packer detected a VMware 'Unknown Error'. Unfortunately VMware
often has extremely vague error messages such as this and Packer
itself can't do much about that. Please check the vmware.log files
created by VMware when a VM is started (in the directory of the
vmx file), which often contains more detailed error information.


==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Error starting VM: VMware error: Error: Unknown error

Packer detected a VMware 'Unknown Error'. Unfortunately VMware
often has extremely vague error messages such as this and Packer
itself can't do much about that. Please check the vmware.log files
created by VMware when a VM is started (in the directory of the
vmx file), which often contains more detailed error information.


==> Builds finished but no artifacts were created.


ba...@rtbrick.com

unread,
Sep 2, 2017, 2:41:35 PM9/2/17
to Packer
Hi,

I tried the same on an hp server with virtualization. I am hitting the same issue as above.

$ packer build template.json
vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
    vmware-iso: Downloading or copying: http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Starting HTTP server on port 8265

==> vmware-iso: Starting virtual machine...
    vmware-iso: The VM will be run headless, without a GUI. If you want to
    vmware-iso: view the screen of the VM, connect via VNC with the password "Qqc4VN3j" to
    vmware-iso: vnc://127.0.0.1:5949

==> vmware-iso: Error starting VM: VMware error: Error: Unknown error
==> vmware-iso:
==> vmware-iso: Packer detected a VMware 'Unknown Error'. Unfortunately VMware
==> vmware-iso: often has extremely vague error messages such as this and Packer
==> vmware-iso: itself can't do much about that. Please check the vmware.log files
==> vmware-iso: created by VMware when a VM is started (in the directory of the
==> vmware-iso: vmx file), which often contains more detailed error information.
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Error starting VM: VMware error: Error: Unknown error

Packer detected a VMware 'Unknown Error'. Unfortunately VMware
often has extremely vague error messages such as this and Packer
itself can't do much about that. Please check the vmware.log files
created by VMware when a VM is started (in the directory of the
vmx file), which often contains more detailed error information.

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Error starting VM: VMware error: Error: Unknown error


Packer detected a VMware 'Unknown Error'. Unfortunately VMware
often has extremely vague error messages such as this and Packer
itself can't do much about that. Please check the vmware.log files
created by VMware when a VM is started (in the directory of the
vmx file), which often contains more detailed error information.

==> Builds finished but no artifacts were created.


On Saturday, September 2, 2017 at 1:54:43 PM UTC+5:30, ba...@rtbrick.com wrote:

Rickard von Essen

unread,
Sep 3, 2017, 2:15:25 AM9/3/17
to packe...@googlegroups.com
You have a few options:

First add -on-error=ask to packer build and it will halt on error and wait for you to push "[C]lean up". This gives you time to look around.

1) Check the VMware log inside the VM directory.
2) Run with PACKER_LOG=1 packer build... See which commands it executes and try to execute the same manually.
3) Add headless: false, install X and enable X-forwarding.

Also it can be simpler to try this out on a local machine/Vagrant box to ensure that you have a good recipe for installing VMware Player and using Packer with it. 

// Rickard

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
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+unsubscribe@googlegroups.com.

ba...@rtbrick.com

unread,
Sep 3, 2017, 10:14:14 AM9/3/17
to Packer
Hi Rickard,

I am able to hit the issue on my local machine as well. I tried will headless mode disabled and it worked fine. The issue is hit only when i enable headless mode. I tried the on error method but no log file was generated.
:
With packer log enabled, I got these logs


==> vmware-iso: Starting virtual machine...
2017/09/03 14:29:03 ui:     vmware-iso: The VM will be run headless, without a GUI. If you want to
    vmware-iso: view the screen of the VM, connect via VNC with the password "a12jwA5e" to
    vmware-iso: vnc://127.0.0.1:5942
2017/09/03 14:29:03 packer: 2017/09/03 14:29:03 Executing: /usr/bin/vmrun [-T player start test/ubuntu1404-base.vmx nogui]

    vmware-iso: The VM will be run headless, without a GUI. If you want to
    vmware-iso: view the screen of the VM, connect via VNC with the password "a12jwA5e" to
    vmware-iso: vnc://127.0.0.1:5942
2017/09/03 14:30:04 packer: 2017/09/03 14:30:04 stdout: Error: Unknown error
2017/09/03 14:30:04 packer: 2017/09/03 14:30:04 stderr:
2017/09/03 14:30:04 ui error: ==> vmware-iso: Error starting VM: VMware error: Error: Unknown error

==> vmware-iso:
==> vmware-iso: Packer detected a VMware 'Unknown Error'. Unfortunately VMware
==> vmware-iso: often has extremely vague error messages such as this and Packer
==> vmware-iso: itself can't do much about that. Please check the vmware.log files
==> vmware-iso: created by VMware when a VM is started (in the directory of the
==> vmware-iso: vmx file), which often contains more detailed error information.
==> vmware-iso: Error starting VM: VMware error: Error: Unknown error
2017/09/03 14:30:04 ui: ==> vmware-iso: Step "StepRun" failed
==> vmware-iso:
2017/09/03 14:30:04 ui: ask: ==> vmware-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?

==> vmware-iso: Packer detected a VMware 'Unknown Error'. Unfortunately VMware
==> vmware-iso: often has extremely vague error messages such as this and Packer
==> vmware-iso: itself can't do much about that. Please check the vmware.log files
==> vmware-iso: created by VMware when a VM is started (in the directory of the
==> vmware-iso: vmx file), which often contains more detailed error information.
==> vmware-iso: Step "StepRun" failed

I tried the vmrun step and it gave me the following error:

 $ /usr/bin/vmrun [-T player start test/ubuntu1404-base.vmx nogui]
Unable to connect to host.
Error: Service type VIX_SERVICEPROVIDER_VMWARE_WORKSTATION was specified, but not installed

Looks like its trying to look for workstation instead of player. Not sure how to make it right yet. exploring the same. Any clues would be helpful


On Saturday, September 2, 2017 at 1:54:43 PM UTC+5:30, ba...@rtbrick.com wrote:
Reply all
Reply to author
Forward
0 new messages