Build 'vsphere-iso' errored: Timeout waiting for SSH

i am using the packer builder vsphere-iso to build the vm from an iso. I am using the ks file to get the. ip and networking , hostname to the image.

i am able to spin the vm in vmware and can see the login page instead but the json file is stucking at vsphere-iso: Waiting for SSH to become available…

getting an error “2020/04/10 04:40:05 packer-builder-vsphere-iso plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 10.0.68.221:22: i/o timeout”

i have enabled the ssh service and port 22 in the kickstart file but still same error.

Is the network enabled at startup? Can you ping the ip? Can you telnet port 22?

my ks file content is :network --onboot yes --device ens192 --bootproto static --ip=10.0.68.221 --netmask=255.255.255.0 --gateway= 10.0.68.1 --nameserver=172.30.0.150 --hostname=centos.local --noipv6
services --enabled=iptables,rsyslog,sshd,NetworkManager

i am getting the ip address in the vmware but unable to ping it and telnet.

Is the network card at the VMware level connected? Is the firewall enabled and blocking everything?

network is connected to the vm and vm is displaying the correct ip address and dns name. i can see the console as well which shows login page with the correct hostname (which was mentioned in the kickstart file).

logs says:

==> vsphere-iso: Waiting for IP…
2020/04/10 05:46:54 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
2020/04/10 05:52:46 packer-builder-vsphere-iso plugin: VM IP aquired: 10.0.68.221
2020/04/10 05:52:47 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.0.68.221
2020/04/10 05:52:49 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.0.68.221
2020/04/10 05:52:51 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.0.68.221
==> vsphere-iso: IP address: 10.0.68.221
2020/04/10 05:52:53 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.0.68.221
2020/04/10 05:52:53 packer-builder-vsphere-iso plugin: VM IP seems stable enough: 10.0.68.221
==> vsphere-iso: Using ssh communicator to connect: 10.0.68.221
==> vsphere-iso: Waiting for SSH to become available…
2020/04/10 05:52:53 packer-builder-vsphere-iso plugin: [INFO] Waiting for SSH, up to timeout: 3m0s
2020/04/10 05:53:08 packer-builder-vsphere-iso plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 10.0.68.221:22: i/o timeout
2020/04/10 05:53:28 packer-builder-vsphere-iso plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp 10.0.68.221:22: i/o timeout

for firewall i have the line in the ks file: firewall --disabled #–port=22:tcp

There were some CentOS and ssh related threads in the last days. Could you follow up this one?

sure will do that. thanks for the attention.

Packer will wait for 10m by default to ssh into your vm, then give up. Depending on how long it takes for your vm to configure based on your kickstart file, have you tried increasing the following Packer qmeu builder setting?

ssh_timeout