pkaramol
pkaramol

Reputation: 19312

packer: error when provisioning with vmware-vmx

I am building an .ova file using as source a base image (which is in .vmx format).

The base image (created as said above in .vmx format) is built from an Ubuntu 16.04 server using vmware-iso builder.

Here is my builder configuration

"builders": [
       {
        "type": "vmware-vmx",
        "vmx_data": {
          "memsize": "8192",
          "numvcpus": "4"
       },
       "source_path": "path/to/base.vmx",

The first provisioner that will run is the following:

 "provisioners": [
      {
        "type": "shell",
        "inline": [
          "sudo apt-get update -y",
          "sudo apt-get upgrade -y",

...

However, although I have repeated the process many times, it suddenly breaks with the following error:

==> vmware-vmx: Cloning source VM...
==> vmware-vmx: Starting HTTP server on port 8031
==> vmware-vmx: Starting virtual machine...
==> vmware-vmx: Waiting 10s for boot...
==> vmware-vmx: Connecting to VM via VNC (127.0.0.1:5924)
==> vmware-vmx: Typing the boot command over VNC...
==> vmware-vmx: Waiting for SSH to become available...
==> vmware-vmx: Connected to SSH!
==> vmware-vmx: Provisioning with shell script: /tmp/packer-shell747369685
    vmware-vmx: Reading package lists...
    vmware-vmx: E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
    vmware-vmx: E: Unable to lock directory /var/lib/apt/lists/
==> vmware-vmx: Stopping virtual machine...
==> vmware-vmx: Deleting output directory...
Build 'vmware-vmx' errored: Script exited with non-zero exit status: 100

Upvotes: 0

Views: 436

Answers (1)

Rickard von Essen
Rickard von Essen

Reputation: 4278

See Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.

Upvotes: 1

Related Questions