Packer: Error starting VM: VMware error: Error: The operation was canceled with vmware-iso builder on Ubuntu

Created on 11 Feb 2015  路  10Comments  路  Source: hashicorp/packer

I'm unable to get the vmware-iso builder to work on Ubuntu. I get "VMware error: Error: The operation was canceled". This is probably an environment set up issue, but I seem to have the pre-requisites installed.

In fact, on my Win7 box I installed packer and VMWare Workstation 11 and used packer with the same .json configuration and successfully produced a .vmx and other files.

I tried to collect additional information by setting PACKER_LOG and PACKER_LOG_PATH, but this didn't appear to change anything in terms of logging.

Where else can I look for information about what's going wrong?

vmrun version = 1.14.0 build-2305329

vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ uname -a
Linux packer-ubuntu-14 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ packer version
Packer v0.7.5

vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ echo $PACKER_LOG
true
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ echo $PACKER_LOG_PATH
/home/vagrant/share/velocity-app/packer-script/template/out.txt
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ ls
packer_cache  ubuntu-14.04.json
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ packer build ubuntu-14.04.json
ubuntu-14.04.amd64.vmware output will be in this color.

==> ubuntu-14.04.amd64.vmware: Downloading or copying ISO
    ubuntu-14.04.amd64.vmware: Downloading or copying: file:///home/vagrant/share/velocity-app/download/ubuntu-14.04.1-server-amd64.iso
==> ubuntu-14.04.amd64.vmware: Creating virtual machine disk
==> ubuntu-14.04.amd64.vmware: Building and writing VMX file
==> ubuntu-14.04.amd64.vmware: Starting HTTP server on port 8199
==> ubuntu-14.04.amd64.vmware: Starting virtual machine...
    ubuntu-14.04.amd64.vmware: The VM will be run headless, without a GUI. If you want to
    ubuntu-14.04.amd64.vmware: view the screen of the VM, connect via VNC without a password to
    ubuntu-14.04.amd64.vmware: 127.0.0.1:5944
==> ubuntu-14.04.amd64.vmware: Error starting VM: VMware error: Error: The operation was canceled
==> ubuntu-14.04.amd64.vmware: Waiting 3.312340429s to give VMware time to clean up...
==> ubuntu-14.04.amd64.vmware: Deleting output directory...
Build 'ubuntu-14.04.amd64.vmware' errored: Error starting VM: VMware error: Error: The operation was canceled

==> Some builds didn't complete successfully and had errors:
--> ubuntu-14.04.amd64.vmware: Error starting VM: VMware error: Error: The operation was canceled

==> Builds finished but no artifacts were created.
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$ ls
packer_cache  ubuntu-14.04.json
vagrant@packer-ubuntu-14:~/share/velocity-app/packer-script/template$

{
    "builders": [
        {
            "name": "ubuntu-14.04.amd64.vmware",
            "type": "vmware-iso",
            "guest_os_type": "ubuntu-64",
            "iso_urls": [
                "../../download/ubuntu-14.04.1-server-amd64.iso"
            ],
            "iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9",
            "iso_checksum_type": "md5",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "http_directory": "../http/ubuntu/",
            "headless": "true",
            "boot_wait": "10s",
            "boot_command": [
                "<esc><esc><enter><wait>",
                "/install/vmlinuz ",
                "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
                "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
                "hostname={{.Name}} ",
                "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>"
            ],
            "shutdown_command": "echo 'vagrant' | sudo -S -E shutdown -P now",
            "tools_upload_flavor": "linux",
            "vmdk_name": "disk",
            "disk_type_id": "0",
            "vmx_data": {
                "MemTrimRate": "0",
                "sched.mem.pshare.enable": "FALSE",
                "mainMem.useNamedFile": "FALSE",
                "prefvmx.minVmMemPct": "100"
            }
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "execute_command": "echo 'vagrant' | sudo -S -E sh {{.Path}}",
            "override": {
                "ubuntu-14.04.amd64.vmware": {
                    "scripts": [
                        "../script/ubuntu/update.sh",
                        "../script/ubuntu/network.sh",
                        "../script/common/docker.sh",
                        "../script/common/vagrant.sh",
                        "../script/common/vmware.sh",
                        "../script/ubuntu/cleanup.sh"
                    ]
                }
            }
        }
    ]
}
question

All 10 comments

Since you seems to be running packer and VMware inside a VM be sure to check that you have enabled _nested virtualisation_ ("Enable hypervisor applications in this virtual machine" in VMware Fusion)

To enable debugging try (in bash/dash):

PACKER_LOG=1 PACKER_LOG_PATH=./debug.log packer build ubuntu-14.04.json

And Gist the output.

I shutdown VM and enabled "Expose hardware assisted virtualization to the guest OS". Unfortunately that didn't get me past my issue.

I re-ran packer with logging enabled, thanks for the help. Please see https://gist.github.com/Dougems/6ba8ddbf960a8974a378#file-debug-log

I can see how vmrun is invoked in the log. Still not sure why I'm getting "Error: The operation was canceled"

This all has the feel of mitchellh/vagrant#2944. However, please note that despite the appearance of the word "vagrant" in my log file I'm not using vagrant.

Finally found the vmware log. Basically I had not allocated enough memory for the VM (the one running packer). So not a packer issue, just a cryptic vmware console log message issue.

If anyone have the same problem in the next months, years... and stumble upon this issue,
Here is how I fixed it :

diff --git a/template.json b/template.json
index 4e14b52..5bc17db 100644
--- a/template.json
+++ b/template.json
@@ -66,7 +66,7 @@
       "disk_type_id": "4",
-      "guest_os_type": "ubuntu64Guest",
+      "guest_os_type": "linux",
       "headless": true,

You're welcome, visitor from the future :)

@frntn That seems like a random comment. It doesn't have anything to do with the errors the original author describe?

It does actually.
I had this exact same message :

Error starting VM: VMware error: Error: The operation was canceled

Changing the guest_os_type fixed it.

Worked for me, thanks @frntn

I had a same issue and fixed by deleting the file ".vmx.lck" under virutal maching/vmname folder.

I was getting the same error in another VMWare setup. The issue was my backup program was attempting to back up the virtual disk. Shut down the backup and it works just fine.

Regarding guest_os_type...

Although this error can be caused by having an invalid guest_os_type set, and setting it to "linux" gets past this error, the generic linux guestos (which is what VMware calls it) caused problems for me when trying to use open-vm-tools features when designing Terraform deployments.

The solution was to set the proper guest_os_type, which I found by setting the Guest OS Type and Guest OS Version in vSphere GUI, downloading the .vmx with ovftool, and cat rhel7.vmx | grep guestos as described here. For 64-bit RHEL7, it is rhel7-64, contrary to the values found in the only (remotely) related VMware documentation I could find, which @frntn, myself, and possibly others tried before finding one that worked.

Was this page helpful?
0 / 5 - 0 ratings