1

我使用以下模板来创建带有打包器的 vagrant box。但是,我收到错误“Build 'vmware-vmx' errored: Timeout waiting for SSH.”。如何解决这个问题?

{
 "builders": [{
 "type": "vmware-vmx",
 "source_path": "/path/to/a/vm.vmx",
 "ssh_username": "root",
 "ssh_password": "root",
 "ssh_wait_timeout": "30s",
 "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}],
"provisioners": [{
   "type": "shell",
   "inline": ["echo 'my additional provisioning steps'"]
 }],
"post-processors": [{
   "type": "vagrant",
   "keep_input_artifact": true,
   "output": "mycentos.box"
 }]
}
4

2 回答 2

4

将builder的headless参数设置为false。开始构建并注意错误。如果没有发生错误,则增加 timeout 参数。30s 对于实例化、克隆和运行 vm 来说有点小。

在你的情况下:

"builders": [{
 "type": "vmware-vmx",
 "source_path": "/path/to/a/vm.vmx",
 "ssh_username": "root",
 "ssh_password": "root",
 "headless" : false,
 "ssh_wait_timeout": "1000s",
 "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
}]
于 2015-07-10T09:16:03.193 回答
0

当您在配置过程中不需要 SSH 连接时,您可以将其关闭。请参阅有关communicator的打包程序文档,在那里您可以看到none切换主机和来宾之间通信的选项。

{
  "builders": [
    {
      "type": "vmware-vmx",
      "communicator": "none"
    }
  ]
}

Packer Builders DOCU vmware-vmx

于 2019-08-29T20:01:14.817 回答