Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh_timeout not working windows and wsl #87

Closed
todeb opened this issue Nov 2, 2021 · 7 comments · Fixed by #116
Closed

ssh_timeout not working windows and wsl #87

todeb opened this issue Nov 2, 2021 · 7 comments · Fixed by #116
Assignees
Labels
bug Something isn't working docs

Comments

@todeb
Copy link

todeb commented Nov 2, 2021

Hello,

seems that "ssh_timeout" property is not working using packer on wsl2 and on windows.
I had set: ssh_timeout = "30m"

I had tried to find workaroud eg. setting:
ssh_proxy_host = "127.0.0.1"
then it waits 30min but it is not connecting.
I have ssh server running locally and I had added my public key to authorized keys. I'm able to ssh 127.0.01 without password.
Is there anything more that should i configure?

@nywilken
Copy link
Contributor

nywilken commented Nov 2, 2021

Hi @todeb thanks for reaching out. Reading over your description it seems like you are having trouble connecting via ssh and not really having a problem with the ssh_timeout option, is that correct?

If it is a connection/authentication issue have you tried using your private key for authentication?

Packer does not read any keys automatically so they must be explicitly defined within the build template.

Below is an example of how you would configure the null communicator.

source "null" "remote" {
  ssh_host = "127.0.01"
  ssh_username = "<yourusername>"
  ssh_private_key_file = "<path-to-private-key-file"
  communicator = "ssh"
}

If you are still running into issues after providing your private key can you please provide your debug logs which you can get by setting the environment variable PACKER_LOG=1 before running packer build along with a sample of your configuration.

@todeb
Copy link
Author

todeb commented Nov 2, 2021

2021/11/03 00:29:58 [INFO] Packer version: 1.7.6 [go1.17.1 linux amd64]
2021/11/03 00:29:58 [TRACE] discovering plugins in /usr/bin
2021/11/03 00:29:58 [TRACE] discovering plugins in /home/tode/.config/packer/plugins
2021/11/03 00:29:58 [TRACE] discovering plugins in .
2021/11/03 00:29:58 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/11/03 00:29:58 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/tode/.packerconfig
2021/11/03 00:29:58 [WARN] Config file doesn't exist: /home/tode/.packerconfig
2021/11/03 00:29:58 [INFO] Setting cache directory: /home/tode/.cache/packer
2021/11/03 00:29:58 [TRACE] validateValue: not active for vsphere_password, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for datastore, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for network_name, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for cluster, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for ssh_password, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for ssh_username, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for vsphere_server, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for vsphere_user, so skipping
2021/11/03 00:29:58 [TRACE] validateValue: not active for datacenter, so skipping
2021/11/03 00:29:58 [TRACE] Starting internal plugin packer-builder-vsphere-iso
2021/11/03 00:29:58 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-vsphere-iso"}
2021/11/03 00:29:58 Waiting for RPC address for: /usr/bin/packer
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: [INFO] Packer version: 1.7.6 [go1.17.1 linux amd64]
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: [WARN] Config file doesn't exist: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: [INFO] Setting cache directory: /home/tode/.cache/packer
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: args: []string{"packer-builder-vsphere-iso"}
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: Plugin address: unix /tmp/packer-plugin3886880673
2021/11/03 00:29:59 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin3886880673
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: Waiting for connection...
2021/11/03 00:29:59 packer-builder-vsphere-iso plugin: Serving a plugin connection...
2021/11/03 00:29:59 [TRACE] Starting internal plugin packer-provisioner-shell
2021/11/03 00:29:59 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell"}
2021/11/03 00:29:59 Waiting for RPC address for: /usr/bin/packer
2021/11/03 00:29:59 packer-provisioner-shell plugin: [INFO] Packer version: 1.7.6 [go1.17.1 linux amd64]
2021/11/03 00:29:59 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/11/03 00:29:59 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-provisioner-shell plugin: [INFO] Setting cache directory: /home/tode/.cache/packer
2021/11/03 00:29:59 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin3552073721
2021/11/03 00:29:59 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2021/11/03 00:29:59 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin3552073721
2021/11/03 00:29:59 packer-provisioner-shell plugin: Waiting for connection...
2021/11/03 00:29:59 packer-provisioner-shell plugin: Serving a plugin connection...
2021/11/03 00:29:59 [TRACE] Starting internal plugin packer-provisioner-shell-local
2021/11/03 00:29:59 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell-local"}
2021/11/03 00:29:59 Waiting for RPC address for: /usr/bin/packer
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: [INFO] Packer version: 1.7.6 [go1.17.1 linux amd64]
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: [WARN] Config file doesn't exist: /home/tode/.packerconfig
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: [INFO] Setting cache directory: /home/tode/.cache/packer
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: args: []string{"packer-provisioner-shell-local"}
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: Plugin address: unix /tmp/packer-plugin3346789847
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: Waiting for connection...
2021/11/03 00:29:59 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin3346789847
2021/11/03 00:29:59 packer-provisioner-shell-local plugin: Serving a plugin connection...
2021/11/03 00:29:59 Build debug mode: false
vsphere-iso.this: output will be in this color.
2021/11/03 00:29:59 Force build: false

2021/11/03 00:29:59 On error: 
2021/11/03 00:29:59 Waiting on builds to complete...
2021/11/03 00:29:59 Starting build run: vsphere-iso.this
2021/11/03 00:29:59 Running builder: 
2021/11/03 00:29:59 [INFO] (telemetry) Starting builder vsphere-iso.this
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: No URLs were provided to Step Download. Continuing...
==> vsphere-iso.this: Creating CD disk...
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: CD label is set to cidata
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: CD path: /tmp/packer698590723.iso
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: Wrote 0 bytes to meta-data
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: Wrote 3226 bytes to user-data
2021/11/03 00:30:15 packer-builder-vsphere-iso plugin: Executing: /usr/bin/mkisofs [-joliet -volid cidata -o /tmp/packer698590723.iso /tmp/packer_to_cdrom517624701]
    vsphere-iso.this: Warning: creating filesystem with Joliet extensions but without Rock Ridge
    vsphere-iso.this: extensions. It is highly recommended to add Rock Ridge.
    vsphere-iso.this: I: -input-charset not specified, using utf-8 (detected in locale settings)
    vsphere-iso.this: Total translation table size: 0
    vsphere-iso.this: Total rockridge attributes bytes: 0
    vsphere-iso.this: Total directory bytes: 156
    vsphere-iso.this: Path table size(bytes): 10
    vsphere-iso.this: Max brk space used 0
    vsphere-iso.this: 182 extents written (0 MB)
    vsphere-iso.this: Done copying paths from CD_dirs
==> vsphere-iso.this: Uploading packer698590723.iso to packer_cache/packer698590723.iso
==> vsphere-iso.this: Creating VM...
==> vsphere-iso.this: Customizing hardware...
==> vsphere-iso.this: Mounting ISO images...
2021/11/03 00:30:20 packer-builder-vsphere-iso plugin: Check if ISO path is a Content Library path
2021/11/03 00:30:47 packer-builder-vsphere-iso plugin: ISO path not identified as a Content Library path
2021/11/03 00:30:47 packer-builder-vsphere-iso plugin: Using [datastore] _ISO/ubuntu-20.04.3-live-server-amd64.iso as the datastore path
2021/11/03 00:30:47 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc000fbb880 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso '[datastore] _ISO/ubuntu-20.04.3-live-server-amd64.iso'
2021/11/03 00:30:48 packer-builder-vsphere-iso plugin: Check if ISO path is a Content Library path
2021/11/03 00:31:26 packer-builder-vsphere-iso plugin: ISO path not identified as a Content Library path
2021/11/03 00:31:26 packer-builder-vsphere-iso plugin: Using [datastore] packer_cache//packer698590723.iso as the datastore path
2021/11/03 00:31:26 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc0012215e0 <nil> <nil> <nil> 0 <nil>} 0 [3000]}' with iso '[datastore] packer_cache//packer698590723.iso'
==> vsphere-iso.this: Adding configuration parameters...
2021/11/03 00:31:26 packer-builder-vsphere-iso plugin: No floppy files specified. Floppy disk will not be made.
==> vsphere-iso.this: Set boot order...
==> vsphere-iso.this: Power on VM...
==> vsphere-iso.this: Waiting 2s for boot...
==> vsphere-iso.this: Typing boot command...
2021/11/03 00:31:29 packer-builder-vsphere-iso plugin: Special code '<esc>' found, replacing with: CodeEscape
2021/11/03 00:31:30 packer-builder-vsphere-iso plugin: Special code '<esc>' found, replacing with: CodeEscape
2021/11/03 00:31:30 packer-builder-vsphere-iso plugin: Special code '<esc>' found, replacing with: CodeEscape
2021/11/03 00:31:30 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2021/11/03 00:31:30 packer-builder-vsphere-iso plugin: [INFO] Waiting 1s
2021/11/03 00:31:31 packer-builder-vsphere-iso plugin: Sending char '/', code CodeSlash, shift false
2021/11/03 00:31:31 packer-builder-vsphere-iso plugin: Sending char 'c', code CodeC, shift false
2021/11/03 00:31:31 packer-builder-vsphere-iso plugin: Sending char 'a', code CodeA, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char 'p', code CodeP, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char 'e', code CodeE, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char 'r', code CodeR, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char '/', code CodeSlash, shift false
2021/11/03 00:31:32 packer-builder-vsphere-iso plugin: Sending char 'v', code CodeV, shift false
2021/11/03 00:31:33 packer-builder-vsphere-iso plugin: Sending char 'm', code CodeM, shift false
2021/11/03 00:31:33 packer-builder-vsphere-iso plugin: Sending char 'l', code CodeL, shift false
2021/11/03 00:31:33 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:33 packer-builder-vsphere-iso plugin: Sending char 'n', code CodeN, shift false
2021/11/03 00:31:33 packer-builder-vsphere-iso plugin: Sending char 'u', code CodeU, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char 'z', code CodeZ, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char 'n', code CodeN, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:34 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2021/11/03 00:31:35 packer-builder-vsphere-iso plugin: Sending char 'r', code CodeR, shift false
2021/11/03 00:31:35 packer-builder-vsphere-iso plugin: Sending char 'd', code CodeD, shift false
2021/11/03 00:31:35 packer-builder-vsphere-iso plugin: Sending char '=', code CodeEqualSign, shift false
2021/11/03 00:31:35 packer-builder-vsphere-iso plugin: Sending char '/', code CodeSlash, shift false
2021/11/03 00:31:35 packer-builder-vsphere-iso plugin: Sending char 'c', code CodeC, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char 'a', code CodeA, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char 'p', code CodeP, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char 'e', code CodeE, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char 'r', code CodeR, shift false
2021/11/03 00:31:36 packer-builder-vsphere-iso plugin: Sending char '/', code CodeSlash, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 'n', code CodeN, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 'r', code CodeR, shift false
2021/11/03 00:31:37 packer-builder-vsphere-iso plugin: Sending char 'd', code CodeD, shift false
2021/11/03 00:31:38 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2021/11/03 00:31:38 packer-builder-vsphere-iso plugin: Sending char 'a', code CodeA, shift false
2021/11/03 00:31:38 packer-builder-vsphere-iso plugin: Sending char 'u', code CodeU, shift false
2021/11/03 00:31:38 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2021/11/03 00:31:38 packer-builder-vsphere-iso plugin: Sending char 'o', code CodeO, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 'n', code CodeN, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 'a', code CodeA, shift false
2021/11/03 00:31:39 packer-builder-vsphere-iso plugin: Sending char 'l', code CodeL, shift false
2021/11/03 00:31:40 packer-builder-vsphere-iso plugin: Sending char 'l', code CodeL, shift false
2021/11/03 00:31:40 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2021/11/03 00:31:40 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2021/11/03 00:31:40 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
==> vsphere-iso.this: Waiting for IP...
2021/11/03 00:32:38 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:38 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:39 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:39 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:40 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:40 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:41 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:41 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:42 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:42 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:43 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:43 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:44 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:44 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:45 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:45 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:46 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:46 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:47 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:47 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:48 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:48 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:49 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:49 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:50 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:50 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:51 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:51 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:52 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:53 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:53 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:54 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:54 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:55 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:55 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:56 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:56 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:57 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:57 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:58 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:58 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:59 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:32:59 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:00 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:00 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:01 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:01 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:02 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:02 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:03 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:03 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:04 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:04 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:05 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:05 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:06 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:06 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:07 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:07 packer-builder-vsphere-iso plugin: VM IP aquired:
2021/11/03 00:33:08 packer-builder-vsphere-iso plugin: VM IP aquired: 10.149.100.128
2021/11/03 00:33:08 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.149.100.128
2021/11/03 00:33:10 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.149.100.128
2021/11/03 00:33:11 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.149.100.128
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: VM IP is still the same: 10.149.100.128
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: VM IP seems stable enough: 10.149.100.128
==> vsphere-iso.this: IP address: 10.149.100.128
==> vsphere-iso.this: Using SSH communicator to connect: 10.149.100.128
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: [INFO] Waiting for SSH, up to timeout: 30m0s
==> vsphere-iso.this: Waiting for SSH to become available...
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:33:13 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:33:16 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:33:16 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:33:23 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:33:23 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:33:23 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:33:27 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:33:27 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:33:34 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:33:34 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:33:34 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:33:39 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:33:39 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:33:46 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:33:46 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:33:46 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:33:48 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:33:48 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:33:55 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:33:55 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:33:56 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:33:58 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:33:58 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:34:05 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:34:05 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:34:05 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:34:10 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:34:10 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:34:17 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:34:17 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:34:17 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:34:21 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:34:21 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:34:28 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:34:28 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:34:28 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:34:33 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:34:33 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:34:40 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:34:40 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:34:40 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:34:45 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:34:45 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
2021/11/03 00:34:52 packer-builder-vsphere-iso plugin: [INFO] Attempting SSH connection to 10.149.100.128:22...
2021/11/03 00:34:52 packer-builder-vsphere-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/11/03 00:34:52 packer-builder-vsphere-iso plugin: [DEBUG] handshaking with SSH
2021/11/03 00:34:56 packer-builder-vsphere-iso plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2021/11/03 00:34:56 packer-builder-vsphere-iso plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.
==> vsphere-iso.this: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
==> vsphere-iso.this: Power off VM...
==> vsphere-iso.this: Destroying VM...
==> vsphere-iso.this: Deleting cd_files image from remote datastore ...
2021/11/03 00:34:58 packer-builder-vsphere-iso plugin: Deleting CD disk: /tmp/packer698590723.iso
2021/11/03 00:34:58 [INFO] (telemetry) ending vsphere-iso.this
==> Wait completed after 4 minutes 59 seconds
2021/11/03 00:34:58 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2021/11/03 00:34:58 machine readable: vsphere-iso.this,error []string{"Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain"}
==> Builds finished but no artifacts were created.
2021/11/03 00:34:58 [INFO] (telemetry) Finalizing.
Build 'vsphere-iso.this' errored after 4 minutes 59 seconds: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

==> Wait completed after 4 minutes 59 seconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.this: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

==> Builds finished but no artifacts were created.
2021/11/03 00:34:59 waiting for all plugin processes to complete...
2021/11/03 00:34:59 /usr/bin/packer: plugin process exited
2021/11/03 00:34:59 /usr/bin/packer: plugin process exited
2021/11/03 00:34:59 /usr/bin/packer: plugin process exited

But the problem here is that when packer tried to connect via SSH and handshake, the VM was still not ready. Install process did not finish. Even if the ssh_timeout was set to 30min packer just exit after ~5min.

Configuration:

source "vsphere-iso" "this" {
  ....
  insecure_connection  = true
  vm_name = "TMPL-Ubuntu20"
  guest_os_type = "ubuntu64Guest"

  ssh_username = var.ssh_username
  ssh_password = var.ssh_password
  ssh_timeout = "30m"
  #ssh_proxy_host = "127.0.0.1" #not used for now.
  ...
}

build {
  sources  = [
    "source.vsphere-iso.this"
  ]

provisioner "shell" {
inline = [
  "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do sleep 5; done",
]
}
  provisioner "shell-local" {
    inline  = ["echo the address is: $PACKER_HTTP_ADDR and build name is: $PACKER_BUILD_NAME"]
  }
}

@nywilken
Copy link
Contributor

nywilken commented Nov 2, 2021

Got it, thanks for the log and updated description of the error. So Packer is able to connect to the SSH port of the running instance but it is failing the handshake. It looks like the timeout of 30m is superseded by the number of ssh_handshake_attempts configuration which defaults to 10.

If you increase ssh_handshake_attempts to a really high value (e.g 200) is Packer able to eventually connect?

@todeb
Copy link
Author

todeb commented Nov 3, 2021

yes, that works. Thank you.

@nywilken
Copy link
Contributor

nywilken commented Nov 3, 2021

Hi @todeb thanks for the update. Glad that increasing the handshake attempts worked. I'm going to mark this as a bug as it is not immediately clear from the logged errors what is happening. I think we can improve the error messaging and documentation for these configuration options.

@nywilken nywilken transferred this issue from hashicorp/packer Nov 3, 2021
@unbreakabl3
Copy link

I have the same issue. The workaround with increasing ssh_handshake_attempts did work for me as well. I am running Packer 1.8.0

@rlaun
Copy link

rlaun commented Apr 6, 2022

Same on an Ubuntu 18.04 host running Packer 1.8.0, it seems like ssh_timeout is ignored. The workaround with ssh_handshake_attempts works though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants