打包程序:使用vmware-vmx进行配置时出错

时间:2018-07-10 08:00:19

标签: vmware packer

我正在使用基本图像(格式为.ova)作为源来构建.vmx文件。

基本图像(如上所述以.vmx格式创建)是使用Ubuntu 16.04构建器从vmware-iso服务器构建的。

这是我的builder配置

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

将运行的第一个预配器如下:

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

...

但是,尽管我已经重复了很多次该过程,但突然由于以下错误而中断:

==> 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

1 个答案:

答案 0 :(得分:1)

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

  

该锁在apt进程运行时放置,并在该进程完成时删除。如果存在没有明显进程在运行的锁,则可能意味着该进程由于某种原因而卡住了。